Trailing-Edge
-
PDP-10 Archives
-
decus_20tap1_198111
-
decus/20-0020/deriv.clc
There are 2 other files named deriv.clc in the archive. Click here to see a list.
100' NAME--DERIV.
110'
120' DESCRIPTION--CALCULATES DERIVATIVE OF FUNCTION FNF AT POINT X = A
130' PROGRAM SHOWS SUCCESSIVE DIFFERENCE QUOTIENTS FOR VALUES OF
140' X APPROACHING A FROM THE RIGHT, AND GIVES A GOOD APPROXIMATION
150' TO THE DERIVATIVE.
160'
170' SOURCE--UNKNOWN
180'
190' INSTRUCTIONS--SUPPLY FUNCTION BY: 250 DEF FNF(X) = .......
200' SUPPLY POINT BY: 360 DATA A
210'
220'
230' * * * * * * MAIN PROGRAM * * * * * * * * * * *
240'
250 DEF FNF(X) = 2^X
260 READ A
270 PRINT " X","DIFFERENCE QUOTIENT"
280 FOR N = 1 TO 10
290 LET D1 = D
300 LET X = A + (1/2)^N
310 LET D = (FNF(X)-FNF(A))/(X-A)
320 PRINT INT(X*1E4+.5)/1E4, D
330 NEXT N
340 PRINT
350 PRINT "DERIVATIVE = " 2*D-D1
360 DATA 0
370 END