469,290 Members | 1,872 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,290 developers. It's quick & easy.

Calculating Inflation, retirement and cost of living adjustmentsover 30 years

rbt
Is this mathematically correct?
def inflation():
start = int(str.strip(raw_input("How much money do you need each
month at the start of retirement: ")))
inflation = float(str.strip(raw_input("What will inflation average
over the next 30 years(.03, .04, etc): ")))

for x in xrange(30):
start = start*inflation+start
print start

inflation()
Jul 19 '05 #1
2 2141
rbt wrote:
Is this mathematically correct?
def inflation():
start = int(str.strip(raw_input("How much money do you need each
month at the start of retirement: ")))
inflation = float(str.strip(raw_input("What will inflation average
over the next 30 years(.03, .04, etc): ")))

for x in xrange(30):
start = start*inflation+start
print start

inflation()


The *arithmetic* is tedious but "correct" -- we won't concern ourselves
with rounding errors here. The *mathematics* might be better expressed as

required = start * (1.0 + inflation_rate_per_period) ** number_of_periods
Jul 19 '05 #2
rbt wrote:
Is this mathematically correct?
def inflation():
start = int(str.strip(raw_input("How much money do you need each
month at the start of retirement: ")))
inflation = float(str.strip(raw_input("What will inflation average
over the next 30 years(.03, .04, etc): ")))

for x in xrange(30):
start = start*inflation+start
print start

inflation()


I'm not really familiar with financial calculations, but it looks
correct. There's a faster way though, since repeated multiplication is
the same as taking the power with the number of years as the exponent:

def inflation():
start = ... # same as before
inflation = ... # same as before

print start * (1+inflation)**30
--
If I have been able to see further, it was only because I stood
on the shoulders of giants. -- Isaac Newton

Roel Schroeven
Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Hans Gruber | last post: by
3 posts views Thread by Ron Vecchi | last post: by
2 posts views Thread by bossenb6 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.