From: Don Phillips

Subject: FIN 4.2.1 B: Financial Applications for HP48GX

E-mail: phillipsm.ggd@gao.gov
        mrp100@erols.com

Date: June 1997



Introduction

This is the "broken" version of my financial programs for the
HP48GX for those with a HP48G calculator.  The individual
subdirectories are zipped up separately so that you may use only
those that you really need and have room for.

The FIN file loads as the directory FIN in your HOME directory
and installs the prgrams common to all the financial programs.
FIN must be installed for the other programs to work properly.  
The 11 financial programs, or subdirectories, should be loaded,
as needed, in the FIN1 subdirectory.  The 11 programs are EQV,
TVM, capital budgeting (IRR, NPV, NUS, NFV), generalized IRR and
NPV calculations, bonds, stocks, depreciation, options, inflation
adjustments, simple interest, and discounted securities using the
GDP or CPI indexes.  Install FIN and the other programs using
HP48 Link or another communication program in binary mode.  The
directory and subdirectories are automatically created.  Even if
you have the old FIN1 directory, the new FIN directory must be
loaded as some of the padding routines used for the new EQV
subdirectory have been modified.

I  have created a custom set of menus for each subdirectory. 
They are accessed by pressing GO->, the first soft menu key in
each subdirectory.  For the bond programs I relied heavily on two
sources.  I adopted the code for the Universal Bond Solver that
Tony Hutchins developed for the HP LX Palmtops to the HP48G(X),
and I used the program interface techniques of Chris Tham from
his Bond Pricing Application.  For the IRR and NPV routines I
adopted the techniques of Manoj Kasichainula and use the HP
built-in functions of PROOT and PEVAL.  Because of this, the IRR
routine needs no initial guess and will now compute all real
roots of a cash flow series that are greater than -100%.

The programs are provided as FREEWARE and as is.  If you like
them and use them, please send me an email.  That way I'll know
that they are actually useful to people and strive to improve
them.  Also, I would love to hear about your most difficult
financial problems that you have either solved or could not solve
using FIN.  If I get enough, I'll put them on the WEB.

The code is in UserRPL and some (very little) SysRPL.   If you
find any errors, bugs, or whatever, please let me know so that I
can fix them.  I hope you find them useful.  I assume that you
are already familiar with the appropriate financial concepts and
the operation of the HP48G(X).  For instance, all the programs
use the cash flow sign convention; i.e., cash inflows are
positive and cash outflows are negative.  I developed the
routines for the MBA program I am taking.

NOTE: Two routines, IRR in the CAPB subdirectory and DISM in the
GNPV directory use HP48G(X)commands that are named the same as
commands on the MATHLIB ROM card.  Since the ROM card commands
are processed before the HP48G(X)commands, the MATHLIB library
should be detached before the file is loaded onto the HP48G(X). 


What's New

FIN 4.2.1 fixes a small programing error in the new EQV
subdirectory and extends the capabiltiy of the EQV routines. 
Besides computing the equation of value, it can now be used to
solve arbitrary cash flow problems, i.e., problems in which,
given an interest rate, the positive and negative cash flows sum
to zero at any point in time.

FIN 4.2.0 adds a new subdirectory, EQV, for computing the
equation of value.  The equation of value allows one to commute
one arbitrary set of obligations (payments and/or receipts) into
a second set of arbitrary obligations (either payments or
receipts).  For example, an interest free debt of $1,000.00 is
due in two years and a 15-year debt of $1,500 is due in ten years
at 7% interest compounded annually.  The two debts are to be
replaced with three equal payments beginning in 5 years.  If the
current rate of interest is 9% compounded quarterly, what is the
value of the three payments?  Answer: $1,438.38.

FIN 4.1.0 incorporates some SysRPL routines in writing the
displays and printing the output; the result is that the screens
are displayed much faster.  In a few places I've added choose
boxes to replace the toggle routines.  In the inflation
subdirectory the choose box for selecting an index will include
any index you want to add.  The format for entering your own
inflation indexes is detailed below.  Most routines print out a
date and time stamp; I've added the ability to print out a name
(up to 24 characters, including spaces) also.  Simply enter a
string with the name on the stack and press NAME which occurs
right after the DSEC subdirectory key;  The date and time stamp
as well as you name will now be printed.  The settlement and
maturity dates in the bond screen now use the HP48's time string
(TSTR) function and now display the day of the week as well as
the date.  Finally, in the capital budgeting subdirectory
(CAPB)and GNPV subdirectory, when computing NPV, NUS, or NFV, the
interest rate must first be entered by pressing %I; it can no
longer just be put on the stack.  I've done this so that previous
calculations may remain on the stack.

FIN 4.0.1 corrects a small error in computing the depreciation
tax shield in the CAPBG subdirectory.  If an asset is sold before
its depreciable life is over, IRS allows only a half year
depreciation, for tax purposes, in the year the asset is sold. 
The routine now takes this into account.  In addition, it now
computes the remaining depreciable balance, which can be used in
calculating the tax effect of any capital gain or loss on sale of
the asset.

FIN 4.0.1 also has a small change in the amortization schedule
program in the ->TVM subdirectory to take into account the odd
number of periods in the first year.

FIN 4.0.0 adds two new subdirectories, one for discounted
securities and one for simple interest calculations.  The one for
discounted securities uses the multiple equation solver.  FIN400
also adds print routines for the capital budgeting and
generalized NPV subdirectories.  This required a slight change in
the how cash flows are stored;  cash flows, which are entered on
the stack the same as before, are now stored using a separate
command, CFL->.  The IRR, NPV, etc., commands will no longer
store cash flows.  If the print flag, flag 1, is set, the cash
flows will be printed.  A toggle, PRF, is available in the CAPBG
and GNPV subdirectories for turning the print flag on or off.  I
use flag 1 because it is displayed at the top of the screen if it
is on; thus you can readily tell if print mode is set.  Choosing
a bond type is now easier; you do not have to remember what
number to enter for what bond type.  The  new TYPE? command
simply rotates through the three types of bonds used.  Finally, a
lot of redundant coding has been eliminated (which is not to say
that some still does not exit).

FIN 4.0.0 also corrects a programming error (my fault) in the NFV
calculation for dated cash flows.  It would not work correctly if
the cash flows were not in chronological order; it does so now.

FIN 3.0.3 has many code changes that do not affect any of the
calculations from previous versions, but do allow the contents of
the stack to be preserved whether storing, calculating, or
printing.  In addition, all relevant values accessed through
custom menus, expect in the CAPB and GNPV subdirectories, can now
be recalled to the stack by pressing the right shift key and the
appropriate soft menu key.  I hope these are the final changes
for a while!

FIN 3.0.2 makes changes in the bond display and adds a clear
variable (CLV) option to the bond menu.  CLV sets dates and most 
values to zero, sets the coupon payment frequency to 2, sets the
redemption value/call value to 100, exdays to 0, but maintains
the current bond type.

FIN 3.0.1 makes the programming and operation of routines more
similar across subdirectories.  In addition, the amortization
function parameters in the ->TVM subdirectory are now reset to
their initial values whenever PV is calculated, as well as a new
PV value entered.  And the SCHED function now automatically
resets the amortization parameters before and after it prints
the amortization schedule.

FIN 3.0.0 adds a common look to all subdirectories (except the
IRR subdirectories); all variables used in the subdirectories are
now displayed on the screen simultaneously.  In addition, there
are new commands to clear all variables and to print the
variables in a manner similar to their screen appearance.  The
print command also prints out a date and time stamp for the
calculations.  FIN300 adds a subdirectory for computing put and
call option values using the Black-Scholes formulas.

FIN 3.0.0 adds a subdirectory for the HP48G(X) TVM functions,
displaying all values on the screen.  There are also commands to
clear the variables or print them.  It also provides for
amortizing a loan on screen by choosing the number of periods to
amortize, or to print out an entire amortization schedule with
you choosing the number of payments in each group to amortize.  

My amortization routines correct an error in the HP48G(X)'s
amortization function.  If the payment mode is set to BEGIN, the
HP48G(X) will compute the principal, interest, and balance
correctly for the first group of payments, but not for subsequent
groups.  The reason is that for subsequent groups of payments, it
again assumes it is at the beginning of the loan where there is
no interest associated with the first payment.

FIN 2.0.0 added the ability to compute the IRR, NPV, NUS, and NFV
of dated cash flows and the present value of the depreciation
shield using the IRS half-year convention for 3, 5, 7, 10, 15,
and 20-year lives.  The first is useful when your varying cash
flows are not periodic and the second is useful in capital
budgeting problems.

FIN 2.0.0 also added a new method of computing VNUS, i.e., the
net uniform series with variable interest rates.  The current
method uses the effective interest rate over the period to
compute VNUS.

The new method computes the uniform payment that when discounted
by the variable interest rate series will yield the VNPV.
However, there is no one effective interest rate for this method
that will give both the VNPV and VNFV.


Minor adjustments included the ability to recompute or compute
the NPV, NUS, and NFV at the current interest rate without having
to put the rate on the stack first. Also, the growth rate of
stock dividends during supernormal periods may now equal the
discount rate without giving an error message and stopping the
computation.  This was done by changing the routines for USPV and
USFV in the main FIN directory.  Other minor changes were also
been made.



Finance Directory (FIN)

This is the main directory.  From it you can access the 11
subdirectories: (1) EQV (Equation of Value).  (2) ->TVM (Time
Value of Money).  (3) CAPB (Capital Budgeting): This used to be
the old NPV subdirectory.  (4) GNPV (Generalized NPV): This is
the new subdirectory for dated cash flows.  (5) BOND (U.S.
Treasury, U.S. Agency, and Municipal bonds).  (6) STCK (Stocks). 
(6) DEP (Depreciation).  (8) OPTS (Black-Scholes call and put
routines).  (9) $INF (Inflation adjustments).  (10) SIMP (Simple
Interest).  (11) DSEC (Discounted Securities).

The FIN directory also has three routines for interest rate
conversion.  They can be used from any subdirectory.  They are:

CC->  Converts from a continuous compounding rate to an annual
percentage rate.  Enter the continuous rate on the stack, then
the number of compounding periods per year, and press (or enter)
CC->.  Output is I%YR.

Example: 10.00 continuous annual rate (ENTER)
         12 periods per year (ENTER)
         Press CC->
         Output: 10.0417826489 compounded monthly

->CC  Converts from an annual percentage rate to a continuous
rate. Enter I%YR, the number of compounding periods, and press
(or enter in alpha mode) ->CC

Example: 10.0417826489 compounded monthly
         12 periods per year (ENTER)
         Press ->CC
         Output: 9.99999999997 compounded continuously

CI  (Convert Interest Rate)  Converts I%YR from one number of
compounding periods per year to another.  Enter I%YR, current
number of compounding periods, and then the number of periods you
want to convert to.  Press (or ENTER) CI.

Example 1: Convert 10 percent compounded monthly to I%YR
compounded quarterly.

         10 ENTER
         12 ENTER
          4 ENTER
Press or ENTER CI
Output:  10.083564812

Example 2: Convert 8 percent compounded semi-annually to I%YR
compounded monthly.

          8 ENTER
          2 ENTER
         12 ENTER
Press or ENTER CI
Output:  7.869836328

The FIN directory also has a program called NAME occurring right
after the DSEC subdirectory.  If you want your name printed out
with the print routines, enter it as a string ("Your Name") and
press NAME.

(1) Equation of Value (EQV)

Press GO-> to enter the custom menu and display.

The first set of six menu keys is for entering the data and
interest rate and solving the equation of value.  The next two
menu keys (accessed by pressing NXT) are for displaying and
printing the results and for setting the print flag.

The equation of value is useful for replacing one set of
obligations with another, more convenient set of obligations.  

For instance, a person owes on a $5,000 non-interest bearing note
that is two years past due; a $5,000 five year note bearing
interest at 6% per year compounded semi-annually and due in two
years; and a $10,000 ten-year note bearing interest at 7%
compounded annually and due in nine years.  These debts are to be
replaced with 8 equal payments, the first one to be made in three
years.  If the going rate of interest is 5% compounded annually,
what is the value of the payments?

To use this program the original obligations and replacement
obligations are entered as two separate lists, the original set
being entered first.

It is almost impossible to solve this problem without making a
time line showing the two sets of obligations.  If the present is
designated 0, then the obligations range from -2 to 10 years.  My
program, however, begins all problems at time 0; therefore, the
above problem can be shifted from time 0 to time 12; all payments
are simply shifted forward two years.  This shifting forwards or
backwards can be done with any problem.

The time line will look something like this:

Time      Original Value      Replacement Value
-2 0         -5,000                   0
-1 1              0                   0
 0 2              0                   0
 1 3              0                   0
 2 4     -5,000*1.03^10               0
 3 5              0                   X
 4 6              0                   X
 5 7              0                   X
 6 8              0                   X
 7 9              0                   X
 8 10             0                   X
 9 11    -10,000*1.07^10              X
10 12                                 X

All values, from time 0, must be entered for each set of
obligations.  To enter the original set of obligations:

Enter -5,000 on the stack (the value is negative because it is a
debt to be paid).

Next, enter 0 and 3 on the stack and press GRP to enter a group
of three zeros.

Next, enter '-5000*1.03^10' on the stack.

Next, enter 0 and 6 on the stack and press GRP to enter a group
of six zeros.

Next, enter '-10000*1.07^10' on the stack.

Press CFL-> to enter the set of obligations.

To enter the replacement values:

Enter 0 and 5 on the stack and press GRP to enter a group of 5
zeros.

Next, enter 'X' and 8 on the stack and press GRP to enter a group
of 8 'X's.  (The unknown value used by the program is a capital
X.)

Press LS (left-shift) CFL-> to enter the second set of
obligations.

Enter 5 and press I%PR (interest rate per period).

Then press SOLVE.  The answer X: -4143.03 will be displayed.

If you have a HP calculator printer and want to print out the
problem and answer, the print flag must be set.  PRF on the
second set of menus is a print toggle.  It sets and clears flag 1
which is displayed at the top of the calculator.  If flag 1 is
set, the problem will be printed out.

CADD and CPCT are for entering more complicated types of
obligations.  For instance, CADD will add a constant amount
(positive or negative) to subsequent obligations.  CPCT will
increase (decrease) subsequent obligations by a given percent,
positive or (negative).  For example, suppose the replacement
obligations were to increase by 10% a year.

First, enter 0 and 5 on the stack and press GRP to enter the
group of five zeros.  Then enter 'X', 10, and 8 on the stack and
press CPCT.  A group of eight algebraics will be entered on the
stack beginning with 'X' and ending with '1.95*X'.  Press LS
CFL-> to enter the set of obligations.

NOTE: The values of 'X' that can be entered must be either
additive, e.g., 'X+100', or multiplicative, e.g., '1.2*X'.  You
may not enter any powers of 'X' or other functions of 'X'.

Press SOLVE and see displayed X: -2969.54.  The first of eight
payments is -$2,969.54.  So you won't have to calculate all the
other values, press DISP in the second set of menus.  The
replacement values, beginning at V5 (value 5 on our time line)
are displayed.  Press CONT to see the remaining values.  To print
out the calculated replacement values, press LS DISP.

If a new set of original values is entered, a new set of
replacement values MUST be entered, since entering a new set of
original values wipes out the existing replacement values. 
However, new replacement values can be entered at will as long as
the original values remain unchanged.

If the original and replacement obligations DO NOT overlap, they
may be entered as one set of obligations by entering all original
and replacement values on the stack, in order of course, and
pressing CFL->.  Continue as before to solve, display, and print
the problem.

Pressing RS (right-shift) CFL-> will recall the two sets of
obligations to the stack as two lists.  Pressing LS I%PR will
recall the interest rate.

The routines in EQV can also be used to solve arbitrary cash flow
problems in which the cash flows are not be replaced with another
set of cash flows, but the positive and negative cash flows, at a
given interest rate, sum to zero at any point in time.  To solve
cash flow problems, simply press LS (left-shift) SOLVE instead of
SOLVE.

For instance, you lease a machine for 12 months with a present
value of $10,000.   You are required to make 3 payments in
advance (at time 0) and the other nine payments monthly.  With an
interest rate of 12% compounded monthly, what are the payments?

First, enter the present value, $10,000, on the stack and press
CFL->.  Then enter '3*X' on the stack for the 3 advance payments.
The enter 'X' and 9 and press GRP to enter the other nine
payments and press LS CFL-> to store them.  Enter 1% and press
I%PR.  Press LS SOLVE.  The answer is X: -864.60.  The answer is
negative since this is a payment that must be made.

Press NXT and DISP to see displayed the value of the payments
that must be made.  VO's payment is -2593.81 since three payments
are made in advance.  The other 9 payments are -864.60.  To
print out the calculated payments, press LS DISP.  As above, if
none of the known and unknown values overlap, they may be entered
as one set of cash flows by simply pressing CFL->. 

(2) Time Value of Money (TVM)

Press GO-> to enter the custom menu and display.

The first 5 variables are the HP48G(X) regular financial
functions.  Enter the data and press the variable to store the
value.  Press LS (left shift) and the variable to compute the
value.

Press PRV to print the current TVM variables and settings as they
appear on the screen.  The print function first prints a date
and time stamp and your name, if entered, before printing the
variables.

Press NXT for the next set of six functions.

P/YR is for entering the number of payments per year.

B/E is a toggle that switches between END and BEGIN modes.

CLV resets the financial variables to zero, sets P/YR to 12, and
sets the END mode.

AMOR accepts the number of payments to amortize (or uses the
default number which is the number of periods per year) and then
displays the payment group, principal, interest, and balance. 
You may continue amortizing subsequent groups of the same number
by pressing AMOR again or groups of different sizes by entering
the new number in the group and pressing AMOR.  You may press
RESET at any time to set the loan to its initial state.  SCHED
accepts the number of payments in the first year and the number
of payments in a group in subsequent years to amortize and then
prints out an amortization schedule, including the initial values
of the TVM variables.  (There are no default values for SCHED, so
the 2 values must be entered.  If you want the same number of
payments for the first and subsequent years, just enter the same
number twice.)  Do not worry if the number of payments left to
amortize at the end is different from the number in the group;
the routine will handle this correctly.  SCHED automatically
RESETs the initial values before and after printing the schedule.

Also, every time a new PV is entered or calculated, the
amortization parameters are RESET.

Three subroutines, not included in the menu, have been added to
the subdirectory.  They are T, TS, and TSU.  T accepts a tax
rate (in percent form), computes the after-tax cash flows of a
loan by subtracting the appropriate amount of tax from the
interest in each period, and places the list of cash flows in the
CAPBG subdirectory in the appropriate variable for computing NPV,
etc.  The NPV, etc., of the after-tax cash flows can then be
calculated.

TS (tax savings or payments) also accepts a tax rate, computes
the amount of tax on the interest in each period, and then places
the list of tax cash flows in the CAPBG subdirectory.  TS assumes
the interest rate used to calculate the payment was a before-tax
interest rate.

TSU (tax savings, or payments, grossed up) also accepts a tax
rate, computes the amount of tax on the interest in each period,
and then places the list of tax cash flows in the CAPBG
subdirectory.  TSU assumes the interest rate used to calculate
the payment was an after-tax interest rate.  The interest portion
of the payment is grossed up before the tax is computed.  

To run T, TS, or TSU, simply put the tax rate on the stack, enter
T, TS, or TSU (in alpha mode) in the command line and press
enter.


(3) Capital Budgeting (CAPBG)

Press GO-> to enter the custom menu.  The first set of menus is
for periodic cash flows with a single interest rate.  The last
command on the third screen of menus is GOV->; this will take you
to a set of menus for periodic cash flows with variable interest
rates.

The first set of 6 menu keys (IRR, NPV, NUS, NFV, I%PR, GET) are
for computing the internal rate of return, net present value, net
uniform series, and net future value of a series of periodic cash
flows.  %I stores or returns to the stack the current interest
rate.  The GET command is used to select an interest rate from
the list of interest rates calculated by IRR.

The NXT set of 6 menu keys (GRP, CADD, CPCT, N->R, R->N, CFL->)
are for entering groups of cash flows, cash flows that vary by a
constant amount or percentage, for converting nominal cash flows
to real cash flows and vice versa, and for storing the cash
flows.

For your regular periodic cash flows, the cash flows are entered
on the stack, one after the other, beginning with the initial
investment or cash flow at time 0.  If the initial investment is
0, then enter a 0, as this cash flow must be present for the
programs to work correctly.  Cash outflows are entered as
negative numbers, including the initial investment if it is
negative, and cash inflows as positive numbers.

GRP - If a group of cash flows are the same, enter the value on
the stack, enter the number of cash flows in the group, then
press GRP.

CADD - If you have a series of cash flows that increase or
decrease by a constant amount each period, enter the beginning
amount, enter the constant increase or decrease (negative), enter
the number of cash flows (including the beginning amount), and
then press CADD.

For example: 1000
             -100
                3
     Press   CADD
    Output:  1000
              900
              800

CPCT - If you have a series of cash flows that increase or
decrease by a constant percent each period, enter the beginning
amount, enter the constant percent increase or decrease
(negative), enter the number of cash flows (including the
beginning amount), and then press CPCT.

For example: 1000
              -10
                3
     Press   CPCT
    Output:  1000
              900
              810

N->R - Covert nominal cash flows to real cash flows.  Once the
cash flow series is stored with CFL->, enter the expected
percentage rate of inflation over the period and press N->R.  If
the print flag is set, the converted cash flow series will be
printed.

R->N - Convert real cash flows to nominal cash flows.  Once the
entire cash flow series is stored with CFL->, enter the expected
percentage rate of inflation over the period and press R->N.  If
the print flag is set, the converted cash flow series will be
printed.

CFL-> - Stores the cash flow series that has been entered on the
stack.  If the print flag is set, the cash flow series will be
printed.

NOTE:  If using nominal cash flows, use nominal interest rates in
all calculations.  If using real cash flows, use real interest
rates in all calculations.

Once the cash flows are stored, all real internal rates of return
(IRR) greater than -100.00 percent are calculated by hitting the
IRR key.  Net present value (NPV), net uniform series (NUS), or
net future value (NFV), may be calculated using the stored cash
flows by entering the periodic interest rate and pressing %I and
then pressing the appropriate key.  If the print flag is set, the
answer will be printed out.  For example: 

               NPV @ 8.9876677% = 
                                   1728.83

Example: Cash flows: 0: -1,000  1: 3,700  2: -4,540  3: 1,848

Enter cash flows onto to the stack in order.  Press CFL-> to
store the cash flows.  Then press IRR to compute the real
internal rates of return: 10%, 20%, and 40%.  They are returned
in a list.  If you want to extract one of the answers for use in
subsequent calculations, enter its position in the list and press
the GET command provided in the custom menu.  It may be stored by
pressing I%PR.

At an interest rate of 5 percent, the net present value (NPV) is
2.26757369614.  Simply enter 5, press I%PR, and then press NPV. 
The stack does not have to be clear before the 5 is entered; thus
other answers may be left on the stack. NPV, NUS, and NFV use the
stored the interest rate.

The last 6 menu keys are DTXSH, DEP, SigmaCF, PRCF, PRF, and 
GOV->.  DTXSH and DEP are used to calculate the present value of
the depreciation tax shield or the annual depreciation amounts
using the IRS half-year convention for 3, 5, 7, 10, 15, or 20
year lives.

DTXSH computes the present value of the depreciation tax shield. 
It take 5 values from the stack and returns the present value of
the depreciation tax shield and the remaining depreciable value. 
The 5 values are: cost, life, interest rate (percent), tax rate
(percent), and number of years depreciation wanted.  Asset lives
are limited to 3, 5, 7, 10, 15, or 20 years; however, since the
routine uses the IRS half-year convention for the first and last
year's depreciation, the number of years depreciation can be
taken is life plus 1.

FIN410 in calculating the tax shield for assets sold or disposed
of before their life is over allows only a half-year of
depreciation in the year the asset is sold.  The remaining
depreciable amount can then be used to calculate the tax effect
of the capital gain or loss on sale.

Example: Cost: 10,000
         Life:     10
         %I:        8
         %Tax:     28
         N:        11
   Press: DTXSH
   Output:       RDep: 0
                 Tax Shield: 1,976.58504565

If the print flag is set, DTXSH will print out the variables, the
remaining depreciable amount, and the present value of the tax
shield.

DEP computes the annual depreciation given the cost and life of
the asset.

Example: Cost: 10,000
         Life:     10
   Press: DEP
   Output: {1,000.00 1,800.00 1,440.00 1,152.00 922.00 737.00
655.00 655.00 655.00 655.00 328.00}

If the print flag is set, DEP will print out the depreciation
amounts.

Note that there are 11 years of depreciation; the first and last
are half-year amounts.

SigmaCF sum the cash flows and places the amount on the stack.

PRCF will print the cash flows at any time.

PRF toggles the print flag on and off.

GOV-> - Sets up the menus for cash flows with variable interest
rates.

The first set of menu keys (VNPV, VNUS, VNFV, EI%PR, and USVR)
are used for calculations with periodic cash flows and variable
interest rates.  The second set of menu keys are the same as
above; they are used for entering and storing the cash flows and
for converting real to nominal or vice versa.

Some NPV calculations not only have variable cash flows, they
also have variable interest rates.  For instance, a savings
program may guarantee a beginning interest for a number of years,
after which it declines or is tied to some interest rate index. 
VPNV, VNUS, and VNFV are designed to handle such problems.

IMPORTANT NOTE:  As with regular NPV calculations, there is an
initial cash flow at time 0 (zero) and a series of cash flows at
times 1 to N.  (If you want a future value for a time after the
cash flows end, you must enter an appropriate number of zeros at
the end of the cash flows.)  HOWEVER, while cash flows occur at
points in time, interest rates represent earnings from one time
period to the next.  THEREFORE, the number of varying interest
rates entered MUST be ONE LESS than the number of cash flows. 
Thus, the first interest rate entered represents the interest
earned from period 0 (zero) to period 1 or the discount from
period 1 to period 0 (zero).  The Nth interest rate represents
the interest earned from period N-1 to period N or the discount
from period N to period N-1.

VNPV - Calculates NPV with variable interest rates.  The cash
flows are entered first on the stack and then the interest rates
are entered on the stack.  They are then saved with CFL->.  The
menu keys GRP, CADD, and CPCT may be used for entering the cash
flows and interest rates.

Example: Initial cash flow = 0
         9 cash flows of 12,000
         1 cash flow of 8,000
         10 cash flows of 5,500

         10 percent interest rate for 10 periods
          7 percent interest rate for 5 periods
          9 percent interest rate for 5 periods

Press: CFL-> to save the cash flows and interest rates.
Press: VNPV to compute the net present value.
Output: 86,767.7328562

If the print flag is set when CFL-> is pressed, the cash flows
and interest rates will be printed.  If the print flag is set
when VNPV, etc., is pressed, the answer will also be printed out.

Press VNUS for variable net uniform series (the stack does not
have to be cleared).
Output:
9,500.41016497

Note: The uniform series computed with VNUS uses the equivalent
interest rate, not the series of variable interest rates.  The
method below (USVR), however, does use the variable interest rate
series.

Press VNFV to calculate the net future value. 
Output: 485,664.634329

EI%PR computes the equivalent interest rate per period of the
variable interest rates stored in %IV.  Press EI%PR.  Output:
8.993076522

The outputs of VNUS and EI%PR allows you to convert a variable
cash flow, variable interest rate problem into an ordinary
annuity problem.

USVR computes the net uniform series or payment using the
variable interest rate series.  That is, the uniform payment when
discounted by the variable rate series equals the VNPV of the
series.

Press USVR.

Output:
9866.04014657

The third set of six menus has three commands, PRCF, PRF, and 
GO->.  PRCF will print the cash flows and interest rates at any
time; PRF toggles the print flag on and off; GO-> takes you back
to the standard IRR and NPV menu.



(4) Generalized Net Present Value (GNPV)

Press GO-> to use the custom menus.  This set of routines allows
you to calculate IRR, NPV, NUS, and NFV of dated cash flows. 
Instead of being restricted to variable cash flows of a periodic
nature, you may assign a date, any date, to a particular cash
flow.  This will enable you to correctly value such things as
savings plans, portfolios, etc., where inflows and outflows are
on an irregular basis.  An added bonus of this set of routines is
that the cash flows DO NOT have to be entered in chronological
order.

The routines compute the actual number of days between the first
cash flow in the series and all subsequent cash flows using the
built in date functions.  The first thing you have to decide is
the BASIS, that is, how may days will be in your period.  If your
cash flows cover a couple of years in which there is no leap year
and you want an annual return, use 365.  If your cash flows cover
many years, you may want to use 365.25.  Or, if you are looking
at a portfolio's performance over a month or two, you may want to
compute a daily rate of return; if so, then enter 1 as your
BASIS.  Whatever your basis is, enter the number of days, and
press the BASIS soft key.

Cash flows are entered in the following manner.  First enter the
date (in whatever date format you HP48G(X)is set up for); then
enter the amount of the cash flow, positive for inflows and
negative for outflows.  (If you are computing an IRR, there must
be at least one sign change in the cash flows.)  The second and
third set of menu keys are used to enter the cash flows.  As with
the CAPBG subdirectory, once the cash flows are on the stack,
press CFL-> to enter them.  CFL-> is in the third set of menus.

Once the dated cash flows are stored, enter the interest
rate, as a percentage, by pressing I%PR and then press IRR, NPV,
NUS, or NFV, depending on what you want.  In computing the IRR,
the interest rate entered will function as an initial guess for
Newton's Method. If more than one calculation is wanted for a
given cash flow series, the cash flows do not have to be
reentered.  Simply press the appropriate key.

Example: Use a BASIS of 365.  Enter the following on the stack:

3.311996
-31,172
4.111996
-111
4.251996
-125
5.091996
-100
5.231996
-150
6.061996
-135
6.201996
-120
6.301996
33,215
Press CFL-> to enter the cash flows.
Enter 10 and press %I (initial guess for IRR).

Press IRR: 
Output: IRR: 17.6237983845

If the print flag is set, IRR, etc., will be printed.

Enter 10, press I%PR, and then press NPV:  Output: NPV:
531.0992814

Press NFV:  Output: NFV: 543.870538805

Press NUS: Output:  No Uniform Periods.

Since the basis is 365 days a year, the 3 months encompassed in
the cash flows do not constitute a full period.  If the basis
is made 14 days, i.e., 26 periods a year, the new IRR is
.6245440425 per period (with an initial guess of 10/26).  At an
interest rate of 10/26, the output when NUS is pressed is:

TERM: 6.5 (periods)
#PERS:  6 (6 full periods in term)
NUS:  83.2731799686

The next set of six menu keys (GRP, CADD, CPCT, DAY, MON, YEAR)
are for entering cash flows that occur periodically, every so
many days, months, or years.

GRP - Use if a group of cash flows are the same and occur
periodically.  Enter the initial date.  Enter the number of days,
months, or years in the period and press the respective DAY, MON,
or YEAR key.  Enter the cash flow amount.  Enter the number of
cash flows, including the initial cash flow, and press GRP.

Example:
Enter: 7.201996
       14
Press: DAY  Output: 14_DY
Enter: 100
Enter: 3
Press: GRP
Output: 7.201996
        100
        8.031996
        100
        8.171996
        100

Note: The number of months may be any number, 6, 12, 17, 26, etc.

However, the manner in which the routine increments months and
years is simple.  This means that it cannot handle end of the
month dates; for example if you use 1.311996 as your beginning
date and increment monthly, the routine will put in 2.311996 as
the next date.  This will cause a date error when the number of
days between dates is computed in the routines.

CADD - Use this routine when your cash flows are increasing or
decreasing (-) by a constant amount each period.

Example:
Enter: 7.201996
       14
Press: DAY  Output: 14_DY
Enter: 100 (initial cash flow)
        10 (periodic increment)
         3 (number of cash flows)
Press: CADD
Output: 7.201996
        100
        8.031996
        110
        8.171996
        120

CPCT - Use this routine when your cash flows increase or decrease
(-) by a constant percentage each period.

Example: 
Enter: 7.201996
       2
Press: MON  Output: 2_MN
Enter: 100 (initial cash flow)
       -10 (percentage decrease each period)
         3 (number of periods)
Press: CPCT
Output: 7.201006
        100
        9.201996
        90
        11.201996
        81

Once the dated cash flows are on the stack, press NXT to go to
the third set of menus and press CFL-> to enter the cash flows. 
If the print flag is set when CFL-> is pressed, the dated cash
flows will be printed in the order they were entered, i.e., they
will not be sorted by date (I don't know how to sort the rows of
a matrix based on the values in one column).

The other commands here are familiar.  PRCF will print the cash
flows; PRF toggles the print flag on and off.  SigmaCF sums the
cash flows and put the value on the stack.

(5) Bond Calculations (BOND)

Bond calculations may be made for U.S. Treasury, U.S. Agency,
municipal, or corporate bonds.  Enter the bond directory and
press GO-> to display the custom menu and screen.  The type of
bond calculation, settlement date, maturity date, coupon, call
(redemption) value, yield, and price of the prior input is
displayed along with the soft menu keys.  The values for coupon,
call value, yield, or price may be calculated given the other
five values.  Data is entered by putting the values on the stack
and pressing the corresponding menu key.  Dates _must be_ entered
in the MM.DDYYYY format, coupon and yield as percents, and call
value and price as percent of face value, e.g., a $1,000 call
value or price would be entered as 100.

Values are calculated by first pressing the left shift key and
then the appropriate soft menu key.  Values are recalled to the
stack by pressing the right shift key and the appropriate soft
menu key.

Three other pieces of data are needed to calculate bond values
correctly.  They are the number of coupon payments per year, the
type of calendar used, and the number of ex-dividends days. 
These variables are accessed by first pressing the NXT key.

CPF - coupon payment frequency (1, 2, 3, 4, 6, or 12 times per
year)  Use 2 for semi-annual bonds.

TYPE? - pressing TYPE? displays a choose box; select the type of
bond you are analyzing.

XDAYS - ex-dividend days, if bond is settled within the ex-
dividend period before the next coupon payment, the next coupon
is NOT valued.  Use 0 if you don't know this value for a
particular bond.

PRV prints out the current bond variables as they appear on the
screen, including the coupon payment frequency and the number of
XDAYS.

CLV sets the settlement day to the current date, RDV/Call to 100,
CPF to 2, XDAYS to 0, and the other values to 0.

Other values are calculated when you calculate one of the four
main bond values.  They are

ACCRU - accrued interest on the bond

TOT - total price of bond, i.e., price + accrued interest


DURN - duration of the bond, a weighted average time of the bond
less than or equal to the time in years from settlement to
maturity.  This is the normal, not modified, Macaulay Duration.

TERM - time, in years, from settlement to maturity

DeltaP01 - Change in price due to a change of 1 basis point in
the yield.  Calculated by averaging the changes in price from a
change in yield of plus and minus one basis point.

DeltaY32 - Change in yield due to a change in price of a 1/32nd. 
Calculated by averaging the changes in yield from a change in
price of a plus and minus 1/32nd.

LC - date of last coupon payment

NC - date of next coupon payment

A - days from last coupon to settlement

B - days from settlement to next coupon

C - days from last coupon to next coupon

These values may be displayed or calculated by pressing OTH-> to
display the menu keys; simply press they to display the needed
value.  Press GO-> to return to the main display and menus.


Example 1:

Press GO-> to go to the custom menu.  Press NXT to go to the
second set of soft menu keys.  Enter:

CPF = 2 (semi-annual bond)

Press TYPE? and select U.S. Treasury (A/A).
XDAYS = 0

Go back to the first set of soft menu keys and enter:

SDATE = 4.281982

MDAT = 6.041996

CPN% = 6.75

CALL = 100

YLD% = 8.25

Press left shift and then PRICE to calculate price: 87.622. 
Press right shift PRICE to see Price: 87.621799005 if in STD
mode.

Press NXT and then press OTH->.  Press:

ACCRU = 2.68887362638 (accrued interest from LC to SDATE)

TOT = 90.3106730269 (total price)

DURN = 8.6870162757

TERM = 14.1016483516 years

DeltaP01 = .07534506515

DeltaY32 = .00414758557

Press NXT and then press:

LC = 12.041981 (last coupon date)

NC = 6.041982 (next coupon date)

A = 145 (days from LC to SDATE)

B = 37 (days from SDATE to NC)

C = 182 (days from LC to NC)

Press GO-> to return to the main menu.



Example 2:

Change PRICE to 88.5 and calculate YLD%.

PRICE = 88.5

Press left shift YLD%: 8.134%

TOT = 91.1888736264

DURN = 8.716619408

DeltaP01 = .0763794489

DeltaY32 = .004091416085

The rest of the output remains the same.



Example 3:

Change SDATE to 3.011982

MDAT to 1.311996

With TYPE? at U.S. Treasury,  YLD% will be 8.14512811196

ACCRU = .540745856355

A = 29

B = 152

C = 181

With TYPE? at Muni (30/360), YLD% will change to 8.14541344545

ACCRU = .58125

A = 31

B = 150

C = 180

If TYPE? is set to U.S. Agency (30/360), YLD% will drop
slightly to 8.1428077108.



(6) Stock Price Calculations (STCK)

Press GO-> to set up the custom menu and display.  The stock
price formula will estimate stock prices based on expected annual
dividends.  The formula can handle an initial period of no
dividend payments and one or two periods of "super" normal growth
of dividends.  The variables are:

PRICE - price of stock

K - discount rate or expected return on stock

N0 - period, in years, of no dividend payments

DIV - last dividend paid, annual basis

G1 - "super" normal growth rate for first period (may be positive
or negative or zero)

N1 - expected years for G1

G2 - "super" normal growth rate for second period (may be
positive or negative or zero)

N2 - expected years for G2

GN - normal growth rate of stock that occurs after super normal
growth periods (may be positive or negative or
zero)

CLV - A program to clear the stock price variables and set them
to zero.

PRV - A routine to print the current stock variables in a manner
similar to that on the screen.

Any of the variables may be solved for given the others.

Note: The discount rate K cannot be less than or equal to the
normal growth rate GN otherwise the equation produces an infinite
result.  Also, if you expect a period of no dividend payments,
DIV cannot be the value of the next expected dividend.  The next
expected dividend must be discounted by the first growth rate
that is not zero, whether that is G1, G2, or GN.  If all growth
rates are zero, then the dividend stream is constant and DIV
equals the next expected dividend.

Examples: Set

DIV = 1.92

K = 9.00 percent

N0 = 0

G1, N1, G2, N2 = 0

For a declining firm set

GN = -4.00 percent

Calculate PRICE.  Hit left shift PRICE.  Price = 14.1784615385.

For a no-growth firm set

GN to 0.  Price = 21.3333333333.

For a normal growth firm set

GN to 4.00 percent.  Price = 39.936.

Supernormal growth firm (1 period of supernormal growth):

Change G1 to 20.00 percent and N1 to 10 years.

Price = 138.28733064.

Supernormal growth firm (2 periods of supernormal growth):

Change G2 to 10.00 percent and N2 to 5 years.  Price =
168.975331917.

Rate of return given price:

If the market price of the last example was 150, calculate the
rate of return K.

Set PRICE to 150.  Hit left shift K to calculate rate of return. 
K = 9.49981109907.

Note:  Sometimes solving for a variable may produce an extremum
rather than a root.  Be on the look out for this.  If it happens,
enter a guess for the variable and then solve for it.



(7) Deprecation Subdirectory (DEP)

Press GO-> to access the custom menu and display.  The
depreciation programs can solve straight-line, sum-of-the-years
digits, declining balance, and crossover problems for annual
depreciation.  The first set of variables are:

SBV - starting book value
SAL - salvage value
LIFE - useful life of asset
FCTR - declining balance factor enter as an integer, not a
percent, e.g., for double declining balance enter 2, not 200%
CLV - set above variables equal to zero

Data is entered by keying in the value and pressing the variable
key.  

The NXT set of menu keys is used to calculate depreciation and
crossover.  Key in the year for which you want to calculate
depreciation and press the appropriate key.

Y->SL - straight line depreciation
Y->SY - sum-of-the years digits depreciation
Y->DB - declining balance depreciation
CROS - computes last year for declining balance method, number of
remaining years for straight line depreciation, and remaining
book value at the end of the declining balance term.

Four values are calculated for each year.  Depreciation for
current year, total depreciation through current year, remaining
depreciable value, and remaining book value.

Example: SBV = $375,000  SAL = $30,000  LIFE = 40 years  FCTR =
1.5

Straight Line Method:  Year = 15 Dep = $8,625.00  Tot Dep =
$129,375.00  RDV = $215,625.00  RBV = $245,625

Sum Of The Years' Digits Method:  Year = 15  Dep = $10,939.02
Tot Dep = $208,262.20  RDV = $136,737.80  RBV = $166,737.80

Declining Balance Method:  Year = 15  Dep = 8,235.18  Tot Dep =
$163,630.49  RDV = $181,369.51  RBV = $211,369.51

Crossover From Declining Balance to Straight Line: 
Yrs DB = 18  Yrs SL = 22  RBV = $188,471.01

The NXT set of menus prints depreciation schedules.

P->SL - Prints straight line depreciation schedule.

P->SYD - Prints SOYD depreciation schedule.

P->DB - Prints declining balance depreciation schedule.



(8) Black-Scholes Call and Put Routines (OPTS)

Press GO-> to set up the custom menu and display.

The display indicates whether you are computing a call option or
put option.

The first set of menus enable you to compute the option value,
stock price, exercise price, interest rate, variance, or time. 
Given any 5 of the 6 variables, the other may be calculated.

The variables are:

OPTV - stores or computes the option value
STKP - stores or computes the stock price
EXP - stores or computes the exercise price
%INT - stores or computes the interest rate
VAR - stores or computes the variance of the stock (enter the
variance, not the standard deviation of the stock price--the
variance is the square of the standard deviation)
T - stores or computes the time, in years

Values are entered by keying in the value and pressing the
appropriate key.  Values are calculated by press left shift and
then the appropriate key.

The NXT set of menus allows you to choose the call or put formula
to calculate, clear the variables, or print the variables as they
appear on the screen.

CALL - sets call mode and changes display title
PUT - sets put mode and changes display title
CLV - sets variables to zero
PRV - prints variables as they appear on the screen

Example:

Choose CALL mode.
STKP = 50
EXP = 49
%INT = 7
VAR = .09
T = 199/365 (.545205479452)

Calculate OPTV
OPTV = 5.85

Choose PUT mode.
Calculate OPTV.
OPTV = 3.01



(9) Inflation Subdirectory ($INF)

Press GO-> to access the custom menu and display.  The screen
title will indicate whether you are currently using the GDP or
CPI index.  The screen will also display the base year amount (BY
Amt), base year (B Year), base year index (BY Ind), nominal year
amount (NY Amt), nominal year (N Year), and nominal year index
(NY Ind).

The first set of six menu keys is for choosing the index to use,
inflation adjusting values, and printing out the screen.

BY AM - stores or computes the base year amount
BY - stores the base year (will not compute base year)
NYAM - stores or computes the current year amount
NY - stores the current year (will not compute current year)


INDEX opens a choose box to choose the index you want to use. 
Two are provided; they are the CPI-U (for all urban workers) and
GDP-CY (gross domestic product index for the calendar year).  In
the choose box the beginning year for each index is also
indicated.

Many times an analysis requires inflation adjusted numbers, i.e.,
nominal dollars from several different years need to be
denominated in dollars of a base year.  For instance, if, in
1982, you expected to receive $1,000 a year for five years
starting in 1988, how much would that be worth in 1982 dollars?

Choose the CPI index by hitting the CPI menu key.  Your base year
is 1982, so enter

BY = 1982.  (If a base year or nominal year is entered that is
out of bounds, a message will be displayed saying so.  Press OK
and enter an appropriate year.)

Enter 1,000 for NYAM (nominal year amount).

Enter 1988 for first NY (nominal year).

Calculate base year amount for 1982 by pressing left shift
BYAM.

BY Amt = 815.72  The screen also displays the base year index
(96.5) and nominal year index (118.3).

Enter 1989 for NY and calculate new BYAM: 778.23.

Do the same for 1990, 1991, and 1992.  If you add them up, you
should get $3,728.61.

You may only calculate base year and nominal year amounts.  If
you try to calculate the base year (BY) or nominal year (NY)
nothing will happen.

PRV - pressing PRV will print the current screen values.

Press NXT.  The only menu key here is CLV.

CLV - clears the variables by setting the base year and current
year amount to zero, the base year and current year to 1995, and
the base year index and current year index to the appropriate
values for 1995.

The indexes are stored in CPIU and GDPCY.  To add new index
values to them, recall the index to the stack (it is in a list
format), enter a new value on the stack and press the + key. 
Store the expanded list under the appropriate name.  



An easy way to enter your own indexes.

You can enter your own indexes and have them appear in the choose
box.  To do so they must be entered in a specific way in a list. 
There are 4 parts to the list.  First, a list to be read by the
choose box routine.  Second, the title that you want to appear on
the display and printed out.  Third, the beginning year of your
index.  Fourth, the index values.

1.  Place a short string to appear in the choose box on the
stack.  Eg., "CPI-U (1960)"  In a program place the quoted name
of the index on the stack.  Eg., << 'CPIU' >>  Put the two
elements in a list by entering 2 ->LIST, or using the interactive
stack.  Leave the list on the stack.

2.  Enter a string with the title to be displayed and printed. 
Eg., "     CPI-U  Index"  (There are 22 columns on the screen so
enter spaces as appropriate to center the title.  The print
routine automatically adds an extra space to the beginning of the
string to center the title on the printout.)  Leave string on
stack.

3.  Enter the beginning year of the index on the stack.  Eg.,
1960.

4.  Enter the index values one after the other on the stack.

5.  Using the DEPTH and ->LIST commands, create one list.  (Or
use the interactive stack.)

6.  Store the list in the variable name given in part 1.  Eg.,
'CPIU' STO.

7.  Reorder your variables so that GO-> is the first menu key.

Your index can now be used by the choose box and the programs.


(10) Simple Interest

Press GO-> to set up the custom menu and display.

Simple interest involves 5 variables.  Given any four, the other
may be computed.  Values are entered by keying in the value and
pressing the appropriate key.  Variables are solved for by
pressing LS (left-shift) and the appropriate key.  Values can be
called to the stack by pressing RS (right-shift) and the
appropriate key.  The variables are:

Prin - the principal amount
%I - the simple interest rate, annual basis
Days - the number of days interest is earned
Int - the amount of interest earned
Basis - the number of days assumed in a year

Example - Prin = 30,000
          %I = 8.00%
          Days = 90
          Basis = 360

Press LS Int:  the answer is 600.

If Basis is changed to 365, Int is 591.78.

PRV will print the variables as they appear on the screen. 
Pressing NXT gets you to the CLV command.  CLV sets the basis to
365 and the other variables to 0.



(11) Discounted Securities

This routine uses the multiple equation solver.  For this reason,
it is best to clear the variables with CLV before doing a new
problem.  The routine also computes two additional variables, the
simple interest yield (%I) and the equivalent bond yield (EBY),
when solving for the discount security variables.

Given either %D (discount rate) or Dys (days) and any two of the
remaining four variables, the other two may be solved for by
pressing the SOLVE soft key.

The variables that can be solved for are:

FValue - face value of the discounted security
Disc - amount of discount
Price - price of discounted security (face value - discount)
%D - discount rate
Dys - days

%I (simple interest yield) and EBY (equivalent bond yield) are
calculated and displayed when any other of the above are solved
for.

Pressing NXT gets you to the second set of menu keys.  Here you
can change the basis for the discount and simple interest
calculations.  Discount securities are usually on a 360 day
basis;  simple interest is usually on a 365 day basis.  These are
the default values when CLV is pressed.  They can be changed,
however, depending on the problem.

BD is the basis for discount.  Enter the value and press BD.

BI is the basis for simple interest.  Enter the value and press
BI.

Example 1:

FValu = 10,000
%D = 5.6%
Dys = 81

Press SOLVE.  Output:

Disc = 126.00
Price = 9874.00
%I = 5.75 (365 day basis)
EBY = 5.75 (EBY is always calculated on a 365 day basis and will
differ from %I if days is greater than 182)

Example 2:

Press CLV to clear values.

FValu = 10,000
Price = 9,627
Dys = 307

Press SOLVE.  Output:

Disc = 373.00
%D = 4.37 (360 day basis)
%I = 4.61 (365 day basis)
EBY = 4.56  (Notice that it is different from %I this time)

On the second set of menus, pressing PRV will print the variables
as they appear on the screen.


MUSE and MCAL are multiple equation library commands and are put
hear for those who really know what they are doing.  MUSE will
set a variable to user-defined; a user-defined variable cannot be
solved for.  MCAL will set a variable to calculated; it can be
solved for.  Using CLV, however, sets the variables to their
appropriate state for a new problem.  Pressing RS and the
appropriate key, the variable name, not the variable value, will
be put on the stack.  MUSE or MCAL may then be pressed, as
desired.  (Pressing EVAL will, of course, evaluate the variable
and put its value on the stack.)


                              THE END


P.S.  May all your future cash flow be positive!