interestRateAnnuity¶
Evaluates the interest rate per period of an annuity.
Synopsis¶
interestRateAnnuity (nPeriods, payment, presentValue, futureValue, when)
Required Arguments¶
- int
nPeriods
(Input) - Total number of periods.
- float
payment
(Input) - Payment made each period.
- 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 interest rate per period of an annuity. If no result can be computed, NaN is returned.
Optional Arguments¶
xguess
, float (Input)- Initial guess at the interest rate.
highest
, float (Input)Maximum value of the interest rate allowed.
Default: 1.0 (100%)
Description¶
Function interestRateAnnuity
computes the interest rate per period of an
annuity. An annuity is a security that pays a fixed amount at equally spaced
intervals.
It can be found by solving the following:
If rate
=0
\[\mathit{presentValue} + (\mathit{payment})(\mathit{nPeriods}) +
\mathit{futureValue} = 0\]
If rate
≠ 0
\[\begin{split}\begin{array}{l}
\mathit{presentValue} (1 + \mathit{rate})^{\mathrm{nPeriods}} + \\
\mathit{payment}[1 + \mathit{rate}(\mathit{when})]
\frac{(1+\mathit{rate})^{\mathrm{nPeriods}}-1}{\mathit{rate}} +
\mathit{futureValue} = 0
\end{array}\end{split}\]
Example¶
In this example, interestRateAnnuity
computes the interest rate of a
$20,000 loan that requires 70 payments of $350 each to pay off.
from __future__ import print_function
from numpy import *
from pyimsl.math.interestRateAnnuity import interestRateAnnuity, AT_BEGINNING_OF_PERIOD
n_periods = 70
payment = -350.00
present_value = 20000.00
future_value = 0.00
rate = interestRateAnnuity(n_periods, payment,
present_value, future_value, AT_BEGINNING_OF_PERIOD) * 12
print("The computed interest rate on the loan is %.2f%%." % (rate * 100.))
Output¶
The computed interest rate on the loan is 7.35%.