presentValueSchedule

Evaluates the present value for a schedule of cash flows. It is not necessary that the cash flows be periodic.

Synopsis

presentValueSchedule (rate, values, dates)

Required Arguments

float rate (Input)
Interest rate.
float values[] (Input)
Array of size count of cash flows.
struct tm dates[] (Input)
Array of size count of dates cash flows are made. For a more detailed discussion on dates see the Usage Notes section of this chapter.

Return Value

The present value for a schedule of cash flows that is not necessarily periodic. If no result can be computed, NaN is returned.

Description

Function presentValueSchedule computes the present value for a schedule of cash flows that is not necessarily periodic.

It can be found by solving the following:

\[\sum_{i=1}^{count} \frac {\mathit{value}_i} {(1+\mathit{rate})^{\left(d_i-d_{\mathit{1}}\right)/365}}\]

In the equation above, \(d_i\) represents the i-th payment date, \(d_1\) represents the 1st payment date, and \(value_i\) represents the i-th cash flow.

Example

In this example, presentValueSchedule computes the present value of 3 payments, $1,000, $2,000 and $1,000, with an interest rate of 5% made on January 3, 1997, January 3, 1999 and January 3, 2000.

from __future__ import print_function
from numpy import *
from datetime import date
from pyimsl.math.presentValueSchedule import presentValueSchedule

rate = 0.05
values = [1000., 2000., 1000.]

dates = [date(1997, 1, 3),
         date(1999, 1, 3),
         date(2000, 1, 3)]

xnpv = presentValueSchedule(rate, values, dates)
print("The present value of the cash flows is $%.2f." % (xnpv))

Output

The present value of the cash flows is $3677.90.