HP Voyager Programs
For HP-15C
Author: | Mitch Richling |
Updated: | 2025-04-30 |
Generated: | 2025-04-30 |
Copyright © 2025 Mitch Richling. All rights reserved.
1. Introduction
The HP-15C was designed over 40 years ago. By modern standards it is missing many features found in scientific calculators today; however, the HP-15C is far more efficient than modern machines.
- Fewer keystrokes
- Calculations that require half a dozen keystrokes on the HP-15C might take a couple dozen keystrokes on a modern calculator.
- All functionality directly available from the keyboard
- Not only do modern machines require more keystrokes, but many of those keystrokes are for navigating through menus. On the HP-15C everything is no more than a couple keystrokes away.
- Great keyboard
- The layout is designed for speed. Mechanically it doesn't bounce or cause double entries. It has tactical feedback to confirm key activation. These features mean long time HP-15C users can stay focused on the problem at hand while touch typing problems into the machine.
Most of the time I preform calculations with specialized mathematical software. Still each day brings a plethora of little, ad-hoc engineering computations for which the HP-15C is simply the fastest way to hammer out an answer – this is what keeps the HP-15C on my desk.
- Most of the programs found here are all about efficiency:
- Efficient replacements for STO/RCL with complex numbers
- Reducing the tedium of matrix computations.
- Only one is about new functionality:
- Newton's method for functions of a complex variable
Table of Contents
2. Store & Recall Complex Numbers
The official user guide has a pair of example programs capable of storing and recalling complex values using a matrix for storage. The programs here are similar except that they use registrars for storage – storing the real and complex parts in consecutive storage registers.
With respect to the stack, these programs attempt to behave like the built in STO
& RCL
functions:
- They both preserve the stack contents
- The
STO_CPLX
program leaves the item to be stored in theX
stack position
If the calculator is not already in complex mode, then it will be placed in complex mode by the program.
2.1. Usage
- Inputs:
STO_CPLX
: The number to store is on stack levelY
, and the first register index is on stack levelX
.
The real part ofY
is stored at the register indicated by the index in X, and the complex part ofY
is stored in the next consecutive register.RCL_CPLX
: The first register index is on stack levelX
.
- The result stack:
STO_CPLX
: The stack is shifted down so the register index is in stack positionT
.RCL_CPLX
: The register index in stack positionX
is replaced by the recalled complex number, and the other stack levels are left unchanged.
- Error Conditions
- Given register is out of bounds: An
Error 3
will be produced & the stack contents will be invalidated. - Given register plus one is out of bounds: An
Error 3
will be produced, the stack contents will be invalidated, and the value in the given register will be invalidated.
- Given register is out of bounds: An
2.2. Stack Diagrams
STO_CPLX
– Store Complex Number
Before | After | |
T : |
t | Reg Index |
Z : |
z | t |
Y : |
Cplx Number | z |
X : |
Reg Index | Cplx Number |
RCL_CPLX
– Recall Complex Number
Before | After | |
T : |
t | t |
Z : |
z | z |
Y : |
y | y |
X : |
Reg Index | Cplx Number |
2.3. Resources Used
- Entry Point Labels:
- E RCL_CPLX –
STO_CPLX
on the left andRCL_CPLX
on the right – just like the STO & RCL buttons - D STO_CPLX
- E RCL_CPLX –
- Internal Labels:
- None
- External Labels:
- None
- Registers Used:
- Two consecutive registers are used.
- The first has its index on level
X
of the stack
- Matrices:
- None
2.4. Program Listing
STO_CPLX
– Store Complex Number
Keystrokes | Key Codes | Stack Contents | Comments | ||
f LBL D | 42,21,14 |
x y z t | |||
STO I | 44 25 |
x y z t | |||
R↓ | 33 |
y z t x | |||
STO (i) | 44 24 |
y z t x | |||
f ISG I | 42, 6,25 |
y z t x | |||
g CLx | 43 35 |
y z t x | NOP | ||
f Re≷Im | 42 30 |
~y z t x | |||
STO (i) | 44 24 |
~y z t x | |||
f Re≷Im | 42 30 |
y z t x | Ret | ||
g RTN | 43 32 |
RCL_CPLX
– Recall Complex Number
Keystrokes | Key Codes | Stack Contents | Comments | ||
f LBL E | 42,21,15 |
x y z t | |||
STO I | 44 25 |
x y z t | |||
R↓ | 33 |
y z t x | |||
RCL (i) | 45 24 |
Cr y z t | |||
f ISG I | 42,6,25 |
Cr y z t | |||
g CLx | 43 35 |
Cr y z t | NOP | ||
f Re≷Im | 42 30 |
~Cr y z t | |||
g CLx | 43 35 |
~Cr y z t | Disable stack | ||
RCL (i) | 45 24 |
~C y z t | |||
f Re≷Im | 42 30 |
C y z t | Ret | ||
g RTN | 43 32 |
3. Newton's Method for Functions of a Complex Variable
Newton's method is an iterative root finding algorithm. From an initial guess for a root, the method generates a sequence of guesses that, if we are fortunate, converge to a root.
My primary intent for this program is to provide a good example illustrating STO_CPLX
& RCL_CPLX
in a program, and thus the implementation super simple
using no registers or internal labels. This implementation doesn't check for division by zero (small derivative). It also performs no convergence checks and
will happily loop forever. As simple as it is, I keep it on my calculator because works pretty well.
In what follows, the function we are solving is referred to as \(f(x)\) and the initial guess is referred to as \(x_0\). The final guess is referred to as \(x_n\).
If the calculator is not already in complex mode, then it will be placed in complex mode by the program.
3.1. Usage
- Running the program
- Stack Arguments:
T
best guess for root (\(x_0\))Z
best guess for root (\(x_0\))Y
best guess for root (\(x_0\))X
best guess for root (\(x_0\))
- Function to solve:
- Must be LBL 1
- When called, \(x\) will be on every level of the stack
- Returns \(f(x)\) to stack level
X
and \(f'(x)\) to stack levelY
.- Note this makes the program implementing \(f(x)\) compatible with the built in SOLVE and ∫ functions.
- At least one Newton iteration will always be executed allowing the program to refine a previously returned root one step at a time.
- Stack Arguments:
- Exit Information
- Exit Stack State:
T
: \(f(x_n)\) Function value at \(x_n\)Z
: \(|f(x_n)|\) Function magnitude at \(x_n\) – which will always be less than or equal to \(\epsilon=10^{-7}\).Y
: \(x_{n+1}\) The next iteration of Newton's method. Normally a refined root; however, there is no guarantee.X
: \(x_n\) Root guess
- Exit Register State:
- 8 \(\Re(x_n)\)
- 9 \(\Im(x_n)\)
- Non-normal Exits:
- Convergence failure: In this case the program should be interrupted by the user. The last guess will likely be stored in registers 8 & 9, but this is not guaranteed!
- Evaluation error: If the function causes an error during evaluation, the program will stop. The last guess will be stored in 8 & 9.
- Zero Derivative: If the derivative is zero, then an "
Error 0
" will occur. The last guess will be stored in 8 & 9.
- Exit Stack State:
3.2. Resources Used
- Entry Point Label:
- C Program label
- Internal Labels:
- None
- External Labels:
- 1 function to solve
- E
RCL_CPLX
- D
STO_CPLX
- Registers Used:
- 8 Real component of root guess
- 9 Complex component of root guess
- Matrices:
- None
3.3. Program Listing
NEWTON
– Newton's Method for a Function of a Complex Variable
Keystrokes | Key Codes | Stack Contents | Comments | ||
f LBL C | 42,21,13 |
? ? x0 ? | |||
R↓ | 33 |
? x0 ? ? | |||
R↓ | 33 |
x0 ? ? ? | |||
8 | 8 |
8 x0 ? ? | |||
GSB D | 32 14 |
x0 ? ? 8 | STO_CPLX | ||
ENTER | 36 |
x0 x0 ? ? | x0=Current iterate | ||
ENTER | 36 |
x0 x0 x0 ? | |||
ENTER | 36 |
x0 x0 x0 x0 | |||
GSB 1 | 32 1 |
f df ? ? | f=f(x0), df=f'(x0) | ||
ENTER | 36 |
f f df ? | |||
ENTER | 36 |
f f f df | |||
g R↑ | 43 33 |
df f f f | |||
÷ | 10 |
dx f f f | dx=Delta x | ||
8 | 8 |
8 dx f f | |||
GSB E | 32 15 |
x0 dx f | RCL_CPLX | ||
- | 30 |
-x1 f f f | x1=Next iterate | ||
CHS | 16 |
x1 f f f | |||
g R↑ | 43 33 |
f x1 f f | |||
g ABS | 43 16 |
fM x1 f f | fM=abs(f(x0)) | ||
7 | 7 |
7 fM x1 f | |||
CHS | 16 |
-7 fM x1 f | |||
10ˣ | 13 |
e fM x1 f | e=Epsilon | ||
g TEST 8 | 43,30, 8 |
e fM x1 f | y>x? | ||
GTO C | 22 .1 |
e fM x1 f | |||
R↓ | 33 |
fM x1 f e | |||
x≷y | 34 |
x1 fM f e | |||
8 | 8 |
8 x1 fM f | |||
GSB E | 32 15 |
x0 x1 fM f | RCL_CPLX | ||
g RTN | 43 32 |
x0 x1 fM f |
4. Matrix Helpers
These programs don't do anything the HP-15C can't already do. They serve two purposes: 1) Reduce the number of keystrokes required, and 2) Free the user from remembering the strange incantations required to work with complex matrices.
4.1. Fill a Matrix
4.1.1. Usage
This program, STO_MAT
, provides a fast way to dimension & fill a real or complex matrix. This program can Generally reduce keystroke overhead in half.
When flag 8 is clear, the real part of the value in the X
stack level is placed in consecutive matrix elements.
When flag 8 is set, the program provides extra help in filling a C
format complex matrix. In this case, the real & complex parts of the
number in the X
stack level are used to fill consecutive matrix elements. If all the matrix elements are known in advance and in rectangular format, then
fewer keystrokes will be required with 8 clear:
flag 8 | Keystrokes per matrix element |
---|---|
clear | real_part R/S imag_part R/S |
set | real_part ENTER imag_part I R/S |
That said, setting flag 8 is very useful if some computation with the elements is required before we store them – like converting them to rectangular form with →R.
- Operation
- Run the program with the following inputs:
Z
: A matrix descriptor or number0
(a0
indicates the A matrix should be used)Y
: number of rowsX
: Number of columns
- The matrix element coordinate will appear on the display in
r.c
format. - The previously entered element, if there was one, will be on level
Y
of the stack. - Enter the value for the matrix position and press R/S.
- If flag 8 is set, then the real and complex parts will be placed into the matrix in consecutive positions.
- Repeat until all the matrix elements have been entered.
- Note the program never ends – it just wraps back to the start.
- Run the program with the following inputs:
4.1.2. Resources Used
- Entry Point Label:
- 7
STO_MAT
–STO_MAT
on the left andRCL_MAT
on the right – just like the STO & RCL buttons.
- 7
- Internal Labels:
- .1 Main loop target
- .2 Complex if target
- External Labels:
- None
- Flags:
- 8 Option flag (complex mode)
- 9 CF used as NOP
- Registers Used:
- 0 Matrix indexing
- 1 Matrix indexing
- I Matrix descripter
- Matrices:
- Matrix on stack level
X
when the program starts, or matrix A ifX
was zero.
- Matrix on stack level
4.1.3. Program Listing
MAT_STO
– Dimension & fill a Matrix
Keystrokes | Key Codes | Stack Contents | Comments | ||
f LBL 7 | 42,21, 7 |
n m MATor0 t | |||
RCL MATRIX A | 45,16,11 |
A n m MATor0 | |||
STO I | 44 25 |
A n m MATor0 | |||
g R↑ | 43 33 |
MATor0 A n m | |||
g TEST 0 | 43,30, 0 |
MATor0 A n m | |||
STO I | 44 25 |
A A n m | Sto given matrix descriptor in I | ||
R↓ | 33 |
A n m MATor0 | |||
R↓ | 33 |
n m MATor0 A | |||
f DIM I | 42,23,25 |
n m MATor0 A | Dim given matrix | ||
f MATRIX 1 | 42,16, 1 |
n m MATor0 A | Set R0 & R1 to 1 | ||
LBL . 1 | 42,21,.1 |
?orXp ? ? ? | Ep – previously entered element | ||
. | 48 |
- ?orXp ? ? | |||
1 | 1 |
1 ?orXp ? ? | |||
RCL × 1 | 45,20, 1 |
j/10 ?orXp ? ? | |||
RCL + 0 | 45,40, 0 |
j/10+i ?orXp ? ? | |||
R/S | 31 |
j/10+i ? ? ? | |||
f USER STO (i) | u 44 24 |
Xr ? ? ? | |||
f USER | - | Xr ? ? ? | Exit USER mode | ||
g CF 9 | 43, 5, 9 |
Xr ? ? ? | NOP | ||
g F? 8 | 43, 6, 8 |
Xr ? ? ? | |||
GTO . 2 | 22 .2 |
Xr ? ? ? | |||
GTO . 1 | 22 .1 |
Xr ? ? ? | |||
f LBL . 2 | 42,21,.2 |
Xr ? ? ? | |||
f Re≷Im | 42 30 |
Xc ? ? ? | |||
f USER STO (i) | u 44 24 |
Xc ? ? ? | |||
f USER | - | Xc ? ? ? | Exit USER mode | ||
g CF 9 | 43, 5, 9 |
Xc ? ? ? | NOP | ||
f Re≷Im | 42 30 |
Xr ? ? ? | So Xp will be in Y for R/S |
||
GTO . 1 | 22 .1 |
Xr ? ? ? | |||
g RTN | 43 32 |
? ? ? ? | Never Get Here |
4.2. Dump a Matrix
4.2.1. Usage
This program, RCL_MAT
, provides a fast way iterate over the elements of a real or complex matrix.
- Operation
- Run the program with the following inputs:
X
: A matrix descriptor or number0
(a0
indicates the RESULT matrix should be used)
- Each element of the matrix will be displayed. Press R/S to advance.
- The program will wrap around to the first element after the last one is displayed – this is a feature.
- If flag 8 is set, then pairs of elements are pulled from the matrix (i.e.
C
format) and placed on the stack as complex numbers
- Run the program with the following inputs:
4.2.2. Resources Used
- Entry Point Label:
- 8
RCL_MAT
–STO_MAT
on the left andRCL_MAT
on the right – just like the STO & RCL buttons.
- 8
- Internal Labels:
- .3 Main loop target
- .4 Complex if target
- External Labels:
- None
- Flags:
- 8 Option flag (complex mode)
- 9 CF used as NOP
- Registers Used:
- 0 Matrix indexing
- 1 Matrix indexing
- I Matrix descripter
- Matrices:
- Matrix on stack level
X
when the program starts, or RESULT ifX
was zero.
- Matrix on stack level
4.2.3. Program Listing
MAT_RCL
– Dump a Matrix
Keystrokes | Key Codes | Stack Contents | Comments | ||
f LBL 4 | 42,21, 4 |
MATor0 y z t | |||
RCL RESULT | 45 26 |
RESULT MATor0 y z | |||
STO I | 44 25 |
RESULT MATor0 y z | |||
R↓ | 33 |
MATor0 y z RESULT | |||
g TEST 0 | 43,30, 0 |
MATor0 y z RESULT | |||
STO I | 44 25 |
MATor0 y z RESULT | |||
f MATRIX 1 | 42,16, 1 |
MATor0 y z RESULT | Set R0 & R1 to 1 | ||
LBL . 3 | 42,21,.3 |
? ? ? ? | |||
f USER RCL (i) | u 45 24 |
M(i)_r ? ? ? | |||
f USER | - | M(i)_r ? ? ? | Exit USER mode | ||
g CF 9 | 43, 5, 9 |
M(i)_r ? ? ? | NOP | ||
g F? 8 | 43, 6, 8 |
M(i)_r ? ? ? | |||
GTO . 4 | 22 .4 |
M(i)_r ? ? ? | |||
R/S | 31 |
M(i)_r ? ? ? | |||
GTO . 3 | 22 .3 |
M(i)_r ? ? ? | |||
f LBL . 4 | 42,21,.4 |
M(i)_r ? ? ? | |||
f USER RCL (i) | u 45 24 |
M(i)_c ? ? ? | |||
f USER | - | M(i)_c ? ? ? | Exit USER mode | ||
g CF 9 | 43, 5, 9 |
M(i)_c ? ? ? | NOP | ||
f I | 42 25 |
M(i)_r ? ? ? | |||
R/S | 31 |
M(i)_r ? ? ? | |||
GTO . 3 | 22 .3 |
M(i)_r ? ? ? | |||
g RTN | 43 32 |
N/A | Never Get Here |
4.3. Solve Linear System
4.3.1. Usage
This program solves the system \(AX=B\) for \(X\).
- Program start conditions
- The \(A\) matrix is stored in A.
- It may be an \(n\times n\) real matrix, or an \(n\times 2n\) complex matrix in
C
format. - The program determines real vs. complex from the matrix size – not the setting of flag 8.
- It may be an \(n\times n\) real matrix, or an \(n\times 2n\) complex matrix in
- The \(B\) matrix is stored in B.
- Flag 1 is set appropriately:
- Clear: Use more memory, but preserve contents of A.
- Set: Use less memory, but destroy contents of A.
- The \(A\) matrix is stored in A.
- Program end conditions
- The system "solution", \(X\), will be in C. Note this might not be a valid solution if \(A\) is singular!
- B is left unchanged!
- The matrix descriptor for C will be in stack position
Y
. - Matrix C will be selected as the RESULT matrix.
- Both registers 0 & 1 will contain 1 in expectation USER mode will be used to visit the elements of C.
- If \(A\) is a real matrix:
- Flag 0 will be clear
- \(\mathrm{det}(A)\) is in stack position X
- The LU factorization of \(A\) is in E when flag 1 is clear, and in A otherwise
- If \(A\) is a complex matrix
- Flag 0 will be set
- \(\vert\mathrm{det}(A)\vert\) is in stack position
X
. - The LU factorization of \(\tilde{A}\) is in E when flag 1 is clear, and in A otherwise
4.3.2. Resources Used
- Entry Point Label:
- 8 Program label
- Internal Labels:
- None
- External Labels:
- 9 Subroutine to compute determinant
- Flags:
- 0 Status flag
- 1 Option flag
- Registers:
- None
- Matrices:
- A
- B
- C Used for the solution
- E Only when flag 1 is clear
4.3.3. Program Listing
LIN_SLV
– Solve \(AX=B\)
Keystrokes | Key Codes | Stack Contents | Comments | ||
f LBL 8 | 42,21, 8 |
x y z t | |||
GSB 9 | 32 9 |
DET(A)orABS(DET(A)) ? ? ? | |||
RCL MATRIX B | 45,16,12 |
BorBc DET(A)orABS(DET(A)) ? ? | |||
g F? 0 | 43, 6, 0 |
BorBc DET(A)orABS(DET(A)) ? ? | |||
f Py,x | 42 40 |
BorBp DET(A)orABS(DET(A)) ? ? | |||
RCL RESULT | 45 26 |
LU~ BorBp DET(A)orABS(DET(A)) ? | |||
f RESULT C | 42,26,13 |
LU~ BorBp DET(A)orABS(DET(A)) ? | |||
÷ | 10 |
CorCp DET(A)orABS(DET(A)) ? ? | |||
g F? 0 | 43, 6, 0 |
CorCp DET(A)orABS(DET(A)) ? ? | |||
g Cy,x | 43 40 |
CorCc DET(A)orABS(DET(A)) ? ? | |||
x≷y | 34 |
DET(A)orABS(DET(A)) CorCc ? ? | |||
f MATRIX 1 | 42,16, 1 |
DET(A)orABS(DET(A)) CorCc ? ? | |||
RCL MATRIX B | 45,16,12 |
BorBp DET(A)orABS(DET(A)) CorCc ? | |||
g F? 0 | 43, 6, 0 |
BorBp DET(A)orABS(DET(A)) CorCc ? | |||
g Cy,x | 43 40 |
BorBc DET(A)orABS(DET(A)) CorCc ? | |||
R↓ | 33 |
DET(A)orABS(DET(A)) CorCc ? BorBc | |||
g RTN | 43 32 |
DET(A)orABS(DET(A)) CorCc ? BorBc |
4.4. Matrix Determinants
This program computes the determinant of a real matrix or the magnitude of the determinant for a complex matrix. The use case is to determine if a matrix is singular.
4.4.1. Usage
- Program start conditions
- The \(A\) matrix is assumed to be in A.
- It may be an \(n\times n\) real matrix, or an \(n\times 2n\) complex matrix in
C
format. - The program determines real vs. complex from the matrix size.
- It may be an \(n\times n\) real matrix, or an \(n\times 2n\) complex matrix in
- flag 1 is set appropriately:
- Clear: Use more memory, but preserve contents of A.
- Set: Use less memory, but destroy contents of A.
- The \(A\) matrix is assumed to be in A.
- Program end conditions
- The previous contents of the stack are lost
- If flag 1 is clear
- A is left unchanged!
- RESULT matrix set as E
- If flag 1 is set
- RESULT matrix set as A
- \(A\) is a real matrix
- Flag 0 will be clear
- The \(\mathrm{det}(A)\) is in stack position
X
. - The LU factorization of \(A\) is in E when flag 1 is clear, and in A otherwise
- If \(A\) is a complex matrix
- Flag 1 will be set
- \(\vert\mathrm{det}(A)\vert\) is in stack position
X
. - The LU factorization of \(\tilde{A}\) is in E when flag 1 is clear, and in A otherwise
4.4.2. Resources Used
- Entry Point Label:
- 9 Program label
- Internal Labels:
- None
- .9 Conditional label
- External Labels:
- N/A
- Flags:
- 0 exit flag
- 1 option flag
- Registers:
- N/A
- Matrices:
- A
- E Only when flag 1 is clear
4.4.3. Program Listing
DET_A
– Determinant of real A or magnitude of determinant of complex A
Keystrokes | Key Codes | Stack Contents | Comments | ||
f LBL 9 | 42,21, 9 |
x y z t | |||
f RESULT E | 42,26,15 |
x y z t | |||
g F? 1 | 43, 6, 1 |
x y z t | |||
f RESULT A | 42,26,11 |
x y z t | |||
RCL DIM A | 45,23,11 |
n m x y | |||
g TEST 5 | 43,30, 5 |
n m x y | |||
GTO . 9 | 22 .9 |
n m x y | |||
g SF 0 | 43, 4, 0 |
n m x y | |||
RCL MATRIX A | 45,16,11 |
A n m x | |||
f Py,x | 42 40 |
Ap n m x | |||
f MATRIX 2 | 42,16, 2 |
A~ n m x | |||
f MATRIX 9 | 42,16, 9 |
SQ(ABS(DET(A))) n m x | |||
g ABS | 43 16 |
SQ(ABS(DET(A))) n m x | If roundoff made it negative | ||
√x | 11 |
ABS(DET(A)) n m x | |||
F? 1 | 43, 6, 1 |
ABS(DET(A)) n m x | |||
g RTN | 43 32 |
ABS(DET(A)) n m x | Rtn when A cplx & flag 1 set | ||
RCL MATRIX A | 45,16,11 |
A~ ABS(DET(A)) n m | Restore A to Ac form | ||
f MATRIX 3 | 42,16, 3 |
Ap ABS(DET(A)) n m | |||
g Cy,x | 43 40 |
Ac ABS(DET(A)) n m | |||
R↓ | 33 |
ABS(DET(A)) x y Ac | |||
g RTN | 43 32 |
ABS(DET(A)) Cc x x | Rtn when A cplx & flag 1 clear | ||
LBL . 9 | 42,21,.9 |
n m x y | |||
g CF 0 | 43, 5, 0 |
n m x y | |||
RCL MATRIX A | 45,16,11 |
A n m x | |||
f MATRIX 9 | 42,16, 9 |
DET(A) n m x | |||
g RTN | 43 32 |
DET(A) n m x | Rtn when A real |
5. Quadratic Equation
Find the discriminant and both roots of
\[ax^2+bx+c=0\]
The coefficients may be real or complex. Complex mode will automatically be enabled if required. This program consumes no storage registers or internal labels. It requires 31 program lines consuming 32 bytes (if I counted correctly).
5.1. Usage
- Running the program
- Stack Arguments:
Z
\(a\)Y
\(b\)X
\(c\)
- Stack Arguments:
- Exit Information
- Exit Stack State:
T
: Quadratic DiscriminantZ
: Quadratic DiscriminantY
: Second RootX
: First Root
- Exit Flag State:
- If the roots are complex, then 8 will be automatically set
- Non-normal Exits:
- If \(\vert a\vert=0\), then the program will "
Error 0
".
- If \(\vert a\vert=0\), then the program will "
- Exit Stack State:
5.2. Resources Used
- Entry Point Labels:
- B SOLVE_QUAD
- Internal Labels:
- None
- External Labels:
- None
- Flags:
- 8 Option flag (complex mode)
- Registers Used:
- None
- Matrices:
- None
5.3. Program Listing
SOLVE_QUAD
– Solve a quadratic equation
Keystrokes | Key Codes | Stack Contents | Comments | ||
f LBL B | 42,21,12 |
c b a ? | |||
4 | 4 |
4 c b a | |||
× | 20 |
4*c b a a | |||
g R↑ | 43 33 |
a 4*cb a | |||
÷ | 10 |
4*c/a b a a | |||
x≷y | 34 |
b 4*c/a a a | |||
g R↑ | 43 33 |
a b 4*c/a a | |||
÷ | 10 |
b/a 4*c/a a a | |||
ENTER | 36 |
b/a b/a 4*c/a a | |||
CHS | 16 |
-b/a b/a 4*c/a a | |||
2 | 2 |
2 -b/a b/a 4*c/a | |||
÷ | 10 |
-b/a/2 b/a 4*c/a 4*c/a | |||
R↓ | 33 |
b/a 4*c/a 4*c/a -b/a/2 | |||
g x² | 43 11 |
(b/a)^2 4*c/a 4*c/a -b/a/2 | |||
- | 30 |
-D 4*c/a -b/a/2 -b/a/2 | |||
CHS | 16 |
D 4*c/a -b/a/2 -b/a/2 | |||
x≷y | 34 |
4*c/a D -b/a/2 -b/a/2 | Save off Discriminant | ||
R↓ | 33 |
D -b/a/2 -b/a/2 4*c/a | Save off Discriminant | ||
ENTER | 36 |
D D -b/a/2 -b/a/2 | Save off Discriminant | ||
g TEST 2 | 43,30, 2 |
D D -b/a/2 -b/a/2 | |||
g SF 8 | 43, 4, 8 |
D D -b/a/2 -b/a/2 | D<0 -> complex mode | ||
√x | 11 |
√D D -b/a/2 -b/a/2 | |||
2 | 2 |
2 √D D -b/a/2 | |||
÷ | 10 |
√D/2 D -b/a/2 -b/a/2 | |||
g R↑ | 43 33 |
-b/a/2 √D/2 D -b/a/2 | |||
x≷y | 34 |
√D/2 -b/a/2 D -b/a/2 | |||
- | 30 |
R1 D -b/a/2 | |||
g LSTx | 43 36 |
√D/2 R1 D -b/a/2 | |||
g R↑ | 43 33 |
-b/a/2 √D/2 R1 D | |||
+ | 40 |
R2 R1 D D | |||
g RTN | 43 32 |
R2 R1 D D |
6. Summary Resource Use
6.1. Labels
My general strategy for using labels is as follows:
Registers | Use In Programs |
---|---|
A - E | Frequently called programs |
0 | Unused |
1 - 3 | Solver/Integrator programs |
4 - 5 | Unused |
6 - 9 | Matrix stuff |
.0 | Unused |
.1 - .9 | Internal lables |
6.1.1. Label Assignments
LBL | Use | Used By |
---|---|---|
A | - | |
B | Solve Quadratic | |
C | Complex Newton's Method | |
D | Store Complex Number | C |
E | Recall Complex Number | C |
0 | - | |
1 | Solver/Integrator/Newton | C |
2 | Solver/Integrator | |
3 | Solver/Integrator | |
4 | - | |
5 | - | |
6 | Solve Linear System | |
7 | Fill A Matrix | |
8 | Dump A Matrix | |
9 | Determinant | 6 |
.0 | - | |
.1 | Internal | 7 |
.2 | Internal | 7 |
.3 | Internal | 8 |
.4 | Internal | 8 |
.5 | - | |
.6 | - | |
.7 | - | |
.8 | - | |
.9 | - |
6.2. Registers
How I normally use register storage.
Registers | Use In Programs | Interactive Use |
---|---|---|
0 - 1 | Always for matrix indexes\(^1\) | Whatever, but usually as matrix indexes |
2 - 7 | Always for statistics\(^1\) | Whatever, but usually for statistics |
8 - 9 | User visible program registers | Whatever, but usually for programs |
.0 | Temporary storage | Whatever, but usually for programs |
.1 - .6 | Whatever | Whatever |
.7 - .9 | Unit conversion factors\(^2\) | Unit conversion factors |
- I avoid using the matrix & staticial registers in programs because I ocassionally use matrix & statstical functions in solver programs. For example, if I had used these registers in the Complex Newton's Method program then I wouldn't be able to do that.
- Conversions: in to cm, lb to kg, US gal to liters. Keys
7
to9
mirror unit conversion keys on another calculator.;)
6.3. Matrix Registers
How I normally use matrix storage. These habits have strongly influenced the matrix helper routines.
MATRIX | Use |
---|---|
A | Determinants & LHS of matrix equations (\(AX=B\)) |
B | RHS of matrix equations (\(AX=B\)) |
C | Solution for \(AX=B\) |
D | Unused |
E | \(LU\) of \(A\) for determinants & matrix equations when flag 1 is clear |
6.4. Flags
Flag | Use |
---|---|
0 | Inter program status messages |
1 | Externally visable program options |
2 - 7 | Unused |
8 | System flag: complex mode |
9 | System flag: overflow |
6.5. Program Steps
I normally keep STO_CPLX
, RCL_CPLX
, NEWTON
, STO_MAT
, RCL_MAT
, LIN_SLV
, and DET_A
in program memory. This results in 143 lines of program memory
consumed by the programs. I then add three zeros at the end as a little pad to separate my permanent programs from whatever I may add to the end of program
memory.
Step | Key Codes | Keystrokes | Use |
---|---|---|---|
001 | 42 21 14 |
f LBL D | Store Complex Number |
011 | 42 21 15 |
f LBL E | Recall Complex Number |
022 | 42 21 13 |
f LBL C | Complex Newton's Method |
051 | 42 21 7 |
f LBL 7 | Fill A Matrix |
079 | 42 21 8 |
f LBL 8 | Dump A Matrix |
100 | 42 21 6 |
f LBL 6 | Solve Linear System |
117 | 42 21 9 |
f LBL 9 | Determinant |
143 | 0 |
0 | Padding |
144 | 0 |
0 | Padding |
145 | 0 |
0 | Padding |
146 | N/A | N/A | Solver programs etc… |
7. Downloads
I regularly use Torsten Manz's excellent HP-15C simulator on Windows & Linux. It can load and save programs written in a simple Unicode file format and it can also create "memory image" files that may be loaded on the HP-15CE, DM15C, & DM15L calculators! I can't recommend it highly enough.
On Android I use Bill Foote's JRPN HP-15 simulator which is capable of using the source program files Manz's simulator writes so I can keep my programs synced between my phone, tablet, and laptop!
- My normal program load as described above:
SOLVE_QUAD
source code
8. Meta Data
The primary URL for this page: https://richmit.github.io/voyager/hp15.html
The org mode file for this page: https://github.com/richmit/voyager/blob/main/docs/hp15.org
The HTML file for this page: https://github.com/richmit/voyager/blob/main/docs/hp15.html
The github repository housing this content: https://github.com/richmit/voyager/