Post Reply 
(11C) CUBIC EQUATION
06-09-2018, 11:49 AM (This post was last modified: 06-11-2018 08:32 AM by Gamo.)
Post: #1
(11C) CUBIC EQUATION
This program finds the roots of cubic equation of the form

f(x) = X^3 + aX^2 + bX + c

where a, b and c are real.

It does so by extracting the first root, performing synthetic division,
and solving the resulting quadratic equation.

(This program was from HP-19C/HP-29C Applications Book, P.6 and here is the modified version for HP-11C)

Program: CUBIC EQUATION
Code:

LBL A      
STO 1
Rv
STO 2
Rv
STO 3
EEX
CHS
4
STO 0
CLx
STO 4
RTN
-----------------------------------------------------------
LBL B     
RCL 3    
RCL 3
ABS
÷
STO 6
LSTx
RCL 1
ABS
+
RCL 0
-----------------------------------------------------------------------
LBL 0
10
x
X≤Y
GTO 0
STO 7
-------------------------------------------------------------------------
LBL 2
10
STO÷7
RCL 6
CHS 
STO 6
------------------------------------------------------------------------
LBL 1
RCL 7
RCL 6
x
RCL 4
+
STO 5
RCL 4
X=Y
GTO 3
RCL 5
RCL 1
+
RCL 5
x
RCL 2
+
RCL 5
x
RCL 3
+
STO 8
ABS 
RCL 0
X˃Y
GTO 3
RCL 5
STO 4
RCL 8
RCL 6
x
X˂0
GTO 1
GTO 2
-----------------------------------------------------------------------
LBL 3
RCL 5
R/S
RCL 1
+
CHS
STO 1
2
÷
ENTER
X^2
RCL 1
CHS
RCL 5
x
RCL 2
+
STO 3
-
R/S
√X
X<>Y
ABS
+
RCL 1
ENTER
ABS
÷
x
R/S
RCL 3
X<>Y
÷
RTN
--------------------------------------------------------------------------
LBL C   //  Complex Roots
CHS
√X
R/S

Usage:
c [ENTER] b [ENTER] a

[A] ---> 0
[B] ---> 1st Root

[R/S] ---> Discriminant // If D≥0 continue [R/S] [R/S] If D˂0 continue to [C]

[R/S] ---> 2nd Root
[R/S] ---> 3nd Root

[C] ---> Complex Roots // [X<>Y] (u in Y) and (v in X)


Put to USER MODE --> f USER

Example: X^3 - 6X^2 + 11X - 6 = 0

6 [CHS] [ENTER] 11 [ENTER] 6 [CHS]

[A] 0
[B] 3 // 1st root
[R/S] 0.25 // D is greater than or equal zero go ahead with R/S
[R/S] 2 // 2nd root
[R/S] 1 // 3th root

Answer of 3 roots are 3, 2 and 1
----------------------------------------------------------------------------------------
Example: X^3 - 4X^2 + 8X - 8 = 0

8 [CHS] [ENTER] 8 [ENTER] 4 [CHS]

[A] 0
[B] 2 // 1st root
[R/S] -3 // D is less than zero then use LBL C for complex roots
[C] 1.73 [X<>Y] 1 // 1.73 (Imaginary Part) and 1 (Real Part)

Real answer is 2
Complex answer is 1 ±1.73i
-----------------------------------------------------------------------------------------

Gamo
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(11C) CUBIC EQUATION - Gamo - 06-09-2018 11:49 AM
RE: (11C) CUBIC EQUATION - Gamo - 06-09-2018, 12:34 PM
RE: (11C) CUBIC EQUATION - Dieter - 06-09-2018, 12:54 PM
RE: (11C) CUBIC EQUATION - rprosperi - 06-09-2018, 01:00 PM
RE: (11C) CUBIC EQUATION - Dieter - 06-09-2018, 06:05 PM
RE: (11C) CUBIC EQUATION - Dieter - 06-09-2018, 07:50 PM
RE: (11C) CUBIC EQUATION - Dieter - 06-10-2018, 07:15 AM
RE: (11C) CUBIC EQUATION - Dieter - 06-10-2018, 09:17 PM
RE: (11C) CUBIC EQUATION - Albert Chan - 07-20-2021, 10:12 PM
RE: (11C) CUBIC EQUATION - Gamo - 06-10-2018, 02:42 AM
RE: (11C) CUBIC EQUATION - Gamo - 06-10-2018, 02:36 PM
RE: (11C) CUBIC EQUATION - Dieter - 06-10-2018, 03:34 PM
RE: (11C) CUBIC EQUATION - Dieter - 06-10-2018, 09:35 PM
RE: (11C) CUBIC EQUATION - Gamo - 06-11-2018, 02:16 AM
RE: (11C) CUBIC EQUATION - Dieter - 06-11-2018, 07:04 AM
RE: (11C) CUBIC EQUATION - Gamo - 06-11-2018, 08:19 AM
RE: (11C) CUBIC EQUATION - Dieter - 06-11-2018, 08:19 PM
RE: (11C) CUBIC EQUATION - Gamo - 06-12-2018, 07:02 AM



User(s) browsing this thread: 1 Guest(s)