RicoM
2005-06-22 12:06:53 UTC
I'm taking a class now that the professor advised everyone to buy a $40
financial TI calculator...being the stubborn 49g+ owner that I am I
thought I'd just program what I needed....well it was working fine
until I stumbled onto the IRR and the Cash Flow requirements (Cash flow
was programmed in, but instead of finding the NPV for a list of flows,
you have to find the NPV for each year individually and sum it...which
is a pain).
Anyway, I did a search on this group and found the PROOT command...also
found some other programs but I couldn't get it to work on my 49g+. SO
I finally just broke down and wrote my own program...
Now this program uses the "inform" command (which I like using a lot).
And as a disclaimer...I AM NOT a programmer! I didn't care about
slimming this program down and making it run better....I was only
concerned about making it work! I finished writing this thing around
10:00 last night and I was just tired of messing with it. I'm sure the
majority of users on this news group could make this more
efficient....but at least I laid the groundwork for you. It'll work,
but I use Global variables and purge them at the end. I'm sure I could
have eliminated some of the variables completely, but I didn't have
time to "tidy" it up after I finished and honestly the final exam is
next Monday and after that, I'm not sure I'll EVER get around to
cleaning it up. Hope this helps someone! Oh, also, the initial value
was chosen because that was the sample problem given in class. I used
it so because I knew what the answer was beforehand.
« « "Operation Cancelled" DOERR »
->
e @error
« "Cash Flow Inputs"
{ { "CF" "Cash Flow {CF0 CF1...CFn}" 5}
{ "i" "Interest Rate" 0 } }
{ 1 2 }
{ { -5000 800 800 800 800 800 800 800} .06 }
{ { -5000 800 800 800 800 800 800 800} .06 }
INFORM
DROP
OBJ->
DROP
'INTEREST' STO
'JLIST' STO
JLIST @Find IRR
LIST->
->ARRY
PROOT
OBJ->
OBJ-> DROP
'ILIST' STO
IF 'ILIST' 1 > THEN
WHILE 'ILIST' 1 >
REPEAT
SWAP
DROP
ILIST 1 -
'ILIST' STO
END
OBJ->
DROP
1 - 100 *
'IRR' STO
ELSE
e
END
CLEAR
JLIST
OBJ->
'NLIST' STO
WHILE 'NLIST' 1 > @Finding Present Value
REPEAT
INTEREST 1 +
NLIST 1 - ^
/
NLIST 1 -
ROLLD
NLIST 1 -
'NLIST' STO
END
DEPTH @Adding them together
'NLIST' STO
WHILE 'NLIST' 1 >
REPEAT
+
NLIST 1 -
'NLIST' STO
END
2 RND
"NPV ($)" ->TAG
IRR
5 RND
"IRR (%)" ->TAG
SWAP
'NLIST' PURGE
'IRR' PURGE
'INTEREST' PURGE
'JLIST' PURGE
'ILIST' PURGE
» »
financial TI calculator...being the stubborn 49g+ owner that I am I
thought I'd just program what I needed....well it was working fine
until I stumbled onto the IRR and the Cash Flow requirements (Cash flow
was programmed in, but instead of finding the NPV for a list of flows,
you have to find the NPV for each year individually and sum it...which
is a pain).
Anyway, I did a search on this group and found the PROOT command...also
found some other programs but I couldn't get it to work on my 49g+. SO
I finally just broke down and wrote my own program...
Now this program uses the "inform" command (which I like using a lot).
And as a disclaimer...I AM NOT a programmer! I didn't care about
slimming this program down and making it run better....I was only
concerned about making it work! I finished writing this thing around
10:00 last night and I was just tired of messing with it. I'm sure the
majority of users on this news group could make this more
efficient....but at least I laid the groundwork for you. It'll work,
but I use Global variables and purge them at the end. I'm sure I could
have eliminated some of the variables completely, but I didn't have
time to "tidy" it up after I finished and honestly the final exam is
next Monday and after that, I'm not sure I'll EVER get around to
cleaning it up. Hope this helps someone! Oh, also, the initial value
was chosen because that was the sample problem given in class. I used
it so because I knew what the answer was beforehand.
« « "Operation Cancelled" DOERR »
->
e @error
« "Cash Flow Inputs"
{ { "CF" "Cash Flow {CF0 CF1...CFn}" 5}
{ "i" "Interest Rate" 0 } }
{ 1 2 }
{ { -5000 800 800 800 800 800 800 800} .06 }
{ { -5000 800 800 800 800 800 800 800} .06 }
INFORM
DROP
OBJ->
DROP
'INTEREST' STO
'JLIST' STO
JLIST @Find IRR
LIST->
->ARRY
PROOT
OBJ->
OBJ-> DROP
'ILIST' STO
IF 'ILIST' 1 > THEN
WHILE 'ILIST' 1 >
REPEAT
SWAP
DROP
ILIST 1 -
'ILIST' STO
END
OBJ->
DROP
1 - 100 *
'IRR' STO
ELSE
e
END
CLEAR
JLIST
OBJ->
'NLIST' STO
WHILE 'NLIST' 1 > @Finding Present Value
REPEAT
INTEREST 1 +
NLIST 1 - ^
/
NLIST 1 -
ROLLD
NLIST 1 -
'NLIST' STO
END
DEPTH @Adding them together
'NLIST' STO
WHILE 'NLIST' 1 >
REPEAT
+
NLIST 1 -
'NLIST' STO
END
2 RND
"NPV ($)" ->TAG
IRR
5 RND
"IRR (%)" ->TAG
SWAP
'NLIST' PURGE
'IRR' PURGE
'INTEREST' PURGE
'JLIST' PURGE
'ILIST' PURGE
» »