Solver bug for secondary roots?

Post here to share useful tips and tricks, to ask questions about using your DM42 or to report software-related problems
Post Reply
eulerfan
Posts: 20
Joined: Sat Aug 25, 2018 12:19 am

Solver bug for secondary roots?

Post by eulerfan »

While waiting for my DM42 to arrive (it's a long way from Switzerland to Canada!) I've been refreshing my memory of the HP-42S by playing with the Free42 program on my Linux box.

I've tried using the Solver on the following program for (x - 7)(x - 11) = 0 :

Code: Select all

00 { 25-byte Prgm }
01 LBL "QUAD"
02 MVAR "X"
03 RCL "X"
04 ENTER
05 7
06 -
07 X<>Y
08 11
09 -
10 x
11 .END.
This should have roots 7 and 11. My problem is getting the second root x=11 by entering initial estimates of 9 and 20, using the procedure described in the HP-42S Owner's Manual, Chapter 12, section "Choosing Initial Guesses". I entered the following keys:

(Shift) (Solve) (Soft key for QUAD)

OK, now I'm in the solver for program QUAD. More keys:

(9) (Soft key for X)

which should store the low estimate for X. Now to store the high estimate:

(2) (0) (Soft key for X)

To solve for X:

(Soft key for X)

I get answer "X=9.0000" which is clearly not correct (should be 11). Did I do something wrong?

I'm using Free42 2.0.21 on Linux amd64 (Debian 9.4.0).
grsbanks
Posts: 1122
Joined: Tue Apr 25, 2017 11:23 am
Location: Preston, Lancs, UK
Contact:

Re: Solver bug for secondary roots?

Post by grsbanks »

The "ENTER" in line 04 disables stack lift so the 7 that follows it REPLACES the new copy of X instead of pushing it up the stack.

Lose it and replace the "X<>Y" currently in line 07 with another RCL "X" and you should be OK.

Alternatively, replace the ENTER with RCL ST X and leave the X<>Y further down.
There are only 10 kinds of people in the world: those who understand binary and those who do not.
eulerfan
Posts: 20
Joined: Sat Aug 25, 2018 12:19 am

Re: Solver bug for secondary roots?

Post by eulerfan »

Thanks for the quick answer.

You're right, ENTER does disable stack lift, even in a running program. My old, worn out HP-15C does this too. I never noticed it in all the years I've been using HP calculators. Strange.

If I do as you say (remove the ENTER and replace the X<>Y with RCL "X"), the Solver finds the second root x=11, which is correct.
Post Reply