[Edu-sig] Re: (financial calculation) - using units

Christian Mascher christian.mascher at gmx.de
Tue Feb 15 21:51:34 CET 2005


> def future_value(iday,cday,ivalue,cvalue,years):
>    days_invested=(cday-iday).days
>    year_periods=365/days_invested

Bothered me (too), the year_periods should be of a time-dimension.

	duration_in_years=days/365

>    annualized_rate = math.log(cvalue/ivalue)*year_periods
                                               ^
The rate is _per_ time-unit, so I would put the / here. Result remains 
the same of course.

I think as a physicist, don't know how they do it in finances.

BTW, how does one express units of measure in Python/programming? 
Calculations in applications aren't just about numbers. For instance, 
how could one express equations like
	10000 cm^2 == 1 m^2
	1000 g == 0.001 t
in a programming language? Another point would be the inclusion of a 
measure of accuracy:
For a physicist or engineer
	1 cm != 1.00 cm
because the first could be 0.9 cm, the second couldn't, beeing more 
accurate.

Greetings,

Christian




More information about the Edu-sig mailing list