Hp 50g finance program



#2

Hello Hp 50g,

the hp 50g has a built-in modul for payments with constant periodical payments. This works fine.

My proggies here are calculating the cashflow and the internal rate of interest for a certain cashflow. The proggies are not tested with a lot of examples, but with some examples out of the 12c or 17bii manuals.

I like to explain the two proggies in a short way for input and output. Enjoy!

First: the CFLOW-Program:

%%HP: T(3)A(R)F(,);

\<< 100 / { } \-> Co L Z LE

\<< PUSH -3 SF -105 SF Co 1 L SIZE

FOR I L I GET OBJ\-> DROP Z 1 + SWAP NEG ^ 1 SWAP - Z / SWAP Z

1 + SWAP NEG 1 + ^ * * LE SWAP + 'LE' STO

NEXT LE + \GSLIST POP

\>>

\>>

INPUT:

STACK 3: payment "Co", mostly negativ.

STACK 2: a list with lists of three objects

STACK 1: interest rate for that cashflow

a example for the list: {{500 1 2}{400 3 5}{100 9 2}}
I have to explain the objects for example: {400 3 5}
First Value: Payment
Second Value: Payed at the end of third period
Third Value: The payment of 400 bucks for five periods (group of payment with constant value)

interest rate value as percent without percent: 10% -> 10 as Input

OUTPUT: netto present value (NPV).

Second program: IRR Program:

Very important! This program only works when the program CFLOW is in the same directory, too.

%%HP: T(3)A(R)F(,);

\<< 5, 10, \-> Co L XI XI1

\<< PUSH -3, SF -105, SF Co L XI CFLOW Co L XI1 CFLOW DUPDUP ABS

WHILE ,005 \>=

REPEAT 3, PICK - ROT SWAP / XI XI1 2, PICK - ROT * - XI1 'XI'

STO 'XI1' STO Co L XI1 CFLOW DUPDUP ABS

END 3, DROPN XI1 POP

\>>

\>>

INPUT:

STACK 2: payment "Co", mostly negativ.

STACK 1: a list with lists of three objects (explained above).

OUTPUT: the internal interest rate in percent without percent f. e.:
12,5 means 12,5 %

The IRR program works with the regula falsi method. There is a difference which can be zero in a division. The program is simple and has no error handling for this situation. May be the IRR value converges against the wrong value, that could be caused by wrong start values for the rate (here 5 and 10, the first two values in the beginning of the program). IRR terminates, when NPV is zero, that means less then 0,005 Cent.

Sincerely
peacecalc

Edited: 1 Jan 2012, 10:25 a.m.


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP Prime: run a program in another program Davi Ribeiro de Oliveira 6 2,644 11-11-2013, 08:28 PM
Last Post: Davi Ribeiro de Oliveira
  Female Finance Reporters & Their Calcs John W Kercheval 0 801 05-15-2012, 02:23 PM
Last Post: John W Kercheval
  Elastic Collisions Program: HP 50g Eddie W. Shore 9 2,693 03-28-2012, 07:58 AM
Last Post: bluesun08
  How a little HP-50g program mutated into an iPhone app Peter Murphy (Livermore) 6 2,113 01-12-2012, 06:06 PM
Last Post: Norman Dziedzic
  HP 50g trilogy. The new HP 50g Blue (and II) Pablo P (Spain) 18 5,065 09-19-2011, 03:08 AM
Last Post: BruceH
  How to install/ru​n this program in an Hp 50g. Vasheer 2 1,109 08-17-2010, 06:34 PM
Last Post: Daniel Oliva
  A useful HP-50G program to keep the DIRs clean... Bill Zimmerly 4 1,415 11-13-2009, 12:17 AM
Last Post: Bill Zimmerly
  Updates and strange Finance module behaviour (with HEPAX/NoVRAM) Diego Diaz 14 4,260 09-25-2008, 06:04 PM
Last Post: Dan Grelinger
  Stopwatch program for HP 50G hpnut 0 735 09-06-2008, 05:18 AM
Last Post: hpnut
  Finance Formulas Jeff Maloney 2 1,115 05-02-2008, 02:24 PM
Last Post: MacDonald Phillips

Forum Jump: