netPresentValue

Evaluates the net present value of a stream of unequal periodic cash flows, which are subject to a given discount rate.

Synopsis

netPresentValue (rate, values)

Required Arguments

float rate (Input)
Interest rate per period.
float values[] (Input)
Array of size count of equally-spaced cash flows.

Return Value

The net present value of an investment. If no result can be computed, NaN is returned.

Description

Function netPresentValue computes the net present value of an investment. Net present value is the current value of a stream of payments, after discounting the payments using some interest rate.

It is found by solving the following:

\[\sum_{i=1}^{\mathit{count}} \frac{\mathit{value}_i}{(1+\mathit{rate})^i}\]

where \(value_i\)= the i-th cash flow.

Example

In this example, netPresentValue computes the net present value of a $10 million prize paid in 20 years ($500,000 per year) with an annual interest rate of 6%.

from __future__ import print_function
from numpy import *
from pyimsl.math.netPresentValue import netPresentValue

rate = 0.06
count = 20
value = empty((20), dtype='double')

for i in range(0, count):
    value[i] = 500000.

net_present_value = netPresentValue(rate, value)
print("The net present value of the $10 million prize is $%.2f."
      % (net_present_value))

Output

The net present value of the $10 million prize is $5734960.61.