What's going on with the stack when using solver?

General discussion about calculators, SwissMicros or otherwise
Post Reply
User avatar
dm319
Posts: 144
Joined: Thu Aug 03, 2017 12:21 pm
Location: Birmingham, UK

What's going on with the stack when using solver?

Post by dm319 »

So I'm using my DM42* in bigstack mode, on a very simple program which equates to 0, and using the solver on this.

It puts the calculated result in 1, but there is stuff** in 2,3 and 4. Anything I had in the stack goes on to 5 and beyond.

Two questions:

1. What's going on here?

2. Can I stop this behaviour, so it only returns the value I am interested in?

Thanks in advance!


*I just got it and it's amazing - thank you SM!
** usually another value in 2, then 0 in 3 and 4.
SN:09075
dlachieze
Posts: 613
Joined: Thu May 04, 2017 12:20 pm
Location: France

Re: What's going on with the stack when using solver?

Post by dlachieze »

On the HP-42S (and Free42, and DM42) the solver returns different values in the stack to help interpreting the result:

Code: Select all

 Stack    Contents 
Register 
   T      An integer (0-4) indicating the condition that caused 
          the Solver to stop.     
            0 = A solution has been found.
            1 = A sign reversal has occurred.
            2 = An extremum has been found. 
            3 = Bad guess(es) were used. 
            4 = The function may be a constant. 
   Z      The value of the function evaluated at the solution. If an 
          actual root has been found, the Z-register contains a zero. 
   Y      The previous guess. 
   X      The solution (or the best guess if a solution was not found).
See the Solver section of the HP-42S manual for more details.
DM42: 00425 - DM41X: β00066 - WP43: 00042
User avatar
dm319
Posts: 144
Joined: Thu Aug 03, 2017 12:21 pm
Location: Birmingham, UK

Re: What's going on with the stack when using solver?

Post by dm319 »

Oh thanks for that, don't know how I missed that in the manual!

KR,
Duncan
SN:09075
Post Reply