Definite Integral Calculator
Compute the area under any curve between two limits, using composite Simpson's rule. Accurate to about 10−8 for smooth integrands.
Numerical definite integrator using composite Simpson's rule with adaptive sampling. Accurate to roughly 10−8 for smooth integrands.
How Simpson's rule works
The trapezoidal rule approximates a curve with straight line segments. Simpson's rule does better by approximating with parabolas, fitting a quadratic to every three consecutive sample points. For smooth integrands, Simpson's converges as O(h⁴), which means doubling the sample count reduces error by a factor of 16 — a huge improvement.
When numerical integration struggles
Three situations cause trouble:
- Integrable singularities. Functions like 1/√x on [0, 1] are integrable but the integrand blows up at one endpoint. Push the lower limit slightly off zero and accept a small bias.
- Highly oscillatory integrands. Something like sin(1000x) needs at least a few samples per oscillation; bump the sample count up.
- Improper integrals. The bounds must be finite numbers. For limits like ±∞ you need to substitute a variable change that maps the infinite interval to a finite one before using this calculator.
Default sample count
The default 2000 samples is generous for most problems and gives near-machine-precision results in milliseconds. Bump it to 20,000 for tricky integrands or drop it to 200 if you want a quick rough answer.