Post Reply 
Newton and Halley's methods with enhanced derivatives estimation
10-06-2017, 05:39 PM
Post: #5
RE: Newton and Halley's methods with enhanced derivatives estimation
I've found an example which causes your first program to loop forever on the HP-75C. But then my tolerance factor might not be adequate enough:


Code:

10 REM NEWTON'S METHOD WITH ENHANCED DERIVATIVE
15 REM NEXT IS THE DEFINITION OF F(X)=0
17 INPUT "PV? "; P @ INPUT "PMT? "; M @ N=2
20 DEF FNX(X) = 1/(1-X*P/M)^(1/N)-X-1
30 INPUT "GUESS? ";X
40 T=.00000000001
50 H = 0.001*(1+ABS(X))
60 F0 = FNX(X)
70 F1 = FNX(X+H) @ F2 = FNX(X+2*H)
80 F9 = FNX(X-H) @ F8 = FNX(X-2*H)
90 D1 = (-F2+8*F1-8*F9+F8)/12/H 
100 D = F0/D1
110 X = X-D
120 DISP X @ WAIT 1
130 IF ABS(D)>=T THEN 50
140 DISP "ROOT = ";X @ WAIT 2
150 E=(SQR(M+4*P)-3*SQR(M))/(SQR(M)-SQR(M+4*P))
160 DISP "EXACT: ";E
170 END

RUN

PV? 100
PMT? 55
GUESS? 0.1


The program loops around 0.06596460. The exact 16-digit result is 6.596460097781873E-2.

Gerson.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Newton and Halley's methods with enhanced derivatives estimation - Gerson W. Barbosa - 10-06-2017 05:39 PM



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