(HP71B) Newton's method
|
11-13-2024, 08:38 PM
(This post was last modified: 11-18-2024 02:28 PM by Albert Chan.)
Post: #7
|
|||
|
|||
RE: (HP71B) Newton's method
(11-12-2024 12:12 PM)Albert Chan Wrote: I think interval (x ± h), h based from previous correction is better. It may be better to count correction using old slope (LINE 70) as separate iteration. In other words, count increase by 1 if old slope was reused. For same epsilon, this would likely quit earlier, not wasting iterations. 1 DESTROY ALL @ C=0 2 DEF FNF(X)=EXP(X)-3*X*X 3 INPUT "Guess, Accuracy = ";X,A @ D=X+(X=0) 10 FOR I=1 TO 30 @ H=ABS(.01*D) 20 F1=FNF(X-H) @ F2=FNF(X+H) 30 R=2*H/(F2-F1) ! reciprocal slope 40 D=(F1+F2)/2*R ! secant root = X-D 50 C=C+2 @ X=X-D @ DISP X,D,C @ IF ABS(D)<=A THEN EXIT I 60 IF ABS(D)>H THEN 80 70 D=FNF(X)*R @ C=C+1 @ X=X-D @ DISP X,D,C @ IF ABS(D)<=A THEN EXIT I 80 NEXT I Code: Guess, Accuracy = 3, 1e-6 Code: Guess, Accuracy = 4, 1e-6 Previous post with straightened curve >2 DEF FNF(X)= 1 - 3*X^2/EXP(X) Code: Guess, Accuracy = 3, 1e-6 Code: Guess, Accuracy = 4, 1e-6 |
|||
« Next Oldest | Next Newest »
|
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: 2 Guest(s)