HP Forums
Question a - 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: Question a (/thread-69042.html)

Question a - Namir - 02-11-2005

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!


Re: Question about SOLVE - Thomas Okken - 02-11-2005

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 SOLVE - Namir - 02-12-2005

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.


Re: Question a - Bernardo Vargas - 02-22-2005

@Namir: You can look at the code of the SOLVE program included in the MATH1 module of the HP41 series.