(71B) EulerTaylor method for the HP71B

12152019, 08:14 PM
Post: #13




RE: (71B) EulerTaylor method for the HP71B
(12152019 08:25 AM)Csaba Tizedes Wrote: 50 D1=FND(X,Y) The code looks good, except YE is an invalid variable. HP71B only allowed single character variable name, with optional single digits, like Y1 However, with 3 FND() calls per loop, it cost upto 50% more time than the original 2 FND() A more practical approach might be to keep original code (equivalent to removing line 75), but more points (smaller h) Another approach is to add "rough" 3rd order correction. Using backward differences, this only do 2 FND() calls per loop. h³ Y''' / 6 ≈ h³ (∇Y''/h) / 6 ≈ h² ∇(ΔY'/h) / 6 = ∇(½ h ΔY') / 3 Code: 50 D1=FND(X,Y) >RUN y = 1.64876111344 exact = 1.6487212707 %err = 2.4165843377E3 For comparison, using *exact* Y''' gives similar result Y' = X Y Y'' = X Y' + Y = X² Y + Y Y''' = (X² Y' + 2XY) + Y' = X³Y + 2XY + XY = XY(X² + 3) >75 D3=D1*((XH)^2+3) >77 Y=Y+H^3/6*D3 > >RUN y = 1.64876145117 exact = 1.6487212707 %err = 2.43706869767E3 3rd order correction patch shines when Y''' is relatively large. Example, with Y' = Y, X = 0 to 1 step 0.01 Exact Y = Y' = Y'' = Y''' = 2.71828182846 1st order correction, Y = 2.70481382938 2nd order correction, Y = 2.71823686266 3rd order correction, Y = 2.71828104622 

« Next Oldest  Next Newest »

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