Math

Numerical Integration Calculator

Compute a definite integral numerically with the trapezoid rule, Simpson rule, Romberg extrapolation and Gauss-Legendre quadrature, comparing the methods and estimating the error.

Last reviewed by the Radiatus Cloud team

Result appears here.

Need this done properly for your business?

Radiatus delivers secure cloud, DevOps & compliance engineering.

Book a free consult

Numerical integration is how most integrals get evaluated

Many perfectly ordinary functions have no antiderivative expressible in elementary terms. The Gaussian, the sine integral and the error function are all defined by integrals that cannot be evaluated symbolically, and in engineering the integrand is frequently measured data with no formula at all. Numerical quadrature answers the question anyway, by sampling the function at chosen points and combining the values with weights.

The methods differ in how fast the error shrinks

The trapezoid rule approximates the curve by straight segments and its error falls with the square of the step size. Simpson's rule fits parabolas through successive triples of points and its error falls with the fourth power, which for a smooth function means roughly two extra correct digits every time the interval count doubles. Romberg extrapolation combines trapezoid results at several step sizes to cancel the leading error terms, and Gauss-Legendre quadrature chooses both the sample points and the weights to be exact for polynomials of the highest possible degree given the number of samples.

Smoothness is what the accuracy depends on

All of these error estimates assume the integrand has continuous derivatives of sufficient order. A function with a kink, a jump or an infinite value inside the interval breaks the assumption, and Simpson's rule can then be less accurate than the trapezoid rule despite its better theoretical order. When the methods here disagree with each other, that disagreement is the useful signal: it means the integrand is not smooth enough for the estimates to be trusted.

Related tools

  • Percentage Calculator — Calculate percentages, percentage change, increase and decrease, and reverse percentages, with the working shown for each result.
  • Statistical Calculator — Calculate mean, median, mode, standard deviation, and more.
  • Probability Calculator — Calculate probabilities for single and combined events, including conditional probability and Bayes' theorem.
  • Scientific Calculator — Perform advanced mathematical operations including trig, log, and exponents.

Frequently Asked Questions

Which method should I trust?

Compare them. For a smooth integrand, Romberg and Gauss-Legendre will agree to many digits and are the most accurate. When the methods disagree, the integrand is not smooth enough for the theory behind them to apply, and that disagreement is more informative than any single number.

Why is Simpson better than the trapezoid rule?

Because it fits parabolas rather than straight lines, so its error falls with the fourth power of the step size rather than the square. For a smooth function that means roughly two more correct digits each time the number of intervals doubles.

What is Gauss-Legendre quadrature?

A method that chooses both the sample positions and their weights so the result is exact for polynomials up to degree 2n−1 with n samples. It is dramatically more efficient than evenly spaced methods for smooth functions and needs the function to be evaluable anywhere in the interval.

What happens with a singularity?

The error estimates stop being valid. A function that becomes infinite inside the interval, or has a kink or a jump, breaks the smoothness assumption behind every method here, and the results will disagree with each other. Split the interval at the problem point where you can.

Can I integrate measured data instead of a formula?

Not with this tool, which needs a function it can sample anywhere. The trapezoid and Simpson rules do apply to tabulated data at fixed points, which is the usual approach when the integrand comes from measurements.

Privacy & Security

Everything runs in your browser; nothing is uploaded.

Data: None
Client-side-Side
Active
v1.0

How to Use

Enter a function and the limits to compute its definite integral several ways.

Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.