These programs deal with the net present value of cash flows. One program simply calculates the net present value of a cash flow at a specified discount rate. One program graphs the net present value of a cash flow for a range of discount rates. And one program finds the internal rate of return — the discount rate at which the net present value is zero — of a cash flow.
A cash flow is a series of payments and receipts. Payments are generally regarded as negative, receipts as positive. Any potential or actual financial event may be regarded as a cash flow.
A discount rate is an interest rate used to determine the present value of a future payment or receipt. The discount rate generally represents the minimum return on investment required for potential investments. Equivalently, the discount rate may be regarded as the actual return on investment that would accrue from known investment alternatives.
If r is the discount rate, and {cj} is a set of cash flows at the end of period j = 0, 1, ..., n, then the present value Vp is given by the equation:
This may be regarded as a function of the discount rate r. The internal rate of return, or IRR, of the cash flows {cj} is the rate r at which the present value of the cash flow is zero. For simple annuity streams (a single payment followed by a series of receipts), this is the highest discount rate for which the investment is profitable. The implication of this is that the investment being investigated is more attractive than alternative investments, when those alternative investments have returns less than the IRR of the investment being investigated. Alternatively, the investment being investigated is less attractive than alternative investments having returns greater than the IRR.
For simple payment streams (a single receipt followed by a series of payments), the internal rate of return is the lowest discount rate for which the investment is profitable. The implication of this is that the investment being investigated is less attractive than alternative investments, where those alternative investments have returns less than the IRR. Alternatively, the investment being investigated is more attractive than alternatives with returns greater than this investments’s IRR.
Record the cash flow to be analyzed in List 1. Put the cash flow now in element 1; put the cash flow after one period in element 2; put the cash flow after two periods in element 3; and so forth.
If you are graphing the net present value of the cash flow based on discount rate, set the graphics view window to display the area of the graph of interest. The X value is the discount rate in percent per period. The Y value is the net present value in whatever currency units are in use.
Run the program of interest. The three programs intended for direct use are NPV, IRR, and NPVGRAPH.
Program NPV computes the net present value of the cash flow in List 1 for a specified discount rate. It prompts you with the line:
Rate?
Enter the discount rate, in percent, and press EXE. The program then displays the net present value of the cash flow in List 1 for the specified discount rate.
Program NPVGRAPH displays the graph of the present value of the cash
flow in List 1 based on discount rate.
A sample of such a graph is shown to the right.
This program does not require any user interaction.
The graph produced has axis limits and increments based on the graph
view window.
Prior to using using NPVGRAPH, it is recommended that the NPV program be used to investigate several values in the range of discount rates of interest to ensure the graph view window is set correctly.
Program IRR finds a discount rate for which the net present value of the cash flow in List 1 is zero. It prompts you with the line:
Initial guess?
Enter a discount rate in the neighborhood of a discount rate where the net present value is zero. The program then uses Newton’s method to compute the internal rate of return, and displays the rate found.
Prior to using IRR, it is recommended that the NPVGRAPH program be
used to ensure an appropriate starting value is chosen, and to see
whether the concept of IRR is even appropriate to the cash flow.
It becomes questionable whether the concept of an “internal
rate of return” is even meaningful when the graph of the
present value contains multiple zeroes, as it can for complicated
cash flows.
The graph at right shows the present value function for a particular
cash flow: note the multiple zero crossings.
IRR would find one of the many zeroes, depending on the starting
discount rate chosen.
For the particular cash flow shown, zeroes are at 0.144, 3.615, 7.343,
11.129, and 14.748 percent.
Whether IRR even finds a zero of the present value function, and if so
which zero is found, depends strongly on the initial estimate.
A starting value near a zero of the net present value function should
be chosen.
A starting value near a local maximum or minimum of the net present
value function should be avoided.
As a special bonus to those of you who have teachers who insist multiple zero crossings in the present value function are impossible, the program CFLDESIN (Cash Flow Design) lets you design a cash flow corresponding to an arbitrary set of present values. The program asks you for a set of rates, and for the present values at those rates. The program computes cash flows yielding the specified present values at the specified rates and places these flows in List 1. The present value function of any cash flow regarded as a function of the discount rate is continuous, so a change in sign from one discount rate to the next implies a zero crossing in the net value function.
Program PV (subroutine used to compute present values):
Resource |
Description |
Memory |
56 bytes total program memory used. |
A |
[Input argument.] The discount rate in percent for which the present value is to be calculated. |
B |
Period index. |
Ans |
The present value of the cash flow for the discount rate in A. |
Program DPV (subroutine used to compute derivative of present value function; used only for IRR):
Resource |
Description |
Memory |
61 bytes total program memory used. |
A |
[Input argument.] The discount rate in percent for which the derivative of the present value is to be calculated. |
B |
Period index. |
Ans |
The derivative of the present value of the cash flow for the discount rate in A. |
Program NPV:
Resource |
Description |
Memory |
50 bytes total program memory used. Also requires program PV (56 bytes). |
A |
The discount rate in percent for which the present value is to be calculated. |
Program NPVGRAPH:
Resource |
Description |
Memory |
81 bytes total program memory used. Also requires program PV (56 bytes). |
A |
The discount rate in percent for which the present value is to be calculated. |
B |
Net present value for discount rate. [Also used by PV subroutine.] |
C |
Discount range index. |
Program IRR:
Resource |
Description |
Memory |
90 bytes total program memory used. Also requires program PV (56 bytes) and program DPV (61 bytes). |
A |
The current discount rate estimate. |
B |
[Used by PV and DPV subroutines.] |
C |
The present value for the current discount rate estimate. |
D |
The derivative of the present value for the current discount rate estimate, and the adjustment to the current discount rate estimate. |
The programs are available as a text file with .CAT contents, or may be entered as shown below. A semicolon (“;”) marks the beginning of a comment, and is not to be entered into the calculator. Remember that these programs are copyrighted; see the copyright issues page for limitations on redistribution.
Program PV:
Sum Seq(List 1[B]/(1+A/100)^(B-1),B,1,Dim List 1,1) ; / is division operator; ^ is exponentiation operator
Program DPV:
Sum Seq((1-B)List 1[B]/(1+A/100)^B,B,2,Dim List 1,1)/100 ; / is division operator; ^ is exponentiation operator
Program NPV:
"Rate"?->A ; -> is assignment arrow Prog "PV" "Present value" Ans
Program NPVGRAPH:
Cls AxesOn 0->C ; -> is assignment arrow Lbl 0 Xmin+C(Xmax-Xmin)/31->A ; / is division operator Prog "PV" Ans->B Plot A,B C<>0=>Line ; <> is not equals comparison C+1->C C<=31=>Goto 0 ; <= is less than or equal comparison ; => is conditional jump
Program IRR:
"Initial guess"?->A ; -> is assignment arrow Lbl 0 Prog "PV" Ans->C Prog "DPV" Ans->D C/D->D ; / is division operator A-D->A Abs D>1EE(-)8=>Goto 0 ; EE is EXP key; (-) is change sign key; => ; is conditional jump "IRR" A
Special bonus program CFLDESIN:
"Cash flow design" "Number of points"?->A ; -> is assignment arrow Identity A->Mat A Seq(0,B,1,A,1)->List 1 List->Mat(List 1)->Mat B 1->B Lbl 0 "Rate number" B_?->C ; _ is display triangle 1->D Lbl 1 (1+C/100)^(1-D)->Mat A[B,D] ; ^ is exponentiation operator D+1->D D<=A=>Goto 1 ; <= is relational, => is conditional B+1->B B<=A=>Goto 0 1->B Lbl 2 "NPV at rate" B_?->Mat B[B,1] B+1->B B<=A=>Goto 2 Mat Ax^-1Mat B->Mat C ; x^-1 is x to the minus one key Mat->List(Mat C,1)->List 1 "Flow in List 1"
[ Previous page | Top of page | Next page ]
Copyright © 2001 Brian Hetrick
Page last updated 5 July 2001.