Post Reply 
(11C) CUBIC EQUATION
06-11-2018, 02:16 AM (This post was last modified: 06-11-2018 07:50 AM by Gamo.)
Post: #16
RE: (11C) CUBIC EQUATION
Dieter
Thank You for reviewing this program I noticed that this routine take a long time to run and must be something wrong in the original coding.
I try this on HP-15C App on Android and it run extremely fast with correct answer using the original code.

Here is the original program: CUBIC EQUATION

It does so by extracting the first root, performing synthetic division,
and solving the resulting quadratic equation (ref: HP-19C/HP-29C Application Book, p.6)

USER INSTRUCTIONS:
1. Initialize f [REG]
2. 10^-4 [STO] 0
3. STORE Coefficients: a [STO 1] b [STO 2] c [STO 3]
4. RUN: [GSB] 1 // 1st root // [R/S] D
5a. If D greater than or equal to zero // [R/S] 2nd root [R/S] 3nd root
5b. If D less than zero // [GSB] 2 (v) [X<>Y] (u)

Program: CUBIC EQUATION
Code:

LBL 1
RCL 3
RCL 3
ABS
/
STO 6
LSTx
RCL 1
ABS
+
RCL 0
LBL 0
10
x
X<=Y
GTO 0
STO 7
LBL 9
10
STO / 7
RCL 6
CHS
STO 6
LBL 8
RCL 7
RCL 6
x
RCL 4
X=Y
GTO 7
RCL 5
RCL 1
+
RCL 5
x
RLC 2
+
RCL 5
x
RCL 3
+
STO 8
ABS
RCL 0
X>Y
GTO 7
RCL 5
STO 4
RCL 8
RCL 6
x
X<0
GTO 8
GTO 9
LBL 7
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
SQRT
X<>Y
ABS
+
RCL 1
ENTER
ABS
/
x
R/S
RCL 3
X<>Y
/
RTN
LBL 2
CHS
SQRT
R/S

Remark:
Under user instruction the first step said Initialize f [REG] is this to make sure that each RUN register R4 is clear and that start R4 with zero ?

Gamo Smile
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: 3 Guest(s)