52 The Romberg differentiation Difference quotients
For the differentiation of a function F(x), one calculates the difference quotients of F for intervals of length 2H~J.
The lengths are calculated iteratively with:
The difference quotients now have the form
The derivative of the function F is calculated with the help of these numbers D(0,J) at the point XO
D(K,J) = (2"2K # D(K-1,J+1) - D(K-1,J))/(2~2K-1) (3)
This procedure is executed until one has gone under a previously chosen margin of error E:
1 REM
4 REM * ROMBERG
DIFFERENTIATION *
7 REM
8 PRINT" -CCLRy "
ID DIM X(30),Y(30),D(30,30),H1(30),C(30) 100 POKE 53280,0:POKE 53281 ,0:PRINT"vGRY2>" 110 REM
115 POKE 214,12:POKE 211,6:SYS 58732 120 PRINT"ROMBERG - DIFFERENTIATION" 130 FOR W=1 TO lOOO:NEXT 135 REM
140 GOSUB 15000: REM * INPUT * 145 REM
150 GOSUB 5000: REM * FUNCTION * 155 REM
200 PR I NT " -CCLR} X " , "Yl" , "Y2" 205 PRINT
250 : : D(O,J) = (FNF(X+Hl(J))-FNF(X-Hl(J) ) )/(2*H1(J))
270 : NEXT
290 : D(K,J)=1/(2 I (2*K)—1)*(2 1 (2*K)*D(K—1, J + l)—D(K—1,J))
300 : IFABS(D(K,O)—D(K—1,1))< T THEN GOSUB 10000:G0T0 370
330 : GOTO 290
350 : GOTO 285
Post a comment