Financial Algorithms Cookbook | Time Value of Money

Algorithm: Calculating the Annuity Payments

Payments in Time Value of Money formulas are a series of equal, evenly-spaced cash flows of an annuity such as payments for a mortgage or monthly receipts from a retirement account.

Payments must:

  • be the same amount each period
  • occur at evenly spaced intervals
  • occur exactly at the beginning or end of each period
  • be all inflows or all outflows (payments or receipts)
  • represent the payment during one compounding (or discount) period

Calculate Payments When Present Value Is Known

The Present Value is an amount that you have now, such as the price of property that you have just purchased or the value of equipment that you have leased. When you know the present value, interest rate, and number of periods of an ordinary annuity, you can solve for the payment with this formula:

PMT = PV  /  [(1- (1 / (1 + i)n )) / i]

Where:

  • PV = Present Value of an ordinary annuity (payments are made at the end of each period)
  • i = interest per period
  • n = number of periods

Calculate Payments When Future Value Is Known

The Future Value is an amount that you wish to have after a number of periods have passed. For example, you may need to accumulate $20,000 in ten years to pay for college tuition. When you know the future value, interest rate, and number of periods of an ordinary annuity, you can solve for the payment with this formula:

PMT = FV  /  [((1 + i)n - 1 )  /  i]

Where:

  • FV = Future Value of an ordinary annuity (payments are made at the end of each period)
  • i = interest per period
  • n = number of periods

The general formula is to solve for PMT using:

0 = PV (1 + i)fractionalPart(n) + (1+iS)PMT[(1-(1+i)-integerPart(n)/i] + FV(1 + i)-integerPart(n)

Where:

  • PV = Present Value of an ordinary annuity (payments are made at the end of each period)
  • FV = Future Value of an ordinary annuity (payments are made at the end of each period)
  • i = interest per period
  • n = number of periods
  • S = True when payments are made in advance.
def paymentAmount(i, PV, FV, n, inAdv=False, continious=False):
    i /= 100.0
    nFractionPart,nIntegerPart  = modf(n)   
    discount = pow(1.0+i, -nIntegerPart)
    if inAdv:
        PMT =1/(1.0+i)
    else:
        PMT =1.0
        
    if continious:
        pvs =pow((1.0+i),nFractionPart) 
    else:
        pvs =(1.0+ i*nFractionPart)
    PMT = -PMT*(FV*discount + PV*pvs)*(i/(1-discount))
    return PMT

Example

You want to save for your retirement 600,000. This will be in 15 years. You open a retirement account with a deposit of 32,000 that pays 9.75 compounded semiannually. You plan to make semiannual deposits starting six months later. What their value be?

FV= 600000
PV -32000
n= 15*2
i = 9.75/2.0
paymentAmount(i, PV, FV, n)
>>-7174.4 

References

  • Gallager, T; Andrew Jr., J., Financial Management: Principals and Practices, Upper Saddle River, NJ: Prentice Hall, 1996
  • HP-12C Business Calculator Owner's Manual, Hewlett Packard, 1984
  • HP-10B Business Calculator Owner's Manual, Hewlett Packard, 1994