Re: WP-34s: TVM questions Message #12 Posted by Dieter on 17 Apr 2012, 5:16 p.m., in response to message #11 by W. Bruce Maguire II
Quote:
I would definitely say that this should be addressed in the internal solver, because it *will* cripple its use...
Yes, definitely. I thought this problem had been addressed after it has been discussed here half a year ago. Please take a look at
this thread from October 2011. Message #4, especially section 3, describes exactly the same problem you encountered. If you read further down the thread, you will find more details, thoughts and workarounds that may be applied here as well.
For example, take a look at message #8 and the IRR code starting at LBL C, especially line 061 ff. Here, the two returned solver results first are compared, and if they agree to (here) six digits, the result is considered okay. If they differ slightly, a second test checks whether f(x) in Z (which here is the NPV for the returned interest rate) is less than half a cent. In this case the solver result should be fine as well.
It is also explained why a fixed limit (maybe here 1E-16) for the function result simply makes no sense at all: if the function itself returns values near, say, 1E6 or 1E8, one ULP is as much as 1E-9 or 1E-7. The given examples of simple functions like x^2 - 7 = 0 throwing errors show that in many cases even the best possible 16-digit value does not return a function result that rounds to zero. Even worse, in SCI or ENG mode this never happens unless f(x) is exactly zero. ;-)
Also, the solver still seems to quit sooner or later depending on the set display format, i.e. as soon as the two most recent results agree in all displayed digits, and/or the function result rounds to zero. I think this should be removed from the solver code - the HPs with classic "HP Solve" function work independent from the display setting. If the user wants to set his own exit condition he may simply use something like a "FIX 4 ROUND" sequence at the end of his user function.
Dieter
Edited: 17 Apr 2012, 6:10 p.m.
|