04-13-2017, 01:50 AM
This solver uses Newton's method to solve f(x)=0. It is an adaptation of the HP-25 solver (HP-25 Application Programs, Chapter 5). The program uses registers 0, 1, 2, 3 and 4.
Enter the program as listed- it will occupy lines 1 through 38. The formula to be solved will start on line 39 and must end with the command GTO 17.
EXAMPLE-
Solve ln x + 3x -10.8074 = 0
Starting with line 38 displayed, enter the formula:
LN
LST X
3
*
+
1
0
.
8
0
7
4
-
GTO 17
Store an initial guess in register 1:
1
STO 1
Store the desired tolerance in register 2:
EEX
5
CHS
STO 2
Press R/S to solve. Result: 3.21336
Enter the program as listed- it will occupy lines 1 through 38. The formula to be solved will start on line 39 and must end with the command GTO 17.
EXAMPLE-
Solve ln x + 3x -10.8074 = 0
Starting with line 38 displayed, enter the formula:
LN
LST X
3
*
+
1
0
.
8
0
7
4
-
GTO 17
Store an initial guess in register 1:
1
STO 1
Store the desired tolerance in register 2:
EEX
5
CHS
STO 2
Press R/S to solve. Result: 3.21336
PHP Code:
CLX
STO 0
RCL 1
GTO 39 //xeq formula
ROLL DN
STO 4
1
STO 0
RCL 1
RCL 1
EEX
5
/
STO 3
+
GTO 39 //xeq formula
X=0
GTO 37
RCL 0
X=0
GTO 05
ROLL DN
RCL 4
/
1
-
1/X
RCL 3
x
STO – 1
2
Y^X
SQRT
RCL 2
X<=Y //x is less than or equal to y
GTO 01
RCL 1 //answer
R/S
//formula...
GT0 17