Symbolic math with the 35s (well.. sort of)



#2

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

#3

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:

HP 35s learning modules


The one you want to check out is the Part 2 of the Formula Solver module, found here:

Part 2

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.


#4

Btw., the very first RPL calculator already tried to find the 'direct solution'. In 1985!

#5

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
#6

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.


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need help understanding math.... cyrille de Brébisson 9 3,951 12-13-2013, 02:23 AM
Last Post: Didier Lachieze
  HP Prime suggestion to avoid Numeric/Symbolic confusion Chris Pem10 4 1,897 11-19-2013, 05:49 AM
Last Post: bluesun08
  Rearanging the "Fixed" sort order of Prime's Apps icons Joe Horn 3 1,752 10-02-2013, 10:24 AM
Last Post: Han
  OT: a math competition site Pier Aiello 0 1,079 09-16-2013, 06:03 AM
Last Post: Pier Aiello
  [HP-Prime] AMBIGUITY between Numerical Calculation (HOME) and Numerical/Symbolic Calculation (CAS mode) CompSystems 2 1,469 08-18-2013, 07:06 PM
Last Post: CompSystems
  Simple Math Question Namir 2 1,431 08-09-2013, 06:13 PM
Last Post: Eddie W. Shore
  Cool math clock Bruce Bergman 28 8,022 04-10-2013, 03:13 AM
Last Post: Siegfried (Austria)
  Math Challenge I could not solve Meindert Kuipers 22 6,339 01-05-2013, 04:43 PM
Last Post: Thomas Klemm
  Math Question Namir 0 958 11-06-2012, 07:43 AM
Last Post: Namir
  Symbolic limit of a function of 2 variables, HP49/50 Gilles Carpentier 0 888 08-26-2012, 10:28 AM
Last Post: Gilles Carpentier

Forum Jump: