Trailing-Edge
-
PDP-10 Archives
-
decuslib10-01
-
43,50110/intgrt.clc
There are 2 other files named intgrt.clc in the archive. Click here to see a list.
100' NAME--INTGRT
110'
120' DESCRIPTION--SIMPLE INTEGRATION ROUTINE
130'
140' SOURCE--UNKNOWN
150'
160' INSTRUCTIONS--ENTER FUNCTION TO BE COMPUTED AS
170' 270 DEF FNF(X) = ........
180' LIMITS OF THE INTEGRATION ENTERED AS: 430 DATA A,B
190' ANSWER COMPUTED TO WITHIN 1E-4 OF RELATIVE ERROR.
200' THIS IS ABOUT 4-PLACE ACCURACY, THE ACCURACY MAY BE CHANGED
210' BY CHANGING THE CONSTANT IN LINE 430. E.G.
220' 430 DATA 1E-6 YIELDS 6-PLACE ACCURACY.
230'
240'
250' * * * * * * * MAIN PROGRAM * * * * * * * * * *
260'
270 DEF FNF(X) = X^2+X+1
280 READ A,B,E
290 LET H = B-A
300 LET T = (FNF(A)+FNF(B))*H
310 LET M = 0
320 LET T = (T+M)/2
330 LET M = 0
340 FOR X = A+H/2 TO B STEP H
350 LET M = M + FNF(X)
360 NEXT X
370 LET M = M*H
380 LET S = (T + 2*M)/3
390 LET H = H/2
400 IF ABS(T-M)/ABS(S) > E THEN 320
410 PRINT "INTEGRAL = " S
420 DATA 0,1
430 DATA 1E-4
440 END