interestPayment¶
Evaluates the interest payment for an investment for a given period.
Synopsis¶
interestPayment (rate, period, nPeriods, presentValue, futureValue, when)
Required Arguments¶
- float
rate
(Input) - Interest rate.
- int
period
(Input) - Payment period.
- 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 on see the Usage Notes section of this chapter.
Return Value¶
The interest payment for an investment for a given period. If no result can be computed, NaN is returned.
Description¶
Function interestPayment
computes the interest payment for an investment
for a given period.
It is computed using the following:
\[\left\{
\mathit{presentValue}(1+\mathit{rate})^{\mathrm{nPeriods}-1} +
\mathit{payment}(1 + \mathit{rate} * \mathit{when})
\left[\frac{(1+\mathit{rate})^{\mathrm{nPeriods}-1}}{\mathit{rate}}\right]
\right\} \mathit{rate}\]
Example¶
In this example, interestPayment
computes the interest payment for the
second year 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.interestPayment import interestPayment, AT_END_OF_PERIOD
rate = 0.08
period = 2
n_periods = 25
present_value = 100000.00
future_value = 0.0
interest_payment = interestPayment(rate, period, n_periods,
present_value, future_value, AT_END_OF_PERIOD)
print("The interest due the second year on the $100,000", end=' ')
print("loan is $%.2f." % (interest_payment))
Output¶
The interest due the second year on the $100,000 loan is $-7890.57.