cumulativeInterest

Evaluates the cumulative interest paid between two periods.

Synopsis

cumulativeInterest (rate, nPeriods, presentValue, start, end, when)

Required Arguments

float rate (Input)
Interest rate.
int nPeriods (Input)
Total number of payment periods. nPeriods cannot be less than or equal to 0.
float presentValue (Input)
The current value of a stream of future payments, after discounting the payments using some interest rate.
int start (Input)
Starting period in the calculation. start cannot be less than 1; or greater than end.
int end (Input)
Ending period in the calculation.
int when (Input)
Time in each period when the payment is made, either AT_END_OF_PERIOD or AT_BEGINNING_OF_PERIOD. For a more detailed discussion on when see the Usage Notes section of this chapter.

Return Value

The cumulative interest paid between the first period and the last period. If no result can be computed, NaN is returned.

Description

Function cumulativeInterest evaluates the cumulative interest paid between the first period and the last period.

It is computed using the following:

\[\sum_{i=\mathit{start}}^{\mathit{end}} \mathrm{interest}_i\]

where \(interest_i\) is computed from interestPayment for the i-th period.

Example

In this example, cumulativeInterest computes the total interest paid for the first year of a 30-year $200,000 loan with an annual interest rate of 7.25%. The payment is made at the end of each month.

from __future__ import print_function
from numpy import *
from pyimsl.math.cumulativeInterest import cumulativeInterest, AT_END_OF_PERIOD, AT_BEGINNING_OF_PERIOD

rate = 0.0725 / 12
n_periods = 12 * 30
present_value = 200000
start = 1
end = 12

total = cumulativeInterest(rate, n_periods, present_value,
                           start, end, AT_END_OF_PERIOD)
print("First year interest = $%.2f." % (total))

Output

First year interest = $-14436.52.