# Math for Future Value of Growing Annuity

Am I working this out correctly? I need to verify that my code is correct...

$$1000 \cdot \left(\frac{(1 + 0.1 / 12)^{40 * 12} - (1 + 0.06 / 12)^{40 * 12}}{(0.1 / 12) - (0.06 / 12)}\right)$$

Something like this:

53.700663174244 - 10.957453671655 ( = 42.7432095026 )
/
0.0083333333333333 - 0.005 ( = 0.00333333333 )
*
1000
=
12822 962.8636


ps. could someone please help me with the tag selection * blush*

EDIT: Sorry I know this is a mouthful, but if the math don't add up the code can't add up plus I'm actually a designer... not equal to programmer or mathematician. I'm a creative logician :)

Below is part A which must be added (summed) to part B (original question).

A: $$Future Value (FV) of Lumpsum = PV \cdot (1+i/12)^{b*12}$$

B:

$$FV of Growing Annuity = R1 \cdot \left(\frac{(1 + i / 12)^{b * 12} - (1 + g / 12)^{b * 12}}{(i / 12) - (g / 12)}\right)$$

• Current savings for retirement (Rands) = PV
• Rate of return = i/100
• Retirement age (years) – Current age (years) = b
• Current monthly contribution towards retirement (Rands) = R1
• 6/100 (Annual Growth rate of annuities) = g

This is all I have to offer except for the more complicated formula to work out the rest of "Savings for Retirement", but if my example B is correct then the B they gave me is wrong and it's driving me nuts because I'm also having trouble with:

C: $$PV of an Growing Annuity = \left(\frac{R2 \cdot(1 + g / 12)^{b * 12}}{(i / 12) - (g / 12)}\right) \cdot \left(1- \left( \frac{(1 + g / 12)^{b * 12}}{(1 + i / 12)^{n * 12}}\right)\right)$$

• Rate of return = i/100
• Retirement age (years) – Current age (years) = b
• 95 (Assumed age of death) - Retirement age (years) = n
• Monthly income need at retirement (Rands) = R2
• 6/100 (Annual Growth rate of annuities) = g

Which then must be: $$C-(A+B)$$ And finally, let me just give it all...

D: $$FV of Growing Annuity = R3 \cdot \left(\frac{((1 + i / 12)^{b * 12} - (1 + g / 12)^{b * 12} )}{(i / 12) - (g / 12)}\right)$$

• Answer of C-(A + B) = FV of Growing Annuity
• Rate of return = i/100
• Retirement age (years) – Current age (years) = b
• 6/100 (Annual Growth rate of annuities) = g

Answers needed:

• Total Monthly Contribution Needed = R3 (Solve out of D) + R2 (Current Monthly Contributions towards retirement)
• Additional Monthly Contribution Needed = R3 (Solve out of D)

Publishing the calculator now... http://exceed.myib.co.za/calc

• You should state what problem you are trying to solve. It appears you are starting with a deposit of 1000 that draws some amount of interest for some time, but what the subtractions mean I can't guess. I think the first term is $10\%$ annual interest compounded monthly for 40 years. Then you should write it mathematically-we don't necessarily know what the arguments for Math.Pow are. – Ross Millikan Apr 24 '14 at 21:05
• It's for a "Savings for Retirement Calculator". This is just the one part. @RandomUser made it pretty and thanks for that! – wilburlikesmith Apr 24 '14 at 21:15
• To elaborate on what @RossMillikan meant, you gave a series of numbers and asked "Is this correct?" without specifying what those numbers mean and the goal of the calculation. For instance, $1000(1+0.1/12)^{40*12}$ gives your total money with an initial investment of \$1000, a rate of 10%, monthly compounding and 40 years of time. Why are you then subtracting the same calculation but with a 6% rate? Why are you dividing by the difference of these rates? We can't know if what you're doing is correct if we don't know what you're trying to do. – RandomUser Apr 24 '14 at 21:27
• I hope my edit is clear enough and explains a little better. – wilburlikesmith Apr 24 '14 at 23:38