The Museum of HP Calculators

# Fast Quadratic Formula for the HP-41C

This program is Copyright © 1999 by Michael Harwood and may be freely used by permission.

This program is supplied without representation or warranty of any kind. Michael Harwood and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

## Rationale

The HP-41C manual has a program to solve the quadratic formula on page 181. However, this program requires the use of registers 01, 02, 03 and takes 38 lines. This is a shorter, faster version (19 lines) that only uses the stack.

## Usage

A quadratic equation is one of the form  y = ax2 + bx + c .   The roots of the equation give the x-intercepts.   The two solutions (also called roots) to this equation ( ax2 + bx + c = 0 ) are found by using the formula:

Using Quad is simple. Run the program, enter the numbers a, b, and c. Press R/S and the two roots are left in stack registers X and Y.

## The Program

 Stack Contents CODE X Y Z T ```01LBL"QUAD" 02 "ENTER a,b,c" 03 TONE 0 04 PROMPT 05 RCL Z 06 CHS 07 ST/ Z 08 / 09 X<>Y 10 2 11 / 12 STO Z 13 STO T 14 X^2 15 + 16 SQRT 17 ST- Z 18 + 19 END``` ```      c a -a -a -c/a -b/a 2 -b/2a -b/2a -b/2a b^2/4a b^2/4a-c/a sqrt sqrt -b/2a+sqrt``` ```      b c c c -b/a -c/a -b/a -c/a -c/a -c/a -c/a -b/2a -b/2a -b/2a -b/2a-sqrt``` ```      a b b -b/a     -c/a   -b/2a -b/2a -b/2a -b/2a -b/2a -b/2a-sqrt -b/2a``` ```                        -b/2a -b/2a -b/2a -b/2a -b/2a -b/2a```

## Example

What are the solutions to 3x2 + x - 2 = 0 ?
```KEYSTROKES       DISPLAY        COMMENTS