internalRateOfReturn

Evaluates the internal rate of return for a schedule of cash flows.

Synopsis

internalRateOfReturn (values)

Required Arguments

float values[] (Input)
Array of size count of cash flows which occur at regular intervals, which includes the initial investment.

Return Value

The internal rate of return for a schedule of cash flows. If no result can be computed, NaN is returned.

Optional Arguments

xguess, float (Input)
Initial guess at the internal rate of return.
highest, float (Input)

Maximum value of the internal rate of return allowed.

Default: 1.0 (100%).

Description

Function internalRateOfReturn computes the internal rate of return for a schedule of cash flows. The internal rate of return is the interest rate such that a stream of payments has a net present value of zero.

It is found by solving the following:

\[0 = \sum_{i=1}^{\mathit{count}} \frac{\mathit{value}_i}{(1 + \mathit{rate})^i}\]

where \(value_i\) =the i-th cash flow, rate is the internal rate of return.

Example

In this example, internalRateOfReturn computes the internal rate of return for nine cash flows, -$800, $800, $800, $600, $600, $800, $800, $700 and $3,000, with an initial investment of $4,500.

from __future__ import print_function
from numpy import *
from pyimsl.math.internalRateOfReturn import internalRateOfReturn

values = [-4500., -800., 800., 800., 600.,
          600., 800., 800., 700., 3000.]
internal_rate = internalRateOfReturn(values)

print("After 9 years, the internal rate of return on the", end=' ')
print("cows is %.2f%%." % (internal_rate * 100.))

Output

After 9 years, the internal rate of return on the cows is 7.21%.