The Museum of HP Calculators

HP Forum Archive 20

[ Return to Index | Top of Index ]

HP35S solve problem
Message #1 Posted by Alessandro Castellani (Italy) on 31 Dec 2011, 9:35 a.m.


I'm new in this forum and I have a problem on my 35S: 
when I try to solve for the expression x^2-4 I always find only the
 positive root (2) even if I give it two initial estimates like -3
 and -1 very close to the negative root (-2). 
This happens only trying to solve the expression directly from the 
EQN list, if I define the expression  in a program and I solve it
 giving the same initial estimates, solve result is fine.

This is my operation sequence in RPN mode: I insert the expression in the EQN list: [EQN] X^2-4 [ENTER] [C] I store in the X variable the first estimate (-3) 3[+/-][STO][X][ENTER] I store in the X register the second estimate (-1) 1[+/-][ENTER] from EQN list I recall the expression and I solve it for the variable X: result is always 2

Could anyone explain me where I wrong ?

Thanks in advance and my best wishes for an happy 2012 to everybody.


      
Re: HP35S solve problem
Message #2 Posted by Dieter on 31 Dec 2011, 10:51 a.m.,
in response to message #1 by Alessandro Castellani (Italy)

Alessandro, there's nothing wrong with your 35s. You just discovered a feature that is often overlooked: the 35s can solve equations symbolically. It does so if the variable appears only once in the equation.

This also happens in your case. Here, the equation

 X^2 - 4
or
 X^2 - 4 = 0
is automatically transformed to
 X = SQRT(4)
This exact solution is then evaluated by the 35s, using its regular functions. So the square root always returns a positive result.

This also means that - in such a case - the two initial guesses do not matter at all, they are completely ignored.

If you want the usual numerical solution by successive iteration, simply change the equation a bit so that the variable appears twice:

 X*X - 4
or
 X^2 - 4 = 0*X

All this has been discussed before. For more information and further details, please take a look at this thread.

Dieter

Edited: 31 Dec 2011, 11:18 a.m.

            
Re: HP35S solve problem
Message #3 Posted by Alessandro Castellani (Italy) on 2 Jan 2012, 3:37 a.m.,
in response to message #2 by Dieter

Thank you very much Dieter.

Alessandro

            
Re: HP35S solve problem
Message #4 Posted by Paul Dale on 2 Jan 2012, 4:00 a.m.,
in response to message #2 by Dieter

How fares the 35S with X! = 6 ??

Variable appearing exactly once but there is no inverse gamma function on the device that I'm aware of.

- Pauli

                  
Re: HP35S solve problem
Message #5 Posted by Norman Dziedzic on 2 Jan 2012, 11:20 a.m.,
in response to message #4 by Paul Dale

Without using the multiple variable trick in the equation it went for about 40 seconds and I canceled it.

Using the equation X!=6+0*X

It returned 3.000 (my setting Fix 3) after about 10 seconds.

                  
Re: HP35S solve problem
Message #6 Posted by Dieter on 2 Jan 2012, 3:06 p.m.,
in response to message #4 by Paul Dale

Well, there are some restrictions so that not all cases with a single appearance of the variable are solved symbolically. For instance, consider periodic functions like sin or cos. An equation like

   SIN(X) = 0,5
will not be solved directly since there is an infinite number of solutions (30, 150, 390, 510, ... degrees). So the 35s will not simply set x = arcsin(0,5) and return 30 degrees.

The case you mentioned

   X! = 6
cannot be solved directly since there is no inverse factorial or inverse Gamma function on the 35s. So the usual iterative approach is applied here. I tried various initial guesses between 0 and 20 - the 35s always came up with the correct result x = 3, usually within 4 - 10 seconds. No tweaking (...+0*X) was required.

Dieter


[ Return to Index | Top of Index ]

Go back to the main exhibit hall