(Plus42) Cash Flow Analysis: NPV, IRR%, MIR%, FMR%
|
02-06-2022, 10:59 AM
(This post was last modified: 02-17-2022 12:42 PM by Werner.)
Post: #1
|
|||
|
|||
(Plus42) Cash Flow Analysis: NPV, IRR%, MIR%, FMR%
Update: for the latest version see here.
My first try at writing equations! The following equation performs Cash Flow Analysis: - NPV: Net Present Value - IRR%: Internal Rate of Return : the interest rate that makes NPV=0 - MIR%: Modified Internal Rate of Return: works with two interest rates. Negative cash flows are discounted back to Present Values using a safe rate SF%, positive cash flows are accumulated forward to Future Values with a Re-investment rate RI%. The MIR% is then ((FV/PV)^(1/N)-1)*100, with N the total number of cash flows, not counting CF0. - FMR%: Financial Management Rate of Return: like MIR%, but where possible, future negative cash flows will be removed by prior positive cash flows. - All cash flows CFj (including CF0!) must be placed in a column matrix CF, with the corresponding frequency Nj in an optional second column. - Since these are solver equations, IRR% can be found setting NPV to zero and solving for IRR% - all calculations are done using a single reverse sweep over the CF matrix - I am a beginner at these things, so I'd welcome improvement tips. example 1 --------- from the HP30b manual pg 44, the only HP to feature FMRR Create the 8x1 matrix - including CF0: [[ -1250000 ] [ -300000 ] [ 200000 ] [ 450000 ] [ -200000 ] [ 700000 ] [ 300000 ] [ 500000 ]] CALC the equation, and press CF to store the matrix Then set NPV to zero and press IRR%=4.96 set SF%=5 and RI%=8, then MIRR%=5.94 FMRR%=5.86 example 2 --------- from hpmuseum forum: https://www.hpmuseum.org/forum/thread-13...#pid117980 Create the 7x2 matrix [[ -25000 1] [ 10000 1] [ -7000 1] [ 5000 8] [ -4000 12] [ 35000 2] [ 29000 2]] and determine - NPV with discount rate 5% (24688.29) (Set IRR% to 5 and press NPV) - IRR% (11.08%) (set NPV to 0 first) - MIRR% with safe rate 3.75% and reinvestment rate 8.35% (7.87%) - FMRR% with the same rates (8.47%) formatted equation: Code: CFA:0*( as an equation string: Code: CFA:0*(L(N:MROWS(CF))+IRR%+NPV+SF%+RI%+MIR%+FMR%+L(P:0))+IF(S(CF):0:IF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RR%/100)+IF(MCOLS(CF)=1:Σ(I:G(N):1:-1:L(P:(G(P)+CF[I])/G(R))):Σ(I:G(N):1:-1:L(Nj:CF[I:2])+L(P:G(P)*SPPV(IRR%:G(Nj))+CF[I:1]*USPV(IRR%:G(Nj))))))+NPV-G(P)*G(R)))))) Took me 2 days to write - far less than the corresponding 42S RPN program that is still not finished ;-) The #1 cause for errors is mismatched parentheses - I would therefore like very much to have a () insert in one go, with the cursor in between the parentheses - a bit like the '48 does. Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)