payment¶
Evaluates the periodic payment for an investment.
Synopsis¶
payment (rate, nPeriods, presentValue, futureValue, when)
Required Arguments¶
- float
rate
(Input) - Interest rate.
- Int
nPeriods
(Input) - Total number of periods.
- float
presentValue
(Input) - The current value of a stream of future payments, after discounting the payments using some interest rate.
- 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 periodic payment for an investment. If no result can be computed, NaN is returned.
Description¶
Function payment
computes the periodic payment for 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, payment
computes the periodic payment of a 25-year
$100,000 loan with an annual interest rate of 8%. The payment is made at the
end of each period.
from __future__ import print_function
from numpy import *
from pyimsl.math.payment import payment, AT_END_OF_PERIOD
rate = 0.08
n_periods = 25
present_value = 100000.00
future_value = 0.0
when = AT_END_OF_PERIOD
payment_amt = payment(rate, n_periods, present_value,
future_value, when)
print("The payment due each year on the $100,000 loan is $%.2f."
% (payment_amt))
Output¶
The payment due each year on the $100,000 loan is $-9367.88.