(71B) Euler-Taylor method for the HP-71B
|
12-13-2019, 02:12 PM
(This post was last modified: 12-14-2019 07:11 PM by Albert Chan.)
Post: #4
|
|||
|
|||
RE: (71B) Euler-Taylor method for the HP-71B
(12-11-2019 10:07 PM)Namir Wrote: 3) It would be nice if someone can numerically approximate the d2y/dx2 for dy/dx = f(x,y). Any idea? y'' ≈ Δy' / Δx = Δy' / h Δy' ≈ y'(x+h, y + h y'(x,y)) - y'(x,y) → y + h y' + ½ h² y'' ≈ y + h y' + ½ h Δy' 10 DEF FND(X,Y)=X*Y 20 X=0 @ Y=1 @ X1=1 @ H=.01 30 N=INT((X1-X)/H+.5) 40 FOR I=1 TO N 50 D1=FND(X,Y) 60 X=X+H @ Y=Y+H*D1 70 Y=Y+H/2*(FND(X,Y)-D1) 80 NEXT I 90 Y1=EXP(.5*X*X) 100 DISP "y =";Y 110 DISP "exact=";Y1 120 DISP "%err =";100*(Y-Y1)/Y1 >RUN y = 1.64871423741 exact = 1.6487212707 %err =-4.26590602365E-4 Edit:To compare apples to apples, I removed the assumption final X=X1 So, both exact and estimate uses final X as end-point. line 90: Y1=EXP(.5*X1*X1) changed to Y1=EXP(.5*X*X) |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)