blob: 50effbc92e02bdf84437a24f906707ce581ffbb6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
10 DEF FNA (X) = SQR(1! - SIN(EXP(1) / 2) ^ 2 * SIN(X) ^ 2)
20 N = 10: A = 0!: B = 2! * ATN(1!)
30 H = (B - A) / N: S = 0!: T = 0!
40 FOR I = 1 TO N STEP 2
50 X = A + (I - 1) * H: S = S + FNA(X): T = T + FNA(X)
60 X = A + I * H: T = T + 4! * FNA(X)
70 X = A + (I + 1) * H: S = S + FNA(X): T = T + FNA(X)
80 NEXT I: S1 = H * S: S2 = H * T / 3!: E = ABS((S1 - S2) / (S1 + S2))
90 IF (E > .000001) THEN N = 2 * N: GOTO 30
100 PRINT "Integral = "; S2, N
|