Calculating Inflation, retirement and cost of living adjustmentsover 30 years

R

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()
 
J

John Machin

rbt said:
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
 
R

Roel Schroeven

rbt said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top