Module 23: Numerical integration and honest error bounds
On this page
- A. Prerequisites and observable goals
- B. The central idea: finite data can approximate accumulation
- C. Composite rules and sufficient error assumptions
- D. Why the weights and rates differ
- E. A computation procedure
- F. Worked examples
- Computing bridge: An error budget is part of the specification
- G. Independent practice
- H. Complete solutions: Module 23
- I. Retention and readiness
A. Prerequisites and observable goals#
Definite integrals, finite sums, higher derivatives, and inequalities.
Compute composite midpoint, trapezoidal, and Simpson approximations; distinguish actual error from a bound; and select a mesh meeting a stated guarantee.
B. The central idea: finite data can approximate accumulation#
A definite integral is a limiting object, but a computer or table supplies finitely many values. Numerical quadrature replaces the curve by simple pieces: rectangles, line segments, or parabolas. Increasing the sample count often improves accuracy, but a reliable error claim needs hypotheses about the function between the samples. Values at a few nodes alone cannot rule out a narrow spike that every sample missed.
C. Composite rules and sufficient error assumptions#
For equal spacing , , define
For even , the composite Simpson rule is
If and , sufficient absolute error bounds are
If and , then for even ,
These are upper bounds, not predictions of the exact error, and must bound derivatives on the entire interval. Standard rules and error estimates: [O2Num].
D. Why the weights and rates differ#
A trapezoid of width and endpoint heights has area . Adding adjacent trapezoids counts interior heights twice, giving the weights .
Simpson’s rule integrates the quadratic interpolating each pair of subintervals, producing weights across three nodes. Joining pairs makes shared interior even nodes carry weight . This explains both the even- requirement and why the rule is exact for quadratic polynomials; symmetry also makes it exact for cubics. The error powers arise because the local interpolation errors accumulate over the mesh. The displayed bounds include the constants; a vague statement “fourth-order accuracy” does not itself give a numerical guarantee.
E. A computation procedure#
Record and confirm equal spacing. Write a node-and-value table. Apply the correct weights, sum before rounding aggressively, and multiply by the width factor last. To meet a tolerance, solve the appropriate error inequality for and round upward; for Simpson, round upward to an even integer. Check that the function is smooth enough and that its derivative bound is valid. A singular endpoint requires a different analysis or a change of variable, not blind use of these bounds.
F. Worked examples#
A trapezoidal approximation. For with , and
The exact value is , so the error is about . Since on , the bound is , larger than the actual error, as a valid upper bound should be.
A guaranteed mesh. For the same integral, a trapezoidal error at most is guaranteed by , giving . Thus suffices. It is not necessarily the smallest mesh that happens to meet the tolerance; it is the smallest integer certified by this particular bound.
Implementation connection. A game simulation’s accumulated movement from sampled velocities resembles quadrature. A trapezoidal update averages endpoint velocities; it is not identical to knowing the exact continuous trajectory. Time-step error, model error, and floating-point error are separate sources of discrepancy.
Computing bridge: An error budget is part of the specification#
A numerical result without a workload and an error condition is incomplete. Simpson’s rule has a theorem-based bound only when the fourth derivative is bounded on the integration interval and the panel count is valid. A05 implements that composite formula and compares it with an analytically known answer. A test using a cubic should be exact up to floating-point effects; that success alone does not establish accuracy for an oscillatory or nonsmooth integrand. Match the regularity assumptions before reusing the bound.
G. Independent practice#
F foundation C standard course work T transfer S optional stretch L runnable lab or project. Attempt the complete set before opening its solutions.
Compute and for , and compare their errors with the exact integral.
Compute for . Explain the exact agreement.
For , choose the smallest even guaranteed by the Simpson bound to give error at most .
A rate table at times seconds gives m/s. Find and . Do the data prove either answer exact?
Find a sufficient trapezoidal subinterval count for error at most in .
Why is the displayed Simpson error bound not automatically applicable to , even though the integral is finite?
A nonconstant twice differentiable function has on . Explain geometrically the error signs for midpoint and trapezoidal approximations.
Show that five values at the nodes cannot by themselves bound the integral error. Construct nonnegative smooth functions zero at all five nodes with arbitrarily large integrals.
Optional small hints
For M23.03, take a fourth root, then enforce parity. For M23.08, square a polynomial with those five roots and multiply by a positive scale.
H. Complete solutions: Module 23#
Compare the first step where your work differs. A corrected answer is not yet an independent success.
M23.01Show solution
Two rectangle heights versus three endpoint heights
With , midpoint inputs are , so . Trapezoidal weights give . The exact integral is . Thus midpoint error magnitude is (underestimate), and trapezoidal error is (overestimate). Here makes the corresponding theoretical bounds exactly and .
Back to M23.01M23.02Show solution
Apply the alternating weights correctly
With , the values are . Therefore
The exact integral is . Since the fourth derivative of this cubic is zero, the Simpson error bound is zero; this explains exactness beyond a numerical coincidence.
Back to M23.02M23.03Show solution
A tolerance requirement with an even mesh
Here and interval length is . Require , or . The smallest permissible even integer is . The bound is then , below the target.
Back to M23.03M23.04Show solution
The table determines approximations, not the missing curve
The width is . Trapezoidal integration gives m. Simpson gives m. Neither is proven exact from the table alone; curves between the samples can differ. There is also no derivative bound supplied to certify either error.
Back to M23.04M23.05Show solution
Round a sufficient count upward
Since , . The bound is . Requiring this at most gives , so subintervals suffice. Trapezoidal rules have no even- restriction.
Back to M23.05M23.06Show solution
Integrability is weaker than the error theorem’s hypotheses
The square root is continuous on , hence integrable, but its derivatives become unbounded near zero; in particular its fourth derivative has no finite bound on the entire interval. The stated and finite- assumptions fail. This does not say Simpson approximations are meaningless, only that this specific guarantee cannot be invoked without additional analysis.
Back to M23.06M23.07Show solution
Curvature predicts opposite biases
For a strictly convex graph, each secant chord lies above the curve, so each trapezoid overestimates area. For midpoint rectangles, pair points equally spaced around the midpoint; convexity makes the average of their heights exceed the midpoint height. Integrating those paired comparisons shows the midpoint underestimate. Thus under strict convexity on a nonzero interval. This is an exact sign conclusion, not just a tendency seen in a picture.
Back to M23.07M23.08Show solution
Unseen behavior can defeat a data-only guarantee
Let and with . Every sampled value is zero, so the trapezoidal and Simpson rules on these nodes give zero. But is continuous, nonnegative, and positive except at finitely many roots, so . The true integral is , which becomes arbitrarily large. Smoothness alone without a quantitative derivative bound does not prevent the example; all these functions are polynomials.
Back to M23.08I. Retention and readiness#
Retrieve M16.03 and M15.08. Explain the difference between an observed error, an estimated error, and a proven upper bound. Advance when you can audit someone else’s node spacing, weights, parity, and derivative assumptions.