Skip to content

Simpson's Rule Calculator

Approximate a definite integral with Simpson's 1/3 rule, with a node table, graph and error estimate.

AvailableRuns in your browserFree · No sign-up

Simpson's Rule Calculator

Examples:

Variable x. Functions: sin, cos, tan, sec, csc, cot, asin, acos, atan, sinh, cosh, tanh, exp, log, ln, log10, log2, sqrt, cbrt, abs. Constants: pi, e.

Number or expression, e.g. pi/2.

Calculations use full double precision; this only affects display.

Simpson's 1/3 rule

∫ₐᵇ f(x) dx ≈ (h/3) [f(x₀) + 4f(x₁) + 2f(x₂) + 4f(x₃) + … + 4f(xn−1) + f(xn)]

Split [a, b] into n equal subintervals of width h = (b − a)/n, with n even. Each pair of subintervals is approximated by the parabola through its three points, giving weights 1, 4, 2, 4, …, 2, 4, 1. The error shrinks like h⁴ for smooth functions. If you enter an odd n, the tool asks you to change it rather than changing it for you.

Your data is processed locally in your browser and is not uploaded to OZVILO servers.

How to use the Simpson's Rule Calculator

  1. 1Enter the function f(x), the limits a and b, and an even number of subintervals n.
  2. 2Press Calculate.
  3. 3Read the approximation, step size h, weighted sum and estimated error.
  4. 4Check the graph and the table of nodes and weights, and download it as CSV.

Examples

  • A polynomial

    Input
    ∫₀³ x² dx, n = 6
    Result
    9 — exact, because Simpson's rule is exact for cubics
  • sin(x)

    Input
    ∫₀^π sin(x) dx, n = 10
    Result
    ≈ 2.000110 (exact value 2), estimated error ≈ 1.1e−4
  • Odd n

    Input
    n = 7
    Result
    Asks for an even n (6 or 8) instead of changing it

Simpson's Rule Calculator features

  • Simpson's 1/3 rule with full working
  • Error estimate from n and 2n
  • Graph with nodes
  • Safe expression parser
  • CSV download

Frequently asked questions

Why must n be even?

Simpson's rule fits a parabola through each pair of subintervals (three points), so the subintervals must pair up. If you enter an odd n, the tool explains this and suggests a value rather than silently changing yours.

What is the formula?

∫ₐᵇ f(x) dx ≈ (h/3)[f(x₀) + 4f(x₁) + 2f(x₂) + 4f(x₃) + … + 4f(xₙ₋₁) + f(xₙ)], with h = (b − a)/n.

How accurate is it?

For smooth functions the error shrinks like h⁴, so doubling n cuts it about 16-fold. The estimate shown compares n with 2n subintervals; it's a guide and can be misleading if f has a singularity or sharp corner in the interval.

What happens if f(x) isn't defined somewhere?

If f is undefined, infinite or complex at any node — such as 1/x at 0 or sqrt(x) for negative x — the tool stops and tells you where, instead of returning a wrong number.