presentValue¶
Evaluates the net present value of a stream of equal periodic cash flows, which are subject to a given discount rate.
Synopsis¶
presentValue (rate, nPeriods, payment, futureValue, when)
Required Arguments¶
- float
rate
(Input) - Interest rate.
- int
nPeriods
(Input) - Total number of periods.
- float
payment
(Input) - Payment made in each period.
- float
futureValue
(Input) - The value, at some time in the future, of a current amount and a stream of payments.
- int
when
(Input) - Time in each period when the payment is made, either
AT_END_OF_PERIOD
orAT_BEGINNING_OF_PERIOD
. For a more detailed discussion onwhen
see the Usage Notes section of this chapter.
Return Value¶
The present value of an investment. If no result can be computed, NaN is returned.
Description¶
Function presentValue
computes the present value of an investment.
It can be found by solving the following:
If rate
=0
\[\textit{presentValue} + (\textit{payment})(\textit{nPeriods}) + \textit{futureValue} = 0\]
If rate
≠ 0
\[\begin{split}\begin{array}{l}
\mathit{presentValue}(1+\mathit{rate})^{\mathit{nPeriods}} + \\
\mathit{payment}[1 + \mathit{rate}(\mathit{when})]
\frac{(1+\mathit{rate})^{\mathit{nPeriods}}-1}{\mathit{rate}} +
\mathit{futureValue} = 0
\end{array}\end{split}\]
Example¶
In this example, presentValue
computes the present value of 20 payments
of $500,000 per payment ($10 million) with an annual interest rate of 6%.
The payment is made at the end of each period.
from __future__ import print_function
from numpy import *
from pyimsl.math.presentValue import presentValue, AT_END_OF_PERIOD
rate = 0.06
payment = 500000.
n_periods = 20
future_value = 0.
when = AT_END_OF_PERIOD
present_value = presentValue(rate, n_periods, payment,
future_value, when)
print("The present value of the $10 million prize is", end=' ')
print("$%.2f." % (present_value))
Output¶
The present value of the $10 million prize is $-5734960.61.