Financial modules for Python

jorjun jorjun at mac.com
Wed Oct 10 17:20:59 CEST 2001


> Now what about the truncated series?  Well, 1+z+z**2+...+z**59 is
> equal to X - (z**60)*X, where X is the infinite sum above.  So that
> payment stream is worth $5*[1/(1-z) - z**60/(1-z)] = $5*((1-z**60)/(1-z)).
> For i=6%, substituting back, z**60 is about .74, and the total is
> about $5*51.72, or $258.
Thanks, maths is not my forte, I managed a mere pass at A-level :)
I entered the following code based on your formula, I think I got last
after the truncated series bit.
#------------------------------------------------------------------
# Parameters
years = 1		# Investment period
pay = 5			# Monthly payment
an_rate= 6.0	# Percentage rate

# Calculation of future value
months = years * 12
i= an_rate/1200    # Rate as fraction per month
z= 1/(1+i)
x= 1/(1-z)
fv = pay* (x - z**months/(1-z) ) 

print """Years = %(years)d, Monthly payment =%(pay)d, \
	Annual Interest =%(interest)f, \
	Future value=%(future)f""" \
	% {'years':years, 'pay':pay, 'interest':an_rate, 'future':fv}
#------------------------------------------------------------------
Output
Years = 5, Monthly payment =5, 	Annual Interest =6.000000, 	Future value=259.920943

Years = 1, Monthly payment =5, 	Annual Interest =6.000000, 	Future value=58.385134
(This last I would expect to be at least 60, since 12 payments of 5
made, so must have errored!)



More information about the Python-list mailing list