 The Museum of HP Calculators

HP Forum Archive 19

 Symbolic math with the 35s (well.. sort of)Message #1 Posted by Dieter on 27 Aug 2010, 8:14 a.m. After reading this forum for about three or four years I now decided to join this community, so this is my very first post here. Hope I'm doing everything right. :-) I'd like to discuss a special feature of the 35s (and possibly other HP-calculators with HP Solve) that I haven't seen mentioned yet. It's about the way the Solver handles equations while it tries so solve for a given variable. Consider the following equation: A^2 + 2xAxB + B^2 = 8 Let's keep it simple and assume B = 0. This leads to A = +/- sqrt(8) = +/- 2.8284... After providing two guesses in A and x like... 0 STO A 9 ...and starting Solve A, leaving B=0, the 35s is SOLVING for a few seconds and finally returns the expected result A=2.82842712475 in x. The y-register holds the second-best result 2.82842712474, indicating that the result that solves this equation exactly is somewhere between these two values (which in fact is the case). Changing the initial guesses to 0 and -9 returns the same values with a negative sign. So far everything works like expected. Now let's try the same equation, just simplified to (A+B)^2 = 8 Again we provide two guesses 0 and 9, start Solve A and let B=0. What happens now? The 35s immediately(!) comes back with A=2.82842712475, both in x and y - there are no two adjacent solutions, just one single value: the one the 35s returns for sqrt(8). Now let's try to find the negative solution with the same negative guesses as before: 0 and -9. And again, the 35s immediately returns the same positive (!) solution as before. For any intial guess this is the only result it returns. Okay, what happens here? It seems to be something like this: If the 35s realizes that it can easily solve an equation because the desired variable appears only once, it transforms this equation symbolically, in this case giving A = sqrt(8) - B. In all other cases the usual iterative numeric approach is used. Please forgive me if this is old news, but I was a bit puzzled when I found this... er... "special feature" of the 35s. :-) Regards, Dieter

 Re: Symbolic math with the 35s (well.. sort of)Message #2 Posted by gene wright on 27 Aug 2010, 11:54 a.m.,in response to message #1 by Dieter Hi Dieter! Good post. You are quite correct. The HP 35s attempts to compute a "direct solution" first, and if possible, returns that value without completely invoking the solver. This is described in a learning module for the HP 35s found here: The one you want to check out is the Part 2 of the Formula Solver module, found here: But, that's not exactly flashing on a page somewhere, is it? So it is always good to bring these things out like you have done very well.

 Re: Symbolic math with the 35s (well.. sort of)Message #3 Posted by Thomas Radtke on 27 Aug 2010, 12:23 p.m.,in response to message #2 by gene wright Btw., the very first RPL calculator already tried to find the 'direct solution'. In 1985!

 Re: Symbolic math with the 35s (well.. sort of)Message #4 Posted by Dieter on 27 Aug 2010, 5:21 p.m.,in response to message #2 by gene wright Hi Gene, thank you very much for your friendly reply. And I thought I had read all the learning modules. Well, so it seems I've reinvented the wheel. #-) However, there still is one thing I'd like to know. In part 2 the learning module says on page 6: Quote: Where more than one solution is possible, for example ASIN(Y)=0, the direct solution is the "principal" value. For example, for ASIN(Y)=0, this is 0 degrees, not 180 degrees, or –180 degrees If I understand this example correctly, the only solution of the equation arcsin(y) = 0 simply is y = sin(0) = 0, so there is exactly one single result for this equation. Did I miss something here? On the other hand, the solver obviously does not try a direct solution if periodic functions like sin(), cos() or tan() are involved. In this case a direct solution would require e.g. an arcsine which in fact has an infinite number of possible values. So, as far as I can see, an equation like sin(x) = 0.5 is always solved numerically, so that it will return x = 30 or x = 150 or any other solution, depending on the user's initial guesses. Sorry, I don't want to bore you with these details, but I just want to know... ;-) Regards, Dieter

 Re: Symbolic math with the 35s (well.. sort of)Message #5 Posted by Karl Schneider on 28 Aug 2010, 1:35 a.m.,in response to message #1 by Dieter Hello, Dieter -- Excellent first post! And impeccable English, I might add... The HP-35s "direct method" rootfinder was carried over from the HP-33s; a direct method was also implemented in the HP-17B/27S Solve routine, IIRC. Please read this archived thread from 2004 for some discussion regarding the HP-33s direct-method rootfinding. (Apparently, my suggested "seven step" approach was not adopted in the HP-35s.) We even independently employed the same tongue-in-cheek phrase ("special feature") to describe the logic that always returns the directly-calculated solution wherever possible. Such logic is not an attribute, because it may preclude identification of the physically-meaningful root(s) of interest. The best workaround is likely to add an inert term like "+0*X" to the equation. This causes the solution variable X to appear more than once in the equation, rendering it to the calculator 'possibly unsolvable' by algebraic methods. -- KS Edited: 29 Aug 2010, 3:45 p.m. Go back to the main exhibit hall