Simpson's Rule Calculator

Approximate integrals with parabolic arcs — far more accurate than rectangles for the same n.

Simpson's Rule Calculator

What Is Simpson's Rule?

Simpson's rule approximates definite integrals by fitting a parabola through each consecutive trio of sample points and summing the exact areas under those parabolic arcs — a genuine curve matched to a curve, rather than a flat or slanted stand-in. Where rectangles (Riemann sums) ignore a function's slope and trapezoids ignore its curvature, parabolas capture both — which is why Simpson's rule routinely delivers several more correct digits than the trapezoidal rule from the very same sample points.

With an even number n of subintervals of width h = (b−a)/n, the parabola areas combine into the celebrated 1-4-2-4-2-…-4-1 weighting:

S = (h/3)·[f(x₀) + 4f(x₁) + 2f(x₂) + 4f(x₃) + ⋯ + 4f(xn−1) + f(xn)]

Odd-indexed points get weight 4 (each is the vertex sample of one parabola), even-indexed interior points get weight 2 (shared between adjacent parabola pairs), and the endpoints get weight 1. The requirement that n be even exists because each parabola consumes exactly two subintervals.

How to Use This Calculator

Enter a function, the bounds, and an even subinterval count. The calculator evaluates the sample table, applies the 1-4-2-4 weights, and reports the estimate next to a very-high-precision reference so you can read the error directly. Watch the error as you bump n: doubling n divides Simpson's error by roughly sixteen (h⁴ scaling), compared with four for trapezoids — accuracy compounds astonishingly fast.

Worked Example

Approximate ∫₀^π sin(x) dx with n = 4. Then h = π/4 ≈ 0.7854, with samples f(0)=0, f(π/4)=0.7071, f(π/2)=1, f(3π/4)=0.7071, f(π)=0:

S = (h/3)·[0 + 4(0.7071) + 2(1) + 4(0.7071) + 0] = (0.2618)(7.6569) ≈ 2.0046

The exact answer is 2, so four subintervals already land within 0.005 — about 0.2% error. The trapezoidal rule with the same four subintervals gives 1.8961, off by 5%: a twenty-fold accuracy gap from identical function evaluations.

Why Parabolas Work So Well

Simpson's rule is exact for every polynomial up to degree 3 — cubics included, which is one degree better than the parabola fitting suggests. The bonus comes from symmetry: over each double-interval, a cubic's deviation from its fitted parabola is an odd function about the center, so its integral cancels exactly. The first shape Simpson's rule can't integrate perfectly is a quartic, and its error formula reflects that, depending on the fourth derivative: |error| ≤ (b−a)h⁴·max|f⁽⁴⁾|/180. Functions with small fourth derivatives — smooth, gently bending curves — are integrated almost perfectly even at tiny n.

Common Mistakes to Avoid

  • Using an odd n. The parabola pairing demands an even count; this calculator enforces it rather than silently producing nonsense.
  • Scrambling the 4s and 2s. The pattern is 1, then alternating 4, 2, 4, 2, …, ending 4, 1. First and last interior weights are always 4.
  • Writing h/2 instead of h/3. Trapezoids use h/2; Simpson's uses h/3 — mixing up the two prefactors is a frequent exam slip.
  • Applying it across singularities. Like all quadrature, Simpson's assumes smoothness; a spike or asymptote inside [a, b] invalidates the error guarantee. Handle those with the Improper Integral Calculator or by splitting the interval.

Real-World Applications

Simpson's rule is the engine inside a large share of practical integration. This very site uses it: the Definite Integral Calculator, Arc Length Calculator, and Average Value Calculator all evaluate their integrals with Simpson's rule under the hood, at a few thousand subintervals — accuracy to many decimal places at negligible cost. Naval architects computing hull displacement volumes have used "Simpson's multipliers" on measured cross-sections for over a century, and the technique remains in ship-design standards today.

Beyond engineering, dose calculations in radiotherapy, probability mass under measured distributions, and energy from power curves all lean on Simpson-type quadrature whenever the integrand is smooth enough to reward it. Its cost-accuracy ratio is hard to beat: for smooth functions, a dozen evaluations often deliver engineering-grade precision that rectangles would need thousands of slices to match.

Frequently Asked Questions

Why must n be even for Simpson's rule?

Each parabola is fitted through three consecutive points, spanning two subintervals — so subintervals are consumed in pairs. An odd n would leave one subinterval without a parabola partner. (Variants like Simpson's 3/8 rule handle leftover thirds with cubics.)

How much better is Simpson's rule than the trapezoidal rule, really?

Error scales as h⁴ versus h². Concretely: going from n=10 to n=100 improves trapezoids by ~100× but Simpson's by ~10,000×. For smooth integrands the practical answer is "several extra correct digits for free."

Where does the 1-4-2-4-1 pattern come from?

Integrating the quadratic through three equally spaced points (x₀, x₁, x₂) exactly gives (h/3)(f₀ + 4f₁ + f₂) — weights 1, 4, 1 per parabola. Chaining parabolas end-to-end makes shared boundary points add their 1s into 2s, producing 1, 4, 2, 4, …, 2, 4, 1.

Is Simpson's rule always more accurate than trapezoids?

For smooth functions, essentially always. Exceptions: integrands with discontinuous low-order derivatives (kinks), where the h⁴ theory doesn't apply, and smooth periodic functions over full periods, where trapezoids are anomalously excellent. When in doubt, compute both — this calculator and its trapezoidal sibling make the comparison one click.

Who was Simpson?

Thomas Simpson (1710–1761), a self-taught English mathematician and textbook author. True to Stigler's law, the rule appears earlier — Cavalieri, Gregory, and even Kepler (estimating wine-barrel volumes) used parabolic approximation before Simpson popularized it.

What are adaptive quadrature methods?

Production integration routines apply Simpson's rule recursively with error control: estimate a stretch, split it in half, compare the two answers, and subdivide further only where they disagree. Smooth regions get a handful of samples while sharp features attract them automatically — delivering a requested error tolerance at minimum cost. When a calculator or library advertises "tolerance 1e-8," an adaptive Simpson or Gauss scheme is usually doing exactly this behind the scenes.

Does Simpson's rule work on tabulated data?

Yes, provided the points are evenly spaced and you have an odd count of them (an even number of gaps). Lab measurements taken at fixed intervals fit naturally; irregularly sampled data is better served by the trapezoidal rule, which has no spacing requirement.