HP Forums

Full Version: (11C) Three Solvers
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Program use for Equation Solving solution of f(x)=0

This program can be use for three type of solvers

[A] Bisection Method use Two Guess X1 [ENTER] X2
[B] Secant Method use Two Guess X1 [ENTER] X2
[C] Newton Method Use One Guess

The accuracy result is based on you decimal setting. FIX 0 - 9

Program is credit to J T Patterson who make this possible.

More information at his page at: http://www.jepspectro.com/htmDoc/BisecnewtP.htm

--------------------------------------------

Example:

To solve for X^X = 12345

Put f(x) = 0 routine at [LBL] E
LN
LSTx
x
RCL 6 // use Storage Register 6 for 12345
LN
-
RTN

Steps to run solver: USER mode and FIX 5

12345 STO 6
4 ENTER 6 [A] display 5.51659

Answer: X = 5.51659 using guess X1_4 and X2_6
---------------------------------------------
Program:
Code:

LBL A  // Bisection
STO 0
Rv
STO 1
LBL 1
SF1
RCL 0
GSB E
STO 3
RCL 1
RCL 0
+
2
÷
STO 2
GSB E
STO 4
RCL 3
x
X<0
GSB 3 
F1
GSB 2
RCL 4
RND
X≠0
GTO 1
RCL 2
RTN
LBL2
RCL 2
STO 0
RTN
LBL 3
RCL 2
STO 1
CF1
RTN
------------
LBL B  // Secant
STO 0
Rv
STO 1
RAN#
STO 3
LBL 4
RCL 0
RCL 1
-
STO 2
RCL 1
GSB E
STO 4
RCL 1
RCL 4
RCL 2
x
RCL 3
RCL 4
-
X=0
RAN#
÷
-
STO 5
RCL 1
STO 0
RCL 4
STO 3
RCL 5
STO 1
RCL 4
RND
X≠0
GTO 4
RCL 1
RTN
-----------
LBL C  // Newton 
STO 1
LBL 5
RCL 1
GSB E
STO 4
RCL 1
X=0
e^x
EEX
4
÷
STO 2
RCL 1
+
GSB E
RCL 4
-
RCL 2
÷
RCL 4
X<>Y
÷
STO-1  // Store Arithmetic Subtraction 
RCL 4
RND
X≠0
GTO 5
RCL 1
RTN
--------
LBL D  // Result Answer
RCL 1
RTN
-------
LBL E  // f(x)
.
.
.
.
.
.
RTN

Gamo
This solver is good to run on HP-11C, it run fast by depending on
your FIX accuracy value and user who not good at stacks manipulation.
This solver use Register 1 for the unknow X in the equation simply use
R1 for all X in your equations as shown in the example below.

Enter your equations with your X on R1
Enter educated guess and press [A]

Example: [USER] [FIX 4]

Find X with this equation: 55X^3 + 21X^2 - 11X - 1111 = 0

Enter f(x) equation to Lable [E]

[GTO] [E] g [P/R] this steps direct to f(x) routine

RCL 1
3
Y^X
55
x
RCL 1
X^2
21
x
+
RCL 1
11
x
-
1111
-
RTN

g [P/R]

Enter Guess: 4 [A] took about 20 second answer X=2.6253

Program:
Code:

LBL A
STO 1
1
%
STO 2
GSB E
STO 3
LBL 1
RCL 2
STO+1
RND
X=0
GTO 0
GSB E
RCL 3
X<>Y
STO 3
-
STO÷2
RCL 3
STOx2
GTO 1
LBL 0
RCL 1
RTN
LBL E
.// Use R1 for you unknow X
.
.
RTN

Gamo 6/22/2020
Reference URL's