Post Reply 
A formula for IRR
05-19-2015, 01:22 PM (This post was last modified: 05-20-2015 09:26 PM by salvomic.)
Post: #39
RE: A formula for IRR
(05-19-2015 12:45 PM)akmon Wrote:  I use SOLVE and no problem in CAS or HOME, with my physical calculator.
Also the list autostores the values in CAS and HOME without sto command.
And I don´t see any problem if the list doesn´t exists. L1 always exists, with 0 items but it exists. Then you enter the flows and that´s all. Try this again:
...

yes, you're right. I'd prefer to use "flows" but L1 could be good also and it solves the problem of non existing list!

(05-19-2015 12:49 PM)DrD Wrote:  Since L1 is a reserved variable, it always exists. ...

Code:

EXPORT IRR()
...

It seems to run ok. EDITLIST() has optional parameters, which may be useful, but the above code is a very handy program for the purpose.

yes, EDITLIST is a good tool! What a pity it doesn't change anything in CAS, however...
I'll put also the export for variable, to export irr as variable also; it's useful to have it exported...

(05-19-2015 01:02 PM)Didier Lachieze Wrote:  ...
It run ok from Home but not from CAS. If you replace "solve" by "Solve.SOLVE" (with an uppercase 'S') it works fine from both.

it's right! I'm testing now.
But with the "11 element list" (it's not importante that is has 11 element or its length but that it IRR should have almost 2 results...) it gives only the positive result.

IRR may have (also in HP 12C) more results, if there is one positive it is unique, if they are negative they can be more, but one positive there is always (that says the HP 12C Guide)...
solve() gives two results, Solve.SOLVE only one, but it's the most important (solve two but only in CAS)...
In 12C other result can be achieved "guessing" an interest near the presumed IRR and recall NPV (with PSE key and so on)...
Normally in a "well post" problem there is only an IRR (or only an important IRR), however.

Salvo

P.S.
Finished with IRR we could also find a formula for ...MIRR (Modified Internal Rate of Return): see here in the 12C Guide (page 256).
IRR is very important but sometimes (if it has more results or period for cash flow are irregular or there could be fluctuation in the market...) some analysts prefer to use MIRR Smile

EDIT
***
Consider this 21 items list, and with the occasion another feature to add could be add the ability of set number of items (i.e. if for 9 months we have 10000$ income, we should avoid to input 9 times 10000: 12C use CFj and Nj for this use; NVP, the Eddis' program works with list -r, {flows}- or matrix -r,[[flow, freq], [flow, freq], ...]- this could be an idea here):
{-180000, 100000 (5 times), -100000 (5 times), 0 (9 times), 200000}
12C calculates 3 IRR (only with "guesses" (using i key), otherwise it gives "error 3": no IRR): 1.86, 14.35, 29.02.
With Solve.SOLVE() I get 0.018604...
With fsolve() (CAS) I get [-0.9625... 1.290215... 1.14348... 0.018604...]: 4 results?
These result should be erratic, however Solve.SOLVE() has one of the correct result (1.86%), fsolve() has 1.86%, the other two but with +100% (1.1435, 1.2902) plus another results not reported in 12C calcs (-96.25%)...

MIRR with the 12C formula (with a "secure rate" of 6% and a risk rate of 10% and n=20) I get (the example is in the Guide PDF) 0.81 (monthly) and 9.70% (yearly).
We need to investigate here!

EDIT 2
The best result are given by solve() (not fsolve() or Solve.SOLVE() ):
with the above "21 items list":
[-1.95257... 0.018604... 0.14348... 0.2902152...], the last three are the correct results (as 12C), the first not.
In Home no warnings, in CAS, however there is a warning: "Warning, argument is not an equation, solving -180000+100000/X^2+100000/X^3+...+200000/X^20=0)
I don't know if the warning could be avoided.

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
A formula for IRR - salvomic - 05-17-2015, 08:47 PM
RE: A formula for IRR - Gene - 05-17-2015, 09:13 PM
RE: A formula for IRR - salvomic - 05-17-2015, 09:19 PM
RE: A formula for IRR - salvomic - 05-18-2015, 08:03 AM
RE: A formula for IRR - akmon - 05-18-2015, 09:20 AM
RE: A formula for IRR - salvomic - 05-18-2015, 09:33 AM
RE: A formula for IRR - salvomic - 05-18-2015, 06:01 PM
RE: A formula for IRR - salvomic - 05-18-2015, 10:27 AM
RE: A formula for IRR - DrD - 05-18-2015, 11:54 AM
RE: A formula for IRR - salvomic - 05-18-2015, 12:31 PM
RE: A formula for IRR - DrD - 05-18-2015, 01:47 PM
RE: A formula for IRR - salvomic - 05-18-2015, 02:08 PM
RE: A formula for IRR - DrD - 05-18-2015, 02:47 PM
RE: A formula for IRR - salvomic - 05-18-2015, 02:56 PM
RE: A formula for IRR - DrD - 05-18-2015, 03:32 PM
RE: A formula for IRR - salvomic - 05-18-2015, 03:45 PM
RE: A formula for IRR - DrD - 05-18-2015, 03:55 PM
RE: A formula for IRR - salvomic - 05-18-2015, 03:57 PM
RE: A formula for IRR - salvomic - 05-18-2015, 05:20 PM
RE: A formula for IRR - salvomic - 05-18-2015, 07:49 PM
RE: A formula for IRR - akmon - 05-18-2015, 07:51 PM
RE: A formula for IRR - salvomic - 05-18-2015, 07:55 PM
RE: A formula for IRR - akmon - 05-18-2015, 10:15 PM
RE: A formula for IRR - salvomic - 05-18-2015, 09:18 PM
RE: A formula for IRR - Alfon - 05-18-2015, 10:30 PM
RE: A formula for IRR - salvomic - 05-19-2015, 08:58 AM
RE: A formula for IRR - akmon - 05-19-2015, 10:32 AM
RE: A formula for IRR - akmon - 05-18-2015, 11:07 PM
RE: A formula for IRR - DrD - 05-19-2015, 11:28 AM
RE: A formula for IRR - Didier Lachieze - 05-19-2015, 11:43 AM
RE: A formula for IRR - DrD - 05-19-2015, 12:10 PM
RE: A formula for IRR - DrD - 05-19-2015, 12:05 PM
RE: A formula for IRR - akmon - 05-19-2015, 12:27 PM
RE: A formula for IRR - salvomic - 05-19-2015, 12:33 PM
RE: A formula for IRR - akmon - 05-19-2015, 12:45 PM
RE: A formula for IRR - DrD - 05-19-2015, 12:49 PM
RE: A formula for IRR - Didier Lachieze - 05-19-2015, 01:02 PM
RE: A formula for IRR - salvomic - 05-19-2015 01:22 PM
RE: A formula for IRR - salvomic - 05-20-2015, 09:25 PM
RE: A formula for IRR - fhub - 05-20-2015, 10:40 PM
RE: A formula for IRR - salvomic - 05-20-2015, 10:48 PM
RE: A formula for IRR - salvomic - 05-21-2015, 06:20 PM



User(s) browsing this thread: 2 Guest(s)