How to use this calculator
Enter the integrand as a function of x and the two limits. The large number is the integral computed by adaptive Gauss–Kronrod quadrature, which keeps splitting the interval where the function is hardest to integrate until the estimated error is about 10−11 relative to the answer. The table compares the five methods usually taught in calculus and numerical methods courses, using the n you choose, and shows how far each one is from the accurate value.
The numerical methods
With step h = (b − a)/n and points xi = a + ih:
Doubling n roughly halves the Riemann-sum error, quarters the midpoint and trapezoid errors, and cuts Simpson’s error by about 16. Try it in the calculator to see the pattern.
Worked example
∫₀² eˣ dx with n = 4 (the default)
- Exact value: e² − 1 = 6.389056.
- h = 0.5. Left sum 4.924346 (error −1.465); right sum 8.118874 (error +1.730).
- Midpoint 6.322986 (error −0.0661); trapezoid 6.521610 (error +0.1326). The midpoint error is about half the trapezoid error with the opposite sign, which is typical.
- Simpson 6.391210, an error of only 0.00215 from five function values.
Integrals in engineering
Definite integrals turn rates and distributions into totals. The area under a load-intensity curve is the total load, and the first moment of that area locates the resultant. Integrating shear gives bending moment, integrating M/EI twice gives deflection, and integrating over a cross-section gives its area and second moment of area. When the integrand comes from measured data rather than a formula, the trapezoidal and Simpson’s rules are exactly the tools engineers use.
Frequently asked questions
Does this find the antiderivative?
No. It computes the numerical value of a definite integral. For indefinite integrals you need a symbolic algebra system, although you can check an antiderivative F by confirming that F(b) − F(a) matches the value here.
What does a negative answer mean?
Area below the x-axis counts as negative, and swapping the limits flips the sign. The graph shades positive area in blue and negative area in red.
What happens with improper integrals?
Integrable singularities at an endpoint, such as 1/√x on [0, 1], work because the method never evaluates the endpoints. If the function blows up inside the interval, split the integral at that point. Infinite limits are not supported.
Why is the trapezoid rule undefined for my function?
The trapezoid, left, right and Simpson rules evaluate f at the endpoints. If f is infinite there, those methods fail while the midpoint rule and the accurate value still work.