summaryrefslogtreecommitdiff
path: root/info/maad/pgm7.bas
blob: d2dc90bab2c40e43d298f56af51797814a341260 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
5   DEFDBL A-H, O-Z
10  D = .0001: INPUT "A,B = "; A, B: N = 10
20  N = N + 10: H = (B - A) / N: X = A: S = 0!: T = 0!
30  FOR I = 1 TO N STEP 2
40  GOSUB 100: S = S + Y * H / 3: T = T + Y * H / 2: X = X + H
50  GOSUB 100: S = S + 4 * Y * H / 3: T = T + Y * H: X = X + H
60  GOSUB 100: S = S + Y * H / 3: T = T + Y * H / 2: NEXT I
70  IF ABS((S - T) / (S + T)) > D THEN 20
80  PRINT "Integral = "; T, N
90  PAUSE: INPUT "Error % = "; D: GOTO 20
100 Y = SQR(1! - SIN(EXP(1) / 2) ^ 2 * SIN(X) ^ 2): RETURN