internal_rate_of_return

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

Synopsis

#include <imsl.h>

float imsl_f_internal_rate_of_return (int count, float values[], , 0)

The type double function is imsl_d_internal_rate_of_return.

Required Arguments

int count (Input)
Number of cash flows in values. count must be greater than one.

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.

Synopsis with Optional Arguments

#include <imsl.h>

float imsl_f_internal_rate_of_return (int count, float values[],

IMSL_XGUESS, float guess,

IMSL_HIGHEST, float max,

IMSL_MAX_EVALS, int max_evals,

IMSL_ABERTH_METHOD,

IMSL_TOLERANCE_ABERTH, float tol_aberth,

0)

Optional Arguments

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

IMSL_HIGHEST, float max (Input)
Maximum value of the internal rate of return allowed.
Default: max = 1.0 (100%).

IMSL_MAX_EVALS, int max_evals (Input)
The maximum number of function evaluations allowed in the computation of the internal rate of return. If IMSL_ABERTH_METHOD is used, max_evals denotes the number of iterations allowed in the Ehrlich-Aberth method.
Default: max_evals = 1000.

IMSL_ABERTH_METHOD (Input)
Compute the internal rate of return using the Ehrlich-Aberth method. If IMSL_ABERTH_METHOD is present, optional argument IMSL_XGUESS is ignored.

IMSL_TOLERANCE_ABERTH, float tol_aberth (Input)
Tolerance value used in the Ehrlich-Aberth method to decide if a complex root of the internal rate of return related polynomial is a candidate for a real-valued root.
Default:
tol_aberth = 1000 * imsl_f_machine(4)in single precision.
tol_aberth = 1000 * imsl_d_machine(4)in double precision.

Description

Function imsl_f_internal_rate_of_return 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 equation:

 

where n is the number of cash flows, Ci is the i-th cash flow (including the initial investment C0), and r is the internal rate of return.
If optional argument IMSL_ABERTH_METHOD is used, the roots of the polynomial with real coefficients

are computed by the Ehrlich-Aberth method from function imsl_f_zeros_poly. Since the roots returned from zeros_poly are complex, a root of the polynomial is considered potentially real-valued if the imaginary part of x satisfies the condition

tol_aberth

If the additional condition

with u the unit roundoff and

is satisfied, is considered close enough to a real root of and therefore accepted as a real root of . If have been identified as real roots of , then the related rates of return are computed via the transformation . The internal rate of return is defined as the maximum of the values that is less than or equal to the value max from optional argument IMSL_HIGHEST.

 

Example

In this example, imsl_f_internal_rate_of_return 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.

#include <stdio.h>
#include <imsl.h>
 
int main()
{
 float values[] = { -4500., -800., 800., 800., 600.,
                  600., 800., 800., 700., 3000. };
 float internal_rate;
 
 internal_rate = imsl_f_internal_rate_of_return (10, values, 0);
 printf ("After 9 years, the internal rate of return on the ");
 printf ("cows is %.2f%%.\n", internal_rate * 100.);
}

Output

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

Warning Errors

IMSL_IRR_ROOTS_LT_NDEG

Aberth's method is not able to compute all # roots of the IRR related polynomial accurately. A larger "max_evals" value might result in a larger number of accurately identified roots.

Fatal Errors

IMSL_IRR_NOT_COMPUTABLE

Unable to compute the internal rate of return. Check if the sequence of total initial investment costs and cash inflows enable an internal rate of return for the given value of “max”. Use or modification of variable “guess” might also lead to better results.

IMSL_IRR_NOT_COMPUTABLE_2

Aberth's method is unable to compute the internal rate of return. Rerun with a new "max" or a new "tol_aberth" value or try the default solution method.

IMSL_IRR_NOT_COMPUTABLE_3

Aberth's method is unable to compute the internal rate of return. Besides, for the given "max_evals" value, the method is not able to compute all # roots of the IRR related polynomial accurately. Rerun with a larger "max_evals", a new "max" or a new "tol_aberth" value or try the default solution method.

IMSL_IRR_NOT_COMPUTABLE_4

For the given tolerance, "tol_aberth" = #, no real root of the IRR related polynomial can be identified. It is possible that no real root exists. The smallest absolute value of the imaginary part of the roots is #. Rerun with a larger "tol_aberth" value or try the default solution method.

IMSL_IRR_NOT_COMPUTABLE_5

For the given tolerance, "tol_aberth" = #, no real root of the IRR related polynomial can be identified. It is possible that no real root exists. The smallest absolute value of the imaginary part of the roots is #. Besides, for the given "max_evals" value, Aberth's method is not able to compute all # roots of the polynomial accurately. Rerun with a larger "max_evals" value, a larger "tol_aberth" value or try the default solution method.

IMSL_IRR_NO_ROOTS_COMPUTABLE

Aberth's method is not able to compute a root of the IRR related polynomial for "max_evals" = #. Try a larger "max_evals" value.