Post Reply 
(HP71B) Newton's method
10-01-2023, 04:34 PM
Post: #2
RE: (HP71B) Newton's method
Previous HP71B code had a hard-coded absolute epsilon. (line 20)
It may be safer to use relative epsilon instead, in case x±ε round back to x

>20 E=(ABS(X)+(X==0))*1E-3

Let's try example from thread, Namir, Byte and REXX, which also does 3 calls per iteration.
(09-10-2018 01:26 PM)Massimo Gnerucci Wrote:  D:\ReginaREXX391w64>regina.exe root.rex
Enter expression (of variable X)
2 * X**2 + 3 * X - 12
Enter guess and accuracy
5 0.001
guess = 5
guess = 2.695652174
guess = 1.925113151
guess = 1.814140206
guess = 1.811738817
Root   = 1.811737692
Number of iterations = 5

>2 DEF FNF(X)=2*X^2+3*X-12
>RUN
Guess, Accuracy = 5, 1e-6
 5
 2.69565
 1.92511161178
 1.81413944914
 1.81173817456
 1.81173769148
FNF calls = 11

True root = (sqrt(105)-3)/4 = 1.8117376914898995958...
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(HP71B) Newton's method - Albert Chan - 10-01-2023, 03:59 PM
RE: (HP71B) Newton's method - Albert Chan - 10-01-2023 04:34 PM
RE: (HP71B) Newton's method - Albert Chan - 10-01-2023, 09:47 PM
RE: (HP71B) Newton's method - Albert Chan - 10-02-2023, 04:04 PM
RE: (HP71B) Newton's method - Albert Chan - 11-12-2024, 12:12 PM
RE: (HP71B) Newton's method - Albert Chan - 11-13-2024, 01:12 PM
RE: (HP71B) Newton's method - Albert Chan - 11-13-2024, 08:38 PM
RE: (HP71B) Newton's method - Albert Chan - 11-18-2024, 01:22 PM
RE: (HP71B) Newton's method - Albert Chan - 11-21-2024, 12:08 AM



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