WP34S solver question « Next Oldest | Next Newest »

 ▼ Reth Senior Member Posts: 556 Threads: 9 Joined: Jul 2007 07-12-2012, 08:20 AM I noticed strange behaviour of the SLV function. Long story short: comparing WP34S and (HP15C): calculator in RAD mode, FIX 9; formula: 2*R(tan(D) - D) - L = 0 ```34S: LBL D TAN RCL- L RCL* A 2 * RCL- B END 15C: LBL D TAN LSTx - RCL* 0 2 * RCL- 1 RTN R = 6,371,000 in r.A(0) L in r.B(1) initial guesses: 0 ENTER 0.001; L = 1; 34S 15C -1.570796327 0.006174837 L = 0.1; 34S 15C -1.570796327 0.002866172 L = 0.01; 34S 15C 1.570796327 0.001330163 L = 0.001; 34S 15C 0.000617487 0.000617410 ``` HP48G (and identically HP35S) and HP42S (Free 42) give similar to 15C, right within accuracy answers. Am I missing something? Timing is also interesting. 15C takes almost constant time unlike the 34S. Edited: 12 July 2012, 8:27 a.m. ▼ Walter B Posting Freak Posts: 4,587 Threads: 105 Joined: Jul 2005 07-12-2012, 11:00 AM Not sure you are aware of: L is the LASTx register of the WP 34S. ▼ Gerson W. Barbosa Posting Freak Posts: 2,761 Threads: 100 Joined: Jul 2005 07-12-2012, 11:35 AM The lack of dedicated stack registers is one of the few weaknesses of the WP 34s, IMHO. The user should not worry about not using these forbidden alpha registers for whatever purpose. No problem LastX occupying a position on the keyboard, ./, could gladly go away. ▼ Walter B Posting Freak Posts: 4,587 Threads: 105 Joined: Jul 2005 07-12-2012, 12:03 PM Easy rule: use numbered registers -- keep off the lettered registers! Unlike many Pioneers, the WP 34S doesn't feature lettered registers beyond the stack and specials. Please see p.23 of the manual. ▼ Gerson W. Barbosa Posting Freak Posts: 2,761 Threads: 100 Joined: Jul 2005 07-12-2012, 12:39 PM Sorry! I'll be patient and wait for the wp43s :-) Marcus von Cube, Germany Posting Freak Posts: 3,283 Threads: 104 Joined: Jul 2005 07-12-2012, 02:28 PM L is used correctly as lastX here. A and B may only be used as general registers if the stack size is set to 4, not 8. Even if the solver itself runs with the stack size fixed at 4, this is not true for the called function which uses whichever stack size is set by the user. Reth Senior Member Posts: 556 Threads: 9 Joined: Jul 2007 07-12-2012, 02:58 PM Quote: Not sure you are aware of: L is the LASTx register of the WP 34S. What makes you think I'm not? Damir Junior Member Posts: 31 Threads: 2 Joined: Jun 2007 07-12-2012, 11:19 AM Initial guess 0.001 is too small.Try 0.01. Damir ▼ Reth Senior Member Posts: 556 Threads: 9 Joined: Jul 2007 07-12-2012, 02:53 PM It is good enough for all other mentioned calculators. Paul Dale Posting Freak Posts: 3,229 Threads: 42 Joined: Jul 2006 07-12-2012, 06:10 PM Quote:comparing WP34S and (HP15C) Don't. The algorithms used underneath are very different. In order to get faster convergence, the 34S is using more advanced algorithms than HP's solver. HP's solver is a guarded secant from my understanding whereas the 34S uses this plus quadratic and Ridder's steps. The 34S is finding a pole rather than a root which is unfortunate but by no means impossible with either solver. - Pauli ▼ fhub Posting Freak Posts: 1,216 Threads: 75 Joined: Jun 2011 07-12-2012, 06:30 PM Quote: The 34S is finding a pole rather than a root which is unfortunate but by no means impossible with either solver. So the 34s SLV command is in fact a combined root&pole finder. ;-) Won't it be possible to check for a pole with the following method: If for the last iterations xk,xk+1,... the values |f(xk)|,|f(xk+1)|,... are increasing (instead of decreasing), then it must be a pole instead of a root. Franz ▼ Paul Dale Posting Freak Posts: 3,229 Threads: 42 Joined: Jul 2006 07-12-2012, 06:55 PM That might work but leaves the questions: How to know for sure that there isn't a solution in the interval? How to sensibly look elsewhere? The solver is being trapped because f(a) > 0 and f(b) < 0. For a continuous function there must be a root between a and b (by the intermediate value theorem). The solver can't just blindly abandon the search because the absolute value increased or it will miss legitimate roots. HP's solver can and does get stuck in exactly the same way when it encounters a zero crossing discontinuity. Still, there seems to be some scope for improvement here. - Pauli ▼ Reth Senior Member Posts: 556 Threads: 9 Joined: Jul 2007 07-12-2012, 08:27 PM Quote: HP's solver can and does get stuck in exactly the same way when it encounters a zero crossing discontinuity. Still, there seems to be some scope for improvement here. I'm not so much into the theory, but I can't remember HP solver getting stuck - for the problems I had to solve, or at least in this way (giving -/+90 degrees). Isn't it possible SLV to give up instead? Cheers Reth Senior Member Posts: 556 Threads: 9 Joined: Jul 2007 07-12-2012, 08:17 PM Thanks for the explanation, I suspected so... Apparently I got fouled by the way SLV is used as described in the manual and the reference to the HP15C. Never the less, I'd prefer the old working horse, never had such problems with it. Cheers, ▼ Paul Dale Posting Freak Posts: 3,229 Threads: 42 Joined: Jul 2006 07-12-2012, 08:34 PM If I had the code for the old solver, I'd likely have just implemented it identically. Unfortunately, HP's code isn't available. - Pauli ▼ Gerson W. Barbosa Posting Freak Posts: 2,761 Threads: 100 Joined: Jul 2005 07-12-2012, 09:15 PM Quote: Unfortunately, HP's code isn't available. Sure, but would Prof. Kahan's article help in any way? "Personal Calculator Has Key to Solve Any Equation f(x) = 0" starts at page 20. Gerson. ▼ Paul Dale Posting Freak Posts: 3,229 Threads: 42 Joined: Jul 2006 07-12-2012, 09:23 PM I read through that article multiple times :-) It is good and I do do most of what is written about but it isn't quite complete I think. Regardless, if someone wants to do work on the solver it would be appreciated. The code is: solve.wp34s. - Pauli Valentin Albillo Posting Freak Posts: 1,755 Threads: 112 Joined: Jan 2005 07-13-2012, 07:09 AM . Hi, Gerson: Quote: Sure, but would Prof. Kahan's article help in any way? "Personal Calculator Has Key to Solve Any Equation f(x) = 0" starts at page 20. ``` ``` Forget that old article, it's quite nebulous and incomplete and thus can't be used to re-engineer the original HP Solve code. I suggest you peruse instead this much more complete, 63-page PDF document, somewhat heavier on the math side but then it's the real thing, not a brief article: Have a nice weekend and best regards from V. ``` ``` ▼ Paul Dale Posting Freak Posts: 3,229 Threads: 42 Joined: Jul 2006 07-13-2012, 06:48 PM Thanks for this far more up to date reference. I hadn't seen it. I'm not in the least bit scared of a bit of heavy mathematics :-) Now to try to find some free time.... - Pauli ▼ Gerson W. Barbosa Posting Freak Posts: 2,761 Threads: 100 Joined: Jul 2005 07-13-2012, 07:34 PM Quote: I'm not in the least bit scared of a bit of heavy mathematics :-) I am. I'm glad Valentin's reference has reached the right audience :-) Mathematics Written in Sand might also be a good reading. Gerson. ▼ Paul Dale Posting Freak Posts: 3,229 Threads: 42 Joined: Jul 2006 07-13-2012, 07:48 PM I know that document well :-) - Pauli Ángel Martin Posting Freak Posts: 1,253 Threads: 117 Joined: Nov 2005 07-13-2012, 10:03 AM I don't mean to add controversy and this is probably not useful anyway, but the HP code (at least the Advantage's MCODE) *is* available - as long as one doesn't mind a bit of reverse-engineering. If you remove all the Buffer#14 handling routines it's a sizable but relatively understandable task. FWIW, feel free to ignore it and persue a new approach. After all it may also flunk with the same example,- I didn't try it but being based ont he 15C I guess it won't. Cheers, ÁM Edited to add: tried the example in question and not surprisingly it yields the same results as the 15C. Edited: 13 July 2012, 3:10 p.m. ▼ Paul Dale Posting Freak Posts: 3,229 Threads: 42 Joined: Jul 2006 07-13-2012, 06:55 PM I hadn't thought of this possibility, it would give us compatibility. The MATH pack solver is another option I guess. I'd like to think that there has been some worthwhile progress in automatic solving in the last forty odd years though. - Pauli

 Possibly Related Threads... Thread Author Replies Views Last Post hp-prime solver and variable name fabrice48 22 6,659 12-10-2013, 03:25 AM Last Post: fabrice48 HP Prime Triangle solver BruceH 29 6,654 11-28-2013, 12:03 AM Last Post: Dale Reed Using units in Numeric Solver Harold A Climer 1 974 10-13-2013, 10:44 AM Last Post: Tim Wessman Does Prime Have a Multiple Equation Solver? Norman Dziedzic 2 1,063 09-20-2013, 09:43 AM Last Post: Norman Dziedzic Just a lazy solver algortihm PGILLET 1 868 06-28-2013, 11:47 PM Last Post: Namir Simple? programming question [WP34S] Shawn Gibson 3 1,183 03-15-2013, 11:56 AM Last Post: Didier Lachieze [43s] : How the solver will be implemented Miguel Toro 3 1,273 03-14-2013, 06:09 PM Last Post: Walter B [wp34s] xtal question jerome ibanes 9 2,386 02-05-2013, 05:35 PM Last Post: Massimo Gnerucci (Italy) TVM-Solver for the PC fhub 14 3,193 12-26-2012, 03:24 PM Last Post: fhub [WP34s] New TVM-solver version fhub 43 8,282 12-26-2012, 06:12 AM Last Post: fhub

Forum Jump: