HP Forums
HP42s – Solver / Variable Menu compatibility. - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: HP42s – Solver / Variable Menu compatibility. (/thread-6073.html)



HP42s – Solver / Variable Menu compatibility. - Timbergetter - 04-19-2016 01:03 PM

I have successfully called the Solver application from within a program that uses the MENU function, however it would be better if I could call the Solver from a program that uses the VARMENU function.

Is it possible to call the Solver from a program that is using the VARMENU function? The calling program is required to declare the variables for the menu in the first lines of the program. Conflicting with this is the need to declare the program being called by the SOLVE function by using the PGMSLV function as the first line in the calling program.

Is there a way to incorporate a call to Solver from a program using VARMENU?


RE: HP42s – Solver / Variable Menu compatibility. - jebem - 04-19-2016 01:25 PM

Welcome to our forum!

I have n access to my HP-42S at the moment.

Did you had a look into the MoHPC archived posts?
Some posts that may help:
42S: use of VARMENU
Programming HP-42S
Perhaps using SOLVE... (look for message #7)
Hp 42s Equation problem
HP-42S/41 programming info

The above links were found by typing this in the Google interface:
hp-42s varmenu site:www.hpmuseum.org


RE: HP42s – Solver / Variable Menu compatibility. - Dave Britten - 04-19-2016 01:44 PM

This seems to work, at least according to Free42.

Code:
LBL "VOL"
MVAR "L"
MVAR "W"
MVAR "H"
MVAR "V"
RCL "L"
RCL* "W"
RCL* "H"
RCL- "V"
END

LBL "BOXSLV"
MVAR "L"
VARMENU "BOXSLV"
STOP
PGMSLV "VOL"
RCL "L"
3
*
STO "H"
3
*
STO "V"
SOLVE "W"
END

XEQ "BOXSLV", supply a value for L using the menu, and press R/S.


RE: HP42s – Solver / Variable Menu compatibility. - jebem - 04-19-2016 02:30 PM

(04-19-2016 02:09 PM)Mike (Stgt) Wrote:  
(04-19-2016 01:25 PM)jebem Wrote:  I have no access to my HP-42S at the moment.

No excuse, just use another one like this one or this alternative choice (which also works w/o further ado as a portable application).

Ciao.....Mike

I am well aware of those options.
Helping others with related information to the raised question that is available here in the archives was my goal to the newcomer.


RE: HP42s – Solver / Variable Menu compatibility. - Timbergetter - 04-19-2016 02:37 PM

Many thanks for your replies jebem and Dave.

I entered Dave’s code into free42 and it worked. I will now dissect my code to see just where and why it is falling over. I should have started out with a smaller program fragment and only built it up once the control structure was proven.


RE: HP42s – Solver / Variable Menu compatibility. - Dave Britten - 04-19-2016 02:44 PM

(04-19-2016 02:37 PM)Timbergetter Wrote:  Many thanks for your replies jebem and Dave.

I entered Dave’s code into free42 and it worked. I will now dissect my code to see just where and why it is falling over. I should have started out with a smaller program fragment and only built it up once the control structure was proven.

Totally wild guess: I'd wager that the program has to run uninterrupted between the time you call PGMSLV and SOLVE.


RE: HP42s – Solver / Variable Menu compatibility. - Timbergetter - 04-20-2016 04:03 AM

Thanks everyone for your help. I now see the errors of my ways. My assumptions in my first post were quite wrong. The global label that VARMENU references can be anywhere in a program or somewhere within another program unit. The related MVAR declarations must follow on from that global label. The PGMSLV function/declaration need not be the first line in the program after the label. The DPLOT program on page 156 of the Owner’s Manual is a valuable resource in sorting out the use of VARMENU.