Simpson’s Rule Calculator
The integral of a function you only have as evenly spaced values — Simpson’s rule alongside the trapezoidal rule — for data from experiments, sensors or a function too awkward to integrate by hand.
Simpson’s rule fits a parabola through each pair of intervals: with spacing h and values y₀ … yₙ (n even), the integral is h ÷ 3 × (y₀ + 4y₁ + 2y₂ + 4y₃ + … + 4yₙ₋₁ + yₙ).
How the simpson’s rule calculator works
Simpson’s rule fits a parabola through each pair of intervals: with spacing h and values y₀ … yₙ (n even), the integral is h ÷ 3 × (y₀ + 4y₁ + 2y₂ + 4y₃ + … + 4yₙ₋₁ + yₙ). It is exact for cubics and far more accurate than the trapezoidal rule for smooth data. If you give an even number of points (odd number of intervals), the last panel is done by the trapezoidal rule.
Formula: Simpson: (h ÷ 3) Σ [y₀ + 4·odd + 2·even + yₙ]; trapezoid: h × (½y₀ + y₁ + … + ½yₙ)
Worked examples
| Inputs | Simpson’s rule integral | Note |
|---|---|---|
| x² sampled 0 to 6 | 72 | 72 — exact |
| Five samples of a curve | 4.6667 | 4.67 |
| Four samples (odd intervals) | 21.5 | Simpson on two, trapezoid on the last |
FAQFrequently asked questions
Why is Simpson’s rule more accurate?
The trapezoid rule assumes the function is straight between points; Simpson assumes it curves like a parabola, which follows smooth functions far more closely. Its error shrinks with h⁴, the trapezoid’s only with h².
Why must the number of intervals be even?
Each parabola spans two intervals. With an odd count the calculator handles the last interval with a trapezoid, which is slightly less accurate but keeps the result honest.
What spacing should I use?
Whatever your samples are; the values must be equally spaced. Halving the spacing cuts the Simpson error by about sixteen times if the function is smooth.
Does it work for noisy data?
Simpson amplifies noise slightly more than the trapezoid rule because of the alternating weights. For rough experimental data the two answers will be close, and the trapezoid may even be safer.
Where these figures come from
- NIST Digital Library of Mathematical Functions — reference definitions for elementary and special functions
- Wolfram MathWorld — definitions and formulas for every topic on this page
- NIST/SEMATECH e-Handbook of Statistical Methods — the statistical formulas (mean, variance, z, confidence intervals, sample size)
- Australian Curriculum (ACARA) — Mathematics — the terms and methods taught in Australian schools
Last checked: September 2026. Formulas are fixed by mathematics and do not change with tax years or regulations.