The Museum of HP Calculators

HP Forum Archive 14

 Question aMessage #1 Posted by Namir on 11 Feb 2005, 2:51 p.m. Does anyone have an algorithm, written in some pseudo-code, for one of the HP calculator SOLVER feature? I have read a few articles that were written by folks at HP who worked on the SOLVER feature. Yet I have not seen a pseudo-code or even a source code in a popular language. I am planning to make a presentation at the next HHC (September of this year) conference. If you provide me with information I will give you credit at the conference. I have developed an algorithm that handles the following problems with the popular Newton method: 1)Low slope values near the root. 2)Oscillating guess values between asymptotic values/slopes of a function I appreciate your feedback. You can either post your reply here or email me at nshammasNULLSPAM@aolNULLSPAM.com (of course remove the NULLSPAM to get the actual email address). Many Thanks! Namir

 Re: Question about SOLVEMessage #2 Posted by Thomas Okken on 11 Feb 2005, 3:42 p.m.,in response to message #1 by Namir I have never seen any documentation about this outside of the HP Journal articles you mentioned. The article on the HP-34C (December 1979) is interesting and gives some good insights, but no complete pseudocode. Many aspects of the algorithm (such as how to find x1 and x2 such that f(x1)*f(x2)<0, in case the initial guesses don't satisfy this condition and the initial secant iteration won't converge) are not discussed at all, which is a pity because there's clearly some very clever code at work there. I suppose one could try to ask HP nicely if they'd be willing to release that code, but somehow I doubt it -- it seems like a valuable trade secret -- and disassembling a calculator ROM and reverse-engineering the pseudocode from the listing would be copyright infringement (unless you kept the result of that work to yourself, but where's the fun in that?). Alas! If I had that code I'd use it to make the Free42 solver better... But I guess we're on our own. - Thomas

 Re: Question about SOLVEMessage #3 Posted by Namir on 12 Feb 2005, 7:34 a.m.,in response to message #2 by Thomas Okken Thanks Tom for the info. The hybrid algorithm I developed does not detect and handle the case when the "guess" is in the area of a minimum value (in positive function values) or a maximum value (in negative function values), which I think HP's SOLVE does. The last time I treied my algorithm using f(x) = exp(x) - 3*x^2 + 8, I gave it a guess of 4 and the algorithm found the only root AFTER MANY iterations. My personal standard test function is f(x) = exp(x) - 3*x^2 which has three roots near -,45, 0.91, and 3.7. Namir

 Re: Question aMessage #4 Posted by Bernardo Vargas on 22 Feb 2005, 9:44 a.m.,in response to message #1 by Namir @Namir: You can look at the code of the SOLVE program included in the MATH1 module of the HP41 series.

Go back to the main exhibit hall