Hp 50g finance program  Printable Version + HP Forums (https://archived.hpcalc.org/museumforum) + Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum1.html) + Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum2.html) + Thread: Hp 50g finance program (/thread208172.html) 
Hp 50g finance program  peacecalc  01012012 Hello Hp 50g, the hp 50g has a builtin 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 CFLOWProgram: %%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}} 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.: 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
Edited: 1 Jan 2012, 10:25 a.m.
