17BII & 17BII+ Discounted Payback Period Revisited - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: 17BII & 17BII+ Discounted Payback Period Revisited (/thread-256488.html) 17BII & 17BII+ Discounted Payback Period Revisited - Tom Neudorfl - 11-20-2013 I have been trying to program an equation for discounted payback period into my 17BII (serial 3211S) and my 17BII+ (silver). In the forums, I have found Peter's excellent discounted payback solution in the following post: http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv019.cgi?read=153562 Curiously, this equation works reasonably well on the 17BII+ (reasonably because the answers are slightly off, but very close) but the equation fails as invalid after pressing CALC on the 17BII. I have triple-checked my typing, so it is not an entry error. Any insight about this behaviour? Is it perhaps a memory limitation that allows equations of only a certain length in the original 17BII? (It shouldn't be, though, because the trig functions are much longer...) Is this an unusual example the otherwise dodgy "plus" solver outperforming the original? Is there an edit to Peter's tremendously useful formula that would make it work on the 17BII? Many thanks in advance! Re: 17BII & 17BII+ Discounted Payback Period Revisited - Don Shepherd - 11-20-2013 Tom, my first guess would be that it might be a memory size problem. The 17bii+ has a lot more memory (for storing equations and lists) than the 17bii. Peter's equation is not that big, but if you have a lot of other things stored on the 17bii, it might not have room to compile your equation. Re: 17BII & 17BII+ Discounted Payback Period Revisited - Don Shepherd - 11-20-2013 I entered Peter's equation into my 17bii and got an error message when I CALC'd. The error occurred at the 3 right parens before >=1E-15 at the end of line 18. I deleted one of those right parens (leaving 2 of them) and added a right paren after the 15, and it then CALC'd OK. Apparently, the 17bii does not like it when you enclose the first expression in an IF statement in parens, but it's ok if you enclose the second expression (the one following the logical symbol) in parens. It looks like the 17bii+ must handle both of these ok. The 17b has the same problem as the 17bii. Ahh, I found the answer to this problem. In the 17b and 17bii manual is found the following caveat: ``` A conditional expression that contains within it an algebraic expression might cause the error INVALID EQUATION. If this happens, insert a + before the left parenthesis starting the algebraic expression. For example, change IF((A+2)/5<12: ... to IF(+(A+2)/5<12: ... They must have fixed this in the plusses. ``` Edited: 20 Nov 2013, 10:49 p.m. Re: 17BII & 17BII+ Discounted Payback Period Revisited - Tom Neudorfl - 11-21-2013 Don Fantastic detective work! Thank you so much - your solution has helped add useful functionality to this great little calculator. Indeed, the outermost set of parentheses before the >= comparison operator seems redundant. In this case, the problem is equally fixed by removing it altogether, but the general workaround you found will be useful in other circumstances too. Thanks again! Tom Re: 17BII & 17BII+ Discounted Payback Period Revisited - Gerson W. Barbosa - 11-21-2013 Quote: They must have fixed this in the plusses. And broken other things as a compensation... Re: 17BII & 17BII+ Discounted Payback Period Revisited - Don Shepherd - 11-22-2013 I vaguely remember reading that caveat in the 17bii manual years ago, but I must not have written an equation that encountered that problem. I'm glad you brought this up. It makes one wonder, if they had the time to put the caveat in the manual, why didn't they take the time to make the fix and test it? Perhaps it wasn't an easy fix. Re: 17BII & 17BII+ Discounted Payback Period Revisited - Don Shepherd - 11-22-2013 Yeah, I have to wonder if fixing this problem in the plusses may have caused the other problems that caused the behavior of the solver to be so different between the 17b/17bii and the plusses. If that is true, I wish they would have not made this fix! Re: 17BII & 17BII+ Discounted Payback Period Revisited - Tom Neudorfl - 11-25-2013 Interesting! The change certainly appears to have been made intentionally, or at least to have actively been given attention, as I do not see the caveat in Edition 3 of the manual, which shipped with the 17BII+... What page does it appear on in the earlier editions? Tom Re: 17BII & 17BII+ Discounted Payback Period Revisited - Don Shepherd - 11-25-2013 In my 17b manual, edition 3 (November 1988), it's on page 161. In my 17bii manual, edition 1 (December 1989), it's also on page 161. In my 17bii manual, edition 3 (November 1994), it's also on page 161. Now there's consistency for you! I don't have any 17bii+ manual, but I'm supposing it's not in any of them since they fixed the problem in the plusses (as your testing shows). Edited: 25 Nov 2013, 10:31 a.m.