(Free42,DM42) NPV and IRR - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (Free42,DM42) NPV and IRR (/thread-15178.html) |
(Free42,DM42) NPV and IRR - Werner - 06-12-2020 08:58 AM Update: replaced by this newer version that also includes MIRR Solver program. CF0 is separate CFj is an nx2 matrix with the Cash flows (j=1..n) in column 1 and their frequency in column 2 CFj may also be a nx1 matrix, implying all Nj=1 uses subroutine Ni to calculate ((1+i)^N - 1)/i: Code: @ X Y Code: 00 { 140-Byte Prgm } example: create the 7x2 matrix [[1000 1] [2000 2] [3000 3] [4000 4] [5000 5] [6000 6] [7000 7]] Start the solver: Shift-SOLVER, NPV store the matrix in CFj store -100000 in CF0 store 0 in NPV press IRR% -> 2.0417694... hope you like it Werner RE: (Free42,DM42) NPV and IRR - Werner - 06-12-2020 04:04 PM Regarding the solver: many times it just works correctly, but with the above example, if you specify 2 guesses (1 and 2) for IRR%, it still returns the correct answer, but mentions 'Extremum'? How can the same result, with he same input, be regarded as a root or an extremum, depending on the guesses? Werner RE: (Free42,DM42) NPV and IRR - Pekis - 06-12-2020 07:14 PM (06-12-2020 04:04 PM)Werner Wrote: Regarding the solver: many times it just works correctly, but with the above example, if you specify 2 guesses (1 and 2) for IRR%, it still returns the correct answer, but mentions 'Extremum'? How can the same result, with he same input, be regarded as a root or an extremum, depending on the guesses? Hello Werner, With guesses 0.01 and 0.02, my program returns 0.020416943595, and if I press "IR" one more time, I get "Sign reversal", so I don't know what's goin' on in your program ... An extremum is impossible, I think, if first cash flow negative and the others positive ... RE: (Free42,DM42) NPV and IRR - Werner - 06-15-2020 01:16 PM Investigated a little further.. and, of course, what looks like the same result isn't. Supplying guesses 1 and 2 produces IRR%=2.04169...67997, which does not evaluate NPV to zero. Since the guesses do not span a root, it is possible that the algorithm stays in the positive part. Supplying guesses 2 and 3, for instance, results in IRR%=2.024169..68027, and the resulting NPV *is* zero. Werner RE: (Free42,DM42) NPV and IRR - Pekis - 06-15-2020 02:49 PM (06-15-2020 01:16 PM)Werner Wrote: Investigated a little further.. With Emu42, answer is the same in my program (IRR=0.020416943595), wether with[0.01-0.02] or [0.02-0.03] as guesses. Excel gets IRR = approx. 0.0204169435970961 |