Simpson's Rule Integral Calculator
Simpson's rule estimates a definite integral by fitting parabolas through groups of points, which makes it much more accurate than simpler methods for smooth functions. This calculator applies the composite Simpson's rule over the number of subintervals you choose, returning the integral estimate, the step size, and the function values at the endpoints. The number of subintervals must be even because each parabola spans two of them; odd inputs are rounded up. The expression parser supports standard arithmetic, powers, and the common trigonometric, exponential and logarithmic functions.
Composite Simpson's rule
h = (b - a) / n, with n even
Integral = h/3 * [ f(a) + 4*(f1 + f3 + ...) + 2*(f2 + f4 + ...) + f(b) ]
where f_k = f(a + k*h)
Use x as the variable. Supported: + - * / ^, sin, cos, tan, exp, ln, log, sqrt, abs, pi, e.
Simpson's rule context
- The rule is exact for polynomials up to degree three.
- Error scales with the fourth power of the step size for smooth functions.
- The number of subintervals must be even; odd inputs are rounded up.
- Endpoints have weight one, odd nodes weight four, even interior nodes weight two.
- The integral of sin from 0 to pi is exactly 2, a good test case.
Simpson's rule: frequently asked questions
What is Simpson's rule?
Simpson's rule approximates a definite integral by fitting parabolas through groups of three equally spaced points. The composite version applies this across many subintervals. It is fourth-order accurate, so its error falls with the fourth power of the step size, making it far more accurate than the trapezoidal rule for smooth functions.
Why must the number of subintervals be even?
Simpson's rule pairs subintervals: each parabola spans two subintervals using three nodes. That requires an even number of subintervals overall. If you enter an odd number, the calculator rounds it up to the next even number so the rule applies cleanly.
What is the weighting pattern in the formula?
The endpoints get weight one, the interior nodes at odd positions get weight four, and the interior nodes at even positions get weight two. The weighted sum is multiplied by the step size divided by three. This pattern, 1, 4, 2, 4, 2, ..., 4, 1, is the heart of the composite rule.
What functions can I integrate?
Use x as the variable with plus, minus, times as star, divide, power as caret, and parentheses. Supported functions include sin, cos, tan, exp, ln, log base 10, sqrt, abs and the inverse and hyperbolic trig functions. Constants pi and e are recognised.
Is Simpson's rule always exact?
It is exact for polynomials up to degree three, and very accurate for smooth functions. For functions with sharp features, discontinuities or singularities, the estimate can be poor. Increasing the number of subintervals improves accuracy for smooth integrands up to floating-point limits.
Official sources
- NIST Digital Library of Mathematical Functions: Numerical Methods, quadrature.
- U.S. National Institute of Standards and Technology: NIST home, mathematical references.
Reviewed by the CalculatorHub team, edited by James Graham, 17 June 2026. See our methodology.