Financial Algorithms Cookbook | Time Value of Money

Algorithm: Calculating the Present Value

Present Value Of A Single Amount

Present Value is an amount today that is equivalent to a future payment, or series of payments, that has been discounted by an appropriate interest rate. Since money has time value, the present value of a promised future amount is worth less the longer you have to wait to receive it. The difference between the two depends on the number of compounding periods involved and the interest (discount) rate.

The relationship between the present value and future value can be expressed as:

PV = FV [ 1 / (1 + i)n ]

Where:

  • PV = Present Value
  • FV = Future Value
  • i = Interest Rate Per Period
  • n = Number of Compounding Periods

Present Value of Annuities

An annuity is a series of equal payments or receipts that occur at evenly spaced intervals. Leases and rental payments are examples. The payments or receipts occur at the end of each period for an ordinary annuity while they occur at the beginning of each period.for an annuity due. Present Value of an Ordinary Annuity

The Present Value of an Ordinary Annuity (PVoa) is the value of a stream of expected or promised future payments that have been discounted to a single equivalent value today. It is extremely useful for comparing two separate cash flows that differ in some way.

PV-oa can also be thought of as the amount you must invest today at a specific interest rate so that when you withdraw an equal amount each period, the original principal and all accumulated interest will be completely exhausted at the end of the annuity.

The Present Value of an Ordinary Annuity could be solved by calculating the present value of each payment in the series using the present value formula and then summing the results. A more direct formula is:

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

Where:

  • PV = Present Value of an Ordinary Annuity
  • PMT = Amount of each payment
  • i = Discount Rate Per Period
  • n = Number of Periods

Present Value of an Annuity Due (PVad)

The Present Value of an Annuity Due is identical to an ordinary annuity except that each payment occurs at the beginning of a period rather than at the end. Since each payment occurs one period earlier, we can calculate the present value of an ordinary annuity and then multiply the result by (1 + i).

PVad = PV (1+i)

Where:

  • PVad = Present Value of an Annuity Due
  • PV = Present Value of an Ordinary Annuity
  • i = Discount Rate Per Period

Putting it all togeather gives us the below algorithm.

def  presentValue(i, FV, PMT, n, inAdv=False, continous=False):
    i /= 100.0
    nFractionPart,nIntegerPart  = modf(n)
    discount = pow(1.0+i, -nIntegerPart)
    if inAdv:
        SPMT *=(1.0+i)
    else:
        SPMT =1.0
    if continous:
        pvs =pow((1.0+i),nFractionPart) 
    else:
        pvs =(1.0+ i*nFractionPart)
    PV = (-PMT/((i/(1-discount))*SPMT)-FV*discount)/pvs
    return PV

Example

You want a boat whose price is 50,000. You found financing with help of a loan shark that wants 15%. The deal requires you to make a down payment of 15,000 and monthly payments of 1500 over four years. What is the real price of this boat?

FV= 0
PMT = -1500
n= 4*12
i = 15.0/12.0
presentValue(i, FV, PMT, n) + 15000
>>68897.22

So the real cost of this boat will be 68897.20.

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