HP17BII How do I program solver to find MIRR(Modified Internal Rate of Return) « Next Oldest | Next Newest »

 ▼ David Martin Junior Member Posts: 1 Threads: 1 Joined: Jan 1970 11-27-2001, 03:58 AM How do I program the solver to find MIRR (Modified Internal Rate of Return) ? Currently it takes me seven stages, using the cashflow application. ▼ W. Bruce Maguire II Member Posts: 180 Threads: 23 Joined: Apr 2012 11-27-2001, 04:35 PM David: I have the formula for the FMRR (Financial Management Rate-of-Return), which is published in the pocket guide for the 19BII from Grapevine Publications http://www.read-gpi.com. The formula works---without any modification---on the 17BII (showing just how similar these machines are!). The financial books and pocket guides from this company are excellent. I recommend the Easy Course in Financial Calculations for anyone interested in this area. It has a very straightforward explanation of IRR/MIRR/FMRR. I am disassembling the FMRR algorithm right now, but it is going to take me a bit longer to reverse-engineer it. Once I have that, it will be trivial to do a MIRR simplified-version. E-mail me at the above link (daytime) or at my home E-mail address: `Maguire@AnalyticInvestments.com` if you have any other questions. Otherwise I will post back here when I'm done. Bruce. p.s. The programming power of these machines never ceases to amaze me! W. Bruce Maguire II Member Posts: 180 Threads: 23 Joined: Apr 2012 11-28-2001, 09:53 PM David (and anyone else who might be interested): Here are two programs. The first one is a program to calculate Modified Internal Rate of Return (MIRR) and the second is a bigger program that calculates Financial Management Rate of Return (FMRR) as well as MIRR and IRR for comparison purposes. Both programs are my modifications to a program to calculate FMRR and IRR that is listed in the Pocket Guide for the HP-19BII. The HP-17BII has all the same programming capability as the 19BII, and therefore these programs work exactly the same on both machines. For the MIRR program, you can enter the P/YR, the safe and risk interest rates (APR), and then press "\$IN" to see the NPV of the negative cash flows (at the safe rate) and press "\$OUT" to see the NFV of all the positive cash flows (at the risk rate). Pressing the "MIR%" button will return (after a short while) the MIRR. For the FMRR program, the \$IN and \$OUT calculations are for the FMRR calculation, not the MIRR values. In this program, FMRR, MIRR, and IRR may be returned after hitting the "MORE" button to get to the next page of menu buttons. Note, that if you need to give the IRR calculation initial guesses, you can key in guess #1, hit the IRR key, key in guess #2, hit the IRR key, and then hit the IRR one last time to start the search for a solution (as explained in the manual in the solver section---I think). In the following listings, there are three symbols that I use special notations to represent. 1) The multiplication symbol is "_mult_" 2) The division symbol is "_div_" 3) The summation symbol is "_sum_" Note #1: The cash flow which is used for the calculations must be entered prior to "CALC"ing this formula, and it must be named "\$". If you really prefer another name for some reason, you can always change it in the listing. Wherever "FLOW(\$:...)" or "#T(\$:...)" or "SIZEC(\$:...)" occurs (the cash flow operations), just change the "\$" to your preferred name. Note #2: There is a variable used for the number of periods per year---"P/YR"---the "/" symbol is found in the misc. menu; it is not the divide key! Also, the risk and safe interest rates are entered as percent per year (not per period), which is why the number of periods per year is needed. Note #3: This listing is "exploded" (using my own technique for formatting) for ease of understanding and reading. Spaces should not be used when typing the formula in---except in one important case. For "OR" (and "AND") operations, you must have a space on either side of the operator, or the calculator will be very confused (and wrong!). Oh, one last thing. The bigger (FMRR) program assumes that the first cash flow is negative for the MIRR calculation. In the smaller program, since I was making more modifications, I handle (I think) the case of the initial cash flow being positive (which would be a strange investment!). ```------------------------------------------------------------------- MIRR%: L(N: L(MP: L(MF: 0 ) ) )_mult_ ( IF(P/YR=0: L(P/YR: 1 ) : 0 )+ L(S: SAF%_div_P/YR )+ L(R: RSK%_div_P/YR )+ _sum_( G: SIZEC(\$): 1: -1: L(C: FLOW(\$:G) )+ L(T: #T(\$:G) )+ L(MP: G(MP)_mult_SPPV(G(S):G(T)) )+ IF(G(C)<=0: L(MP: G(MP)+ G(C)_mult_USPV(G(S):G(T)) ) : L(MF: G(MF)+ SPFV(G(R):G(N))_mult_ G(C)_mult_USFV(G(R):G(T)) ) )+ L(N: G(N)+G(T) ) )+ L(C: FLOW(\$:0) )+ IF(G(C)<0: L(MP: G(MP)+G(C) ) : L(MF: G(MF)+ SPFV(G(R):G(N))_mult_ G(C) ) ) )+ IF(S(\$IN): \$IN-G(MP) : IF(S(\$OUT) OR S(P/YR): \$OUT-G(MF) : G(MP)_mult_ SPFV(MIR%_div_P/YR:G(N))+ G(MF) ) ) ------------------------------------------------------------------- FMRR%: L(N: L(F: L(M: L(W: L(MP: L(MF: 0 ) ) ) ) ) )_mult_ ( IF(P/YR=0: L(P/YR: 1 ) : 0 )+ L(I: G(IRR%)_div_P/YR )+ L(S: SAF%_div_P/YR )+ L(R: RSK%_div_P/YR )+ _sum_( G: SIZEC(\$): 1: -1: L(C: FLOW(\$:G) )+ L(T: #T(\$:G) )+ L(X: G(M)_mult_SPPV(G(S):G(T))+ G(C)_mult_USPV(G(S):G(T)) )+ L(MP: G(MP)_mult_SPPV(G(S):G(T)) )+ IF(G(C)<=0: L(MP: G(MP)+ G(C)_mult_(G(S):G(T)) )+ L(M: G(X) ) : L(MF: G(MF)+ SPFV(G(R):G(N))_mult_ G(C)_mult_USFV(G(R):G(T)) )+ IF(G(M)+G(C)>0: L(W: G(W)+ SPFV(G(R):G(N))_mult_ ( G(M)+ G(C)_mult_USFV(G(R):G(T)) ) )+ L(M: G(X) ) : IF(G(X)<=0: L(M: G(X) ) : L(P: IP( LN( -G(M)_mult_G(S)_div_100_div_G(C)+1 )_div_ LN( 1+G(S)_div_100 ) ) )+ L(W: G(W)+ SPFV(G(R):G(N)+G(P))_mult_ ( G(C)_mult_USFV(G(R):G(T)-G(P))+ G(M)_mult_SPPV(G(S):G(P))+ G(C)_mult_USPV(G(S):G(P)) ) )+ L(M: 0 ) ) ) )+ L(F: G(F)+ G(C)_mult_ USFV(G(I):G(T))_mult_ SPFV(G(I):G(N)) )+ L(N: G(N)+G(T) ) ) )+ IF(S(\$IN): \$IN-G(M)-FLOW(\$:0) : IF(S(\$OUT) OR S(P/YR): \$OUT-G(W) : IF(S(FMR%) OR S(SAF%) OR S(RSK%): (G(M)+FLOW(\$:0))_mult_ SPFV(FMR%_div_P/YR:G(N))+ G(W)+ 0_mult_(SAF%+RSK%) : IF(S(MIR%): FLOW(\$:0)+ G(MP)+ G(MF)_mult_SPPV(MIR%_div_P/YR:G(N)) : FLOW(\$:0)_mult_ SPFV(IRR%_div_P/YR:G(N))+ G(F) ) ) ) ) ``` Let me know if there are any bugs in my listing, or if you have any problems. Enjoy, Bruce. ▼ W. Bruce Maguire II Member Posts: 180 Threads: 23 Joined: Apr 2012 11-29-2001, 04:56 PM I found TWO typos in my program listing for the FMRR program. The newest article in the article section contains the fixed listing. Here are the changes: ``` ----------------- IF(G(C)<=0: L(MP: G(MP)+ G(C)_mult_(G(S):G(T)) --BECOMES--> G(C)_mult_USPV(G(S):G(T)) )+ L(M: G(X) ) : L(MF: G(MF)+ SPFV(G(R):G(N))_mult_ G(C)_mult_USFV(G(R):G(T)) )+ ----------------- ``` And: ``` ----------------- IF(G(M)+G(C)>0: L(W: G(W)+ SPFV(G(R):G(N))_mult_ ( G(M)+ G(C)_mult_USFV(G(R):G(T)) ) )+ L(M: G(X) --BECOMES--> 0 ) : IF(G(X)<=0: L(M: G(X) ) : ----------------- ``` Sorry about that. There's just a lot of typing involved in listing these programs! Bruce.

 Possibly Related Threads... Thread Author Replies Views Last Post hp-prime solver and variable name fabrice48 22 1,949 12-10-2013, 03:25 AM Last Post: fabrice48 HP Prime Triangle solver BruceH 29 2,062 11-28-2013, 12:03 AM Last Post: Dale Reed HP Prime - GETPIX_P Return? Thomas Chrapkiewicz 7 571 11-25-2013, 08:54 AM Last Post: Thomas Chrapkiewicz HP Prime: run a program in another program Davi Ribeiro de Oliveira 6 607 11-11-2013, 08:28 PM Last Post: Davi Ribeiro de Oliveira HP PRIME: Hide return value from program and swap Edit with Run vrrr 2 428 11-09-2013, 04:04 PM Last Post: vrrr HP Prime Programming Tutorial #1: LOCAL, RETURN Eddie W. Shore 6 691 10-26-2013, 08:42 PM Last Post: Miguel Toro Using units in Numeric Solver Harold A Climer 1 288 10-13-2013, 10:44 AM Last Post: Tim Wessman Prime cant find Memory available Dougggg 5 507 10-07-2013, 07:24 PM Last Post: Han HP Prime can't find how to use partfrac function ! dg1969 3 416 10-04-2013, 09:25 PM Last Post: Joe Horn OT - A lucky find - Busicom Handy-LE LE-120A Cristian Arezzini 2 389 09-26-2013, 04:43 AM Last Post: Cristian Arezzini

Forum Jump: 