numerical integration
Simpson's Rule
You should know: numerical integration
Overview
Simpson's rule approximates a definite integral by fitting a quadratic (parabolic) curve through each group of three consecutive sample points, rather than a straight line as in the trapezoidal rule. This extra curvature makes it exact for any polynomial up to degree 3 and gives a truncation error of O(h⁴) — far smaller than the trapezoidal rule's O(h²) for the same step size. The composite version divides [a, b] into an even number n of equal subintervals and applies alternating weights of 4 and 2 to interior nodes, with weight 1 at the endpoints. Because of its high accuracy per function evaluation, Simpson's rule is a standard default quadrature routine in numerical software.
Intuition
Where the trapezoidal rule connects sample points with straight edges, Simpson's rule bends a gentle parabola through each trio of neighboring points, hugging curved data far better than a straight line can. Because a parabola can match not just the height and slope of a smooth curve but also its curvature at the sample points, the resulting piecewise-parabolic approximation tracks the true function much more closely — and since the error term now depends on the fourth derivative rather than the second, Simpson's rule is exact even for cubics and converges dramatically faster as the step size shrinks.
Formal Definition
On a pair of subintervals [x₀, x₂] of width 2h, fit a parabola through (x₀,f₀), (x₁,f₁), (x₂,f₂) and integrate it exactly:
Worked Examples
Step size h = (1−0)/4 = 0.25; nodes x = 0, 0.25, 0.5, 0.75, 1.
Function values f(x) = 1/(1+x²).
Apply Simpson's formula (h/3)[f₀ + 4(f₁+f₃) + 2f₂ + f₄].
Compare with the exact value π/4 ≈ 0.785398.
Answer: Simpson's estimate ≈ 0.785392 vs. exact π/4 ≈ 0.785398 (error ≈ 0.000006, far tighter than the trapezoidal rule's error of 0.0026 on the same nodes).
Practice Problems
Use Simpson's rule with n = 2 to approximate ∫₀² x³ dx, and compare with the exact value.
A car's velocity (m/s) at 0, 1, 2, 3, 4 seconds is 0, 3, 8, 15, 24 (v(t) = t² + 2t). Use Simpson's rule with n = 4 to estimate distance traveled.
Simpson's rule is exact (zero truncation error) for polynomials up to and including degree:
Quiz
Summary
- Simpson's rule fits a parabola through each set of three consecutive points: (h/3)[f₀+4f₁+f₂] per panel pair.
- It is exact for polynomials up to degree 3 and has O(h⁴) truncation error, far better than the trapezoidal rule's O(h²).
- The composite rule needs an even number of subintervals and alternates weights 4 and 2 on interior nodes.
References
- WebsiteWikipedia — Simpson's rule
Mathematics