internal_rate_schedule
Evaluates the internal rate of return for a schedule of cash flows. It is not necessary that the cash flows be periodic.
Synopsis
#include <imsl.h>
float imsl_f_internal_rate_schedule (int count, float values[], struct tm dates[], …, 0)
The type double function is imsl_d_internal_rate_schedule.
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 includes the initial investment.
struct tm dates[] (Input)
Array of size
count of dates cash flows are made see the
Usage Notes section of this chapter.
Return Value
The internal rate of return for a schedule of cash flows that is not necessarily periodic. If no result can be computed, NaN is returned.
Synopsis with Optional Arguments
#include <imsl.h>
float imsl_f_internal__rate_schedule (int count, float values[], struct tm dates[],
IMSL_XGUESS, float guess,
IMSL_HIGHEST, float max,
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: 1.0 (100%)
Description
Function imsl_f_internal_rate_schedule computes the internal rate of return for a schedule of cash flows that is not necessarily periodic. The internal rate such that the stream of payments has a net present value of zero.
It can be found by solving the following:
In the equation above, di represents the i-th payment date. d1 represents the 1st payment date. valuei represents the i-th cash flow. rate is the internal rate of return.
Example
In this example, imsl_f_internal_rate_schedule 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[10] = { -4500., -800., 800., 800., 600., 600.,
800., 800., 700., 3000. };
struct tm dates[10];
float xirr;
dates[0].tm_year = 98; dates[0].tm_mon = 0; dates[0].tm_mday = 1;
dates[1].tm_year = 98; dates[1].tm_mon = 9; dates[1].tm_mday = 1;
dates[2].tm_year = 99; dates[2].tm_mon = 4; dates[2].tm_mday = 5;
dates[3].tm_year = 100; dates[3].tm_mon = 4; dates[3].tm_mday = 5;
dates[4].tm_year = 101; dates[4].tm_mon = 5; dates[4].tm_mday = 1;
dates[5].tm_year = 102; dates[5].tm_mon = 6; dates[5].tm_mday = 1;
dates[6].tm_year = 103; dates[6].tm_mon = 7; dates[6].tm_mday = 30;
dates[7].tm_year = 104; dates[7].tm_mon = 8; dates[7].tm_mday = 15;
dates[8].tm_year = 105; dates[8].tm_mon = 9; dates[8].tm_mday = 15;
dates[9].tm_year = 106; dates[9].tm_mon = 10; dates[9].tm_mday = 1;
xirr = imsl_f_internal_rate_schedule (10, values, dates, 0);
printf ("After approximately 9 years, the internal\n");
printf ("rate of return on the cows is %.2f%%.\n", xirr * 100.);
}
Output
After approximately 9 years, the internal
rate of return on the cows is 7.69%.