Quadratic Equation Solver program for the HP-15C

Description

This program finds the roots of a quadratic equation of the form ax² + bx + c = 0.

Push a, b, and c into the Z, Y, and X registers of the stack respectively, then press the E function key.
The roots of the equation will appear in the X and Y registers.

If the "C" indicator appears then one or more of the roots are complex numbers.

Program Resources

Labels

Name Description
 E Compute the Roots of the Quadratic Equation
.8 Used for internal computation
.9 Used for internal computation

Storage Registers

Name Description
 0 Used for internal computation
 1 Used for internal computation
 2 Used for internal computation
 3 Used for internal computation
.0 Used for internal computation
.1 Used for internal computation
.2 Used for internal computation
.3 Used for internal computation

Flags

Number Description
8 Set to indicate that the result is a complex number

Program

Line Display Key Sequence Line Display Key Sequence Line Display Key Sequence
000 032 45,10, 1 RCL ÷ 1 064 45 .3 RCL . 3
001 42,21,15 f LBL E 033 44 .0 STO . 0 065 42 25 f I
002 43, 6, 8 g F? 8 034 45 2 RCL 2 066 20 ×
003 22 .9 GTO . 9 035 45,10, 1 RCL ÷ 1 067 2 2
004 44 3 STO 3 036 42 25 f I 068 20 ×
005 33 R⬇ 037 42 30 f Re↔Im 069 30
006 16 CHS 038 45 2 RCL 2 070 42 31 f PSE
007 44 2 STO 2 039 45,10, 1 RCL ÷ 1 071 42 30 f Re↔Im
008 43 11 g 040 45 .0 RCL . 0 072 42 31 f PSE
009 34 x↔y 041 16 CHS 073 42 30 f Re↔Im
010 2 2 042 42 25 f I 074 11 √x̅
011 20 × 043 43 32 g RTN 075 44 0 STO 0
012 44 1 STO 1 044 42,21, .9 f LBL . 9 076 42 30 f Re↔Im
013 45,20, 3 RCL × 3 045 44 3 STO 3 077 44 .0 STO . 0
014 2 2 046 42 30 f Re↔Im 078 45,40, .2 RCL + . 2
015 20 × 047 44 .3 STO . 3 079 42 30 f Re↔Im
016 30 048 33 R⬇ 080 45,40, 2 RCL + 2
017 42 31 f PSE 049 16 CHS 081 45 1 RCL 1
018 43,30, 2 g TEST x<0 050 44 2 STO 2 082 45 .1 RCL . 1
019 22 .8 GTO . 8 051 42 30 f Re↔Im 083 42 25 f I
020 11 √x̅ 052 16 CHS 084 10 ÷
021 44 0 STO 0 053 44 .2 STO . 2 085 45 2 RCL 2
022 45,40, 2 RCL + 2 054 42 30 f Re↔Im 086 45,30, 0 RCL 0
023 45,10, 1 RCL ÷ 1 055 43 11 g 087 45 .2 RCL . 2
024 45 2 RCL 2 056 34 x↔y 088 45,30, .0 RCL . 0
025 45,30, 0 RCL 0 057 2 2 089 42 25 f I
026 45,10, 1 RCL ÷ 1 058 20 × 090 45 1 RCL 1
027 43 32 g RTN 059 44 1 STO 1 091 45 .1 RCL . 1
028 42,21, .8 f LBL . 8 060 42 30 f Re↔Im 092 42 25 f I
029 43, 4, 8 g SF 8 061 44 .1 STO . 1 093 10 ÷
030 11 √x̅ 062 42 30 f Re↔Im 094 43 32 g RTN
031 42 30 f Re↔Im 063 45 3 RCL 3