Solvers in 27S and 42S - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: Solvers in 27S and 42S (/thread-101574.html) Solvers in 27S and 42S - Anders - 10-25-2006 Hi all, I have a 27S for daily use and think the Solver function is really great and easy to use. I'm thinking about buying a 42S to get the matrix functions and programmability, but I wonder if the Solver in that one is of the same kind as in the 27S? Any info would be greatly appreciated! Best regards, Anders Re: Solvers in 27S and 42S - bill platt - 10-25-2006 Well, it is not the same interface. The 42s does *not* support algebraic entities or equations. In the 42s, you havea a 100% RPN notation sequence. Of course what the solver can do is the same and more, as it has ll looping and conditionals as a full programming language. Re: Solvers in 27S and 42S - Anders - 10-25-2006 Thanks Bill. OK, just so I get a better understanding, how would the following alg expression (from the museum) be typed and work in the 42S solver? Alg:(1+infl)*(1+real)=(1+nom) Btw, is it possible on the 42S to call one Solver expressions from another Solver expression (like sub routines)? It's not on the 27S. And/Or can I call a user defined function from the 42S solver? Thanks again, Anders Re: Solvers in 27S and 42S - bill platt - 10-25-2006 OK. Anders, I take it you are not familiar with "classic" HP RPN programming? The 42s follows that classic structure. The solver is not in a separate "space" as it is in the 27s. Rather, you can call on the solver to solve any program you have written. The solver is a command. In this sense it is closest to the 34C, or the 15C. Because the 42S is a full RPN programmable, subroutines are of course fully available. A user-defined function is the same thing as a subroutine in a 42s. You just have to point to them in the main program with a GSB command. Classic RPN is a command line language. It is not a graphic interface like the 27s. It is a completely different "paradigm" from a 27s. If you have a new 33S, you have the ability to program exactly like a 42s, complete with the solver function, and you also havea an "equation list" which is somewhat like a 27s, except that you cannot edit each equation (you have to backspace). If you want to inexpensively learn how RPN programming works, that is one low-cost way to do it. Take a look at the 34C description here at the museum, and the 15C. There is some good stuff in there. Edited: 25 Oct 2006, 4:27 p.m. Re: Solvers in 27S and 42S - Thomas Okken - 10-25-2006 Quote: OK, just so I get a better understanding, how would the following alg expression (from the museum) be typed and work in the 42S solver? Alg:(1+infl)*(1+real)=(1+nom) Not to take anything away from Bill's response, but sometimes an example says more than 1,000 words. Here's how you would work with your equation on the HP-42S: First, you must write a program. This program declares its parameters using MVAR instructions, which must come immediately after the program's global label (i.e. its entry point). The MVAR instructions tell the HP-42S which names to display in the solver's menu. ``` 00 { 49-Byte Prgm } 01 LBL "ALG" 02 MVAR "INFL" 03 MVAR "REAL" 04 MVAR "NOM" 05 1 06 RCL+ "INFL" 07 1 08 RCL+ "REAL" 09 × 10 1 11 RCL+ "NOM" 12 - 13 .END. ``` After keying in this program, exit PRGM mode, and activate the solver: [Shift] [SOLVER]. A menu of programs will appear -- not of all the programs in memory, just the ones where a global (ALPHA) label is immediately followed by one or more MVAR commands. From this menu, select ALG. You will now get a second menu, containing the items INFL, REAL, and NOM. If you enter a number and then press one of those menu keys, the value from the X register is stored in the corresponding variable, exactly as if a STO command was executed (in fact, if you hold the menu key down, it will display STO "INFL" (or whichever variable you just chose)). After having stored the known variables, you can now solve for the unknown by pressing its menu key. Pressing a menu key immediately after another menu key executes a SOLVE command (as you can verify by holding the key down). The HP-42S will repeatedly invoke your program, showing the different values it tries for the unknown in the display. Note that your example was an equality. The HP-42S solver only finds zeroes of functions, but you can transform an equality into an equivalent function that the HP-42S can solve by simply subtracting one side of the equality from the other. Quote: Btw, is it possible on the 42S to call one Solver expressions from another Solver expression (like sub routines)? In HP-42S jargon, that question would be phrased as "is it possible to use the SOLVE function from a program that was itself invoked by the SOLVE function?" The answer, alas, is no. (Note that it *is* possible to use the INTEG command from a SOLVE function, and also the other way around, but the solver and integrator can both only deal with one function at a time -- in computer jargon: they are non-reentrant.) Quote:And/Or can I call a user defined function from the 42S solver? Technically, there is no such thing as a user-defined function on the HP-42S; the only things that the user can define are plain old RPN keystroke programs. However, there is no limitation on what a program invoked by the solver can do, compared to other HP-42S programs (apart from the aforementioned restriction of not being able to use the SOLVE function, and one should also be aware that the solver requires one RTN stack level). Happy solving! - Thomas Re: Solvers in 27S and 42S - Karl Schneider - 10-25-2006 Anders -- What Bill wrote is true, and I certainly can't surpass Thomas' excellent and detailed reply. However, I can offer some supplementary information in my HP Forum Archives article regarding HP SOLVE and INTEG on RPN-based models: -- KS Edited: 25 Oct 2006, 11:58 p.m. Re: Solvers in 27S and 42S - Marcus von Cube, Germany - 10-26-2006 Thomas, Quote: Quote:Btw, is it possible on the 42S to call one Solver expressions from another Solver expression (like sub routines)? In HP-42S jargon, that question would be phrased as "is it possible to use the SOLVE function from a program that was itself invoked by the SOLVE function?" The answer, alas, is no. (Note that it *is* possible to use the INTEG command from a SOLVE function, and also the other way around, but the solver and integrator can both only deal with one function at a time -- in computer jargon: they are non-reentrant.) I guess you misunderstood Anders slighly. As far as I understand he just wants to call one equation from another to build up mor ecomplicated equations. In this case, the answer is definitly YES. You can call one RPN routine from another by providing the correct parameters (in the named variables or on the stack, depending on the routine) and just calling it by its name. Marcus Re: Solvers in 27S and 42S - Anders - 10-26-2006 Hi all, thanks very much for your time and efforts - these answers are very helpful. What a great forum this is! Best regards, Anders