Numerical integration: trapezoid, midpoint and Simpson's rule with error bounds
Estimate a definite integral from a table of values with three rules, predict whether each is high or low, and choose n to guarantee a tolerance.
It opens on
Often you have only a table of values, not a formula. With four strips under 1/x on [1, 2], how close can we get to ln 2?
Why it matters
Many integrals have no formula, and data from sensors arrives as tables, so estimates with a guaranteed error are the working tool.
Good to know first
- Approximating areas with Riemann sums: a trapezoidal sum adds trapezoids on each subinterval
- Concavity and the second derivative test: concave up means f″ > 0, concave down means f″ < 0
Step by step
Trapezoid and midpoint
Compute T₄ and M₄ from values of f and predict from concavity which is high and which is low.
T₄ = (0.25/2)[1 + 2(0.8 + 0.6667 + 0.5714) + 0.5] ≈ 0.69702, interior values doubled.
A common mix-up
Both rules err in the same direction.
In fact: On a curve bending up, T overestimates and M underestimates; down reverses it.
Simpson's parabolas
Write the weights 1, 4, 2, 4, 1 for Simpson's rule, require an even n, and compute S₄.
S₄ = (0.25/3)[1 + 4(0.8) + 2(0.6667) + 4(0.5714) + 0.5] = (1/12)(8.3190) ≈ 0.69325.
A common mix-up
Simpson's weights are all 2 inside.
In fact: The weights alternate 4, 2, 4, and all 2 is the trapezoid rule.
Error bounds and choosing n
Use the bounds to find n for a stated tolerance and see that the bound is not the error.
For 1/x, the second derivative 2/x³ has its highest point (1, 2) on the graph, so K = 2; M = 24.
A common mix-up
The bound equals the error.
In fact: It is a guarantee from the worst-case curve; here the real error is 0.0000372.
Try it
T₄ for the table x = 0, 1, 2, 3, 4 and f = 2, 3, 5, 8, 12Answer
23
Hint: Ends once, interior twice, times 1/2
S₄ for the table x = 0, 1, 2, 3, 4 and f = 2, 3, 5, 8, 12Answer
68/3 ≈ 22.67
Hint: Weights 1, 4, 2, 4, 1 times 1/3
Midpoint strips for ∫₁² 1/x dx within 0.001?Answer
10
Hint: 2/(24n²) ≤ 0.001 gives n ≥ 9.13
Exact is ln 2 ≈ 0.693147; is T₄ above or below it, and M₄?Answer
T₄ above, M₄ below.
Why can Simpson's rule not use n = 5?Answer
Parabolas need pairs of strips, and five strips leave one over.
Numerical integration: trapezoid, midpoint and Simpson's rule with error bounds
30 minutes every month. No card.
