Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!hplabs!hpfcso!rrd From: rrd@hpfcso.HP.COM (Ray Depew) Newsgroups: comp.sys.handhelds Subject: Re: How to use the Solver by program ? Message-ID: <7360054@hpfcso.HP.COM> Date: 24 Jan 91 16:08:04 GMT References: <1991Jan23.125308.25978@enac.dgac.fr> Organization: Hewlett-Packard, Fort Collins, CO, USA Lines: 79 Nicolas Rey (maugis@enac9.enac.dgac.fr (maugis-IEEACS89)) asks: >Hi everybody! >I'm trying to use the SOLVE function of the 48 inside a program. >It's easy to call the SOLVER menu with the command 30 MENU, but what >I'd like is precisely not see the SOLVER menu, but still use the SOLVE >command. Let me explain my poor self: . . . >Is there a way? Is it just plain and simple? Is there a SYSEVAL >corresonding to each variable that you can solve? Yes, there's a way. Yes, it's plain and simple. No, SYSEVALs aren't necessary. You can use the programmable command "ROOT" to solve an equation from inside a program. (You can find it in the SOLVE menu.) The stack diagram is given below. Input ----- Level 3: equation or equation name Level 2: name of the unknown variable Level 1: initial guess or guesses Output ------ Level 1: value of unknown variable To use ROOT, you store the values for all the known variables, then you arrange the stack as shown above and execute ROOT. For example, suppose you want to solve for X in the equation 'Z=X+Y'. The equation is stored in the variable 'PLANE'. Z = 10 and Y = 2. The program << 10 'Z' STO 2 'Y' STO 'PLANE' 'X' 0 ROOT >> will return an answer of 8. Options: - Level 3 can be the equation itself, 'Z=X+Y', or the equation name, 'PLANE'. - Level 1 can be a single guess, or a list consisting of two or three (not more) guesses. Examples of acceptable guesses for 'X' are 0 { 0 1 } { 0 1 0.5 } Limitations: - ROOT only gives you a number. It doesn't tell you if the number makes any sense. For example, using ROOT on 'Y=ABS(X)', solving for X when Y is -10, gives you 8E-11. Using the SOLVER on 'Y=ABS(X)' tells you that there is an extremum (local minimum) at X=-8E-4. - ROOT cannot be used as an algebraic, of the form ROOT('PLANE','X',0). Other observations: - The programmable ROOT does not use or modify EQ. - It appears that ROOT is called as a subroutine by the SOLVER and by the PLOTTER's root-finding functions. Can someone confirm this? - The programmable ROOT appears in only one paragraph, on page 256 of the Owner's Manual. It has an entry on page 782 of the Operation Index, but it cannot be found at all in the Subject Index. I don't have my Prgrammer's Reference Manual handy, but it may have more information about ROOT. I hope this helps you. Good luck. >Is there anybody out there ? Nobody here but us chickens! ----------- Regards Ray Depew rrd@hpfitst1.hp.com Disclaimer: I don't make calculators, I just use them, like the rest of you.