The following algorithm produces a numerical approximation for the integral
Step 1 | Start |
Step 2 | Input the values of A, B and N |
Step 3 | Let H = (B – A) / N |
Step 4 | Let C = H / 2 |
Step 5 | Let D = 0 |
Step 6 | Let D = D + A4+ B4 |
Step 7 | Let E = A |
Step 8 | Let E = E + H |
Step 9 | If E = B go to Step 12 |
Step 10 | Let D = D + 2 × E4 |
Step 11 | Go to Step 8 |
Step 12 | Let F = C × D |
Step 13 | Output F |
Step 14 | Stop |
For the case when A = 1, B = 3 and N = 4,
Calculate, to 3 significant figures, the percentage error between the exact value of and the value obtained from using the approximation to in this case.
Did this page help you?