How to use the Integral Calculator
- Choose the function you want to integrate.
- Enter the lower limit a and upper limit b.
- Set the number of intervals — 1,000 is ample for smooth functions.
- Read Simpson's result as the primary answer.
- Compare the two methods: a tiny difference means the answer has converged.
How the calculation works
A definite integral is the signed area between a curve and the horizontal axis over an interval. Numerical integration approximates that area by slicing the interval into strips and summing simple shapes. The trapezoid rule joins consecutive points with straight lines, so each strip is a trapezoid; its error shrinks with the square of the strip width.
Simpson's rule fits a parabola through each consecutive triple of points instead of a straight line, which captures curvature and reduces the error to the fourth power of the strip width. Halving the strip width cuts trapezoid error by four but Simpson's error by sixteen. Because it needs points in pairs, Simpson's rule requires an even number of intervals; the calculator quietly rounds up if you enter an odd number.
Showing both results is deliberate. When two methods of different order agree to eight decimal places, the answer has almost certainly converged. When they disagree, the integrand is misbehaving — a singularity inside the interval, a sharp spike the sampling missed, or limits that stray outside the function's domain. Integrating 1/x across zero, or √x below zero, produces confident-looking garbage in any numerical scheme, and the disagreement between methods is your warning.
Simpson: ∫ ≈ (h/3)[f(a) + 4f(x₁) + 2f(x₂) + … + f(b)]; Trapezoid: ∫ ≈ h[f(a)/2 + f(x₁) + … + f(b)/2], h = (b−a)/nSource: Newton–Cotes quadrature formulas; see Burden & Faires, Numerical Analysis, Chapter 4.4.
Worked example
Find the area under f(x) = x² from x = 0 to x = 2 — the classic check case with a known exact answer of 8/3.
- Select x², set a = 0, b = 2, n = 1000.
- Strip width h = 2/1000 = 0.002.
- Simpson's rule returns 2.66666667.
- The trapezoid rule returns 2.66666800, a difference of about 1.3 × 10⁻⁶.
2.6666667 against the exact 8/3 = 2.6666667 — Simpson's rule is exact for polynomials up to cubic, so the only error is round-off.
Frequently asked questions
Why is Simpson's rule exact for my polynomial?+
It fits parabolas, so it reproduces any quadratic exactly — and by a symmetry cancellation it also handles cubics exactly. Only quartic and higher terms leave residual error.
What does a negative result mean?+
The curve lies below the axis over part or all of the interval. The integral is a signed area; for total unsigned area, integrate the absolute value in pieces.
Can I integrate to infinity?+
Not directly. Substitute to map the infinite range onto a finite one, or integrate to a large finite limit and confirm the result stops changing.
How many intervals do I need?+
Increase n until the answer stops moving at the precision you care about. For smooth functions a few hundred is usually plenty.
Last reviewed August 31, 2026. We review this page whenever the underlying formula, tax year, published rate or standard changes.