SOLVE/INTEG with MISO functions on HP15/34/41 Message #21 Posted by Karl Schneider on 24 Sept 2005, 2:19 a.m., in response to message #20 by Karl Schneider
Note: This is a first draft of material developed for an MoHPC Article that I announced an intention about 30 months ago to write. Comments are welcome and encouraged. If anyone can suggest a more practical equation for illustration, please suggest. The equation should be both solvable and integratable with reasonable calculation times.
======================================================
Using SOLVE and INTEG with MISO functions on HP15C, HP34C, and HP41C/CV/CX
BACKGROUND OF "SOLVE" and "INTEG":
Numerical rootfinding ("SOLVE") and numerical integration ("INTEG") of single variables were builtin or made available as sophisticated machinecoded functions on seven RPNbased HewlettPackard scientific calculator models.
SOLVE and INTEG are present on the following models:
 HP34C
 HP15C
 HP41C/CV/CX with Advantage Pac
 HP32S
 HP42S
 HP32SII
 HP33S
(Excluded from this list are the RPLbased models, the algebraicentry models, and the HP71B with Math ROM.)
The SOLVE and INTEG functions were introduced in their original paradigm on the HP34C in 1979, and later carried over to the HP15C in 1982. For the HP41C/CV/CX, the same functions were adapted with only slight modification in the Advantage Pac introduced in 1985.
Two fine articles regarding SOLVE and INTEG on the HP34C appeared in HP Journal in 1979 and 1980, respectively. These are available on CD Volume 3 and the DVDROM from the MoHPC.
This original paradigm requires that the function to be solved or integrated, be programmed as an RPN routine. The routine must be designed to accept an input value of the variable to be solved or integrated in the stack xregister, and to return the calculated value of the function to the xregister. This user program is executed repeatedly by the SOLVE or INTEG function in order to calculate the desired result. Moreover, the program may include a SOLVE or INTEG instruction, thus allowing INTEG to be executed within SOLVE, or vice versa. This capability, incidentally, was not provided on the successor Pioneerseries models HP32S and HP32SII, or on the present HP33S.
STORAGE OF VARIABLES; MISO AND SISO FUNCTIONS
Storage registers for variables on the HP32S, HP32SII, and HP33S are designated by single letters. The Pioneerseries HP42S allowed alphanumeric identifiers for variables. SOLVE and INTEG on all four of these models require the user to specify (by letter or name) the root variable to SOLVE or the dummy variable of integration to INTEG. This feature is wellsuited for multipleinput, singleoutput (MISO) functions.
The 34C, 15C, and 41C/CV/CX, however, provided only numbered and "indirect" storage registers. The paradigm of SOLVE and INTEG on these models was designed primarily for single input, singleoutput (SISO) functions. It does not require that the input variable even be stored to a register.
TO USE 34C/15C/41C "SOLVE" AND "INTEG" WITH MISO FUNCTIONS:
Assume that a MISO function is to be programmed as an RPN routine on a HP34C, HP15C, or HP41C/CV/CX. A user may wish to use SOLVE or INTEG successively for any selected "focus" variable with all others held constant, and without having to edit the RPN routine. Here is a simple procedure for this purpose:
1. Designate a numbered storage register for each variable in the function.
2. On the 41C/CV/CX, designate another numbered register as the indirect storage register. (Do not use a stack register, as it will be overwritten by SOLVE or INTEG.)
In PROGRAM mode:
3. Program the function as an RPN routine that meets the basic requirements and, also, always retrieves each variable from its designated storage register the first time it is used. (On the 41C/CV/CX, the label beginning the routine must be an external label.)
4. The second instruction of the routine (after LBL) should be "store to indirectlyreferenced register". This is "STO (i)" on the 34C and 15C; "STO IND nn" on the 41C/CV/CX.
In RUN mode:
5. Store the desired constant values of the fixedvalue variables to their storage registers.
6. Store the register number containing the floating variable to the indirect storage register.
7. Invoke SOLVE or INTEG in the usual manner.
This procedure utilizes indirect storage to make the RPN program more flexible. SOLVE and INTEG feed the each value of the floating variable as input to the user program, which immediately stores the value indirectly to its designated register. Each variable in the function is then recalled for use in calculations, so the user program need not be structured to receive any particular variable from the stack.
EXAMPLES:
f(x, y, z) = 2*x  ln y + 1/z
x in R1; y in R2; z in R3
indirect in R00 (HP41 only)
HP15C/HP34C program: HP41C/CV/CX program:
LBL A LBL "AA"
STO (i) STO IND 00
RCL 1 RCL 01
2 2
* *
RCL 2 RCL 02
LN LN
 
RCL 3 RCL 03
1/x 1/x
+ +
RTN RTN
In RUN mode, solve for x such that f(x, y=15.1, z=5.3) = 0
HP15C/HP34C: HP41C/CV/CX:
15.1 15.1
STO 2 STO 02
5.3 5.3
STO 3 STO 03
1 1
STO I STO 00
0.5 0.5
ENTER ENTER
5 5
SOLVE A "AA" (enter AA in alpha mode)
XEQ "SOLVE"
(Answer is 1.263007749)
Next, solve for y such that f(x=0.7, y, z=3.3) = 0
HP15C/HP34C: HP41C/CV/CX:
0.7 0.7
STO 1 STO 01
3.3 3.3
STO 3 STO 03
2 2
STO I STO 00
0.5 0.5
ENTER ENTER
6 6
SOLVE A "AA" (enter AA in alpha mode)
XEQ "SOLVE"
(Answer is 5.490560270)
Finally, integrate f(x=1.7, y=4.1, z) over z = 1.0 to 6.0.
Specify 5 decimaldigit absolute function accuracy:
HP15C/HP34C: HP41C/CV/CX:
FIX 5 FIX 5
1.7 1.7
STO 1 STO 01
4.1 4.1
STO 2 STO 02
3 3
STO I STO 00
1 1
ENTER ENTER
6 6
INTEG A "AA" (enter AA in alpha mode)
XEQ "INTEG"
(answer is 11.73682)
Edited: 28 Sept 2005, 2:48 a.m.
