Post Reply 
Newton and Halley's methods with enhanced derivatives estimation
10-07-2017, 01:53 PM (This post was last modified: 10-07-2017 02:06 PM by Gerson W. Barbosa.)
Post: #10
RE: Newton and Halley's methods with enhanced derivatives estimation
(10-06-2017 07:27 PM)Dieter Wrote:  An application similar to yours (finding the interest rate in a TVM problem for the HP65, c.f. HP65/67 Software Library) exits at 1E–7 on a 10-digit calculator. Due to the limited accuracy (the HP65 does not offer ln(1+x) or e^x–1) further digits will be rounded off anyway as soon as 1+i is calculated. So knowing the properties and limitations of the considered equation can be essential.

Better results using those functions and your suggestions:

5 DESTROY ALL
10 F=0
17 INPUT "PV? ";P @ INPUT "PMT? ";M @ N=2
20 DEF FNX(X)=EXPM1(-(LOGP1(-X*P/M)/N))-X
30 INPUT "GUESS? ";X
40 T=.00000001
50 H=.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
125 IF F=1 THEN 150
130 IF ABS(D)>=T THEN 50
140 DISP "ROOT = ";X
145 F=1 @ DISP "       "; @ GOTO 50
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? .1
7.57351446226E-2
6.72097906242E-2
6.59898111158E-2
6.59646116921E-2
6.59646009784E-2
6.59646009725E-2
ROOT = 6.59646009725E-2
       6.59646009765E-2
EXACT: 6.59646009789E-2     (78)


PS: On the HP-71B.
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-07-2017 01:53 PM



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