You want to calculate how much money you’ll have at retirement, assuming you’ll receive a series of equal periodic payments.

Calculate the future value of a series of periodic payments using the
custom `Math.FV( )`

function.

Suppose you are implementing a retirement calculator. People commonly deposit a certain amount of money each month into their retirement account. Typically, they want to know how much money they’ll accumulate in the account at some time in the future. There are two components to the accumulation of funds: the interest earned each period, plus the periodic payment that is added. The total value also includes a third component: the principal in the account at the beginning of the calculation.

Here is an enhanced version of the ```
futureValue(
)
```

function presented in Recipe 5.16. It calculates the future value based
on an initial payment plus periodic payments. We calculate the final
amount by adding together the appreciation of the principal and the
appreciation of the periodic payments. If the periodic payment is 0,
the calculation reduces to the equation from Recipe 5.16 (in which there is principal and
interest only). If there is no initial deposit, you can use 0 for the
* PV* parameter. You can add this to your

`Math.as`

file to use it in other projects.Math.FV = function (interest, n, PMT, PV) { //= initial deposit (present value) //`PV`

= periodic interest rate //`interest`

= number of payment periods ...`n`

Start Free Trial

No credit card required