Numerical Integral Calculator
This calculator estimates the definite integral of a function over an interval using two classic quadrature rules. The composite trapezoidal rule sums trapezoids under the curve, while the composite Simpson's rule fits parabolas and is usually much more accurate for smooth functions. Enter a function of x, the lower and upper limits, and the number of subintervals to control accuracy. Comparing the two results gives a quick sense of how well the integral has converged. The expression parser supports the common arithmetic, power, trigonometric, exponential and logarithmic operations.
Quadrature formula
h = (b - a) / n
Trapezoidal = h * (f(a)/2 + f(a+h) + ... + f(b-h) + f(b)/2)
Simpson's = h/3 * (f(a) + 4*f(odd nodes) + 2*f(even nodes) + f(b))
Simpson's requires n even
Use x as the variable. Supported: + - * / ^, sin, cos, tan, exp, ln, log, sqrt, abs, pi, e.
Numerical integration context
- The trapezoidal rule has error proportional to h squared.
- Simpson's rule has error proportional to h to the fourth power, so it converges faster.
- Simpson's rule needs an even number of subintervals; odd inputs are rounded up.
- A large gap between the rules signals rapid change; increase the subintervals.
- The methods assume the function is finite and smooth on the closed interval.
Numerical integral: frequently asked questions
What methods does this integral calculator use?
It computes the definite integral two ways: the composite trapezoidal rule and the composite Simpson's rule, both over the number of subintervals you choose. Simpson's rule fits parabolas to pairs of intervals and is usually far more accurate than the trapezoidal rule for smooth functions.
How many subintervals should I use?
More subintervals give more accuracy until floating-point limits dominate. A few hundred is plenty for most smooth functions. Simpson's rule requires an even number of subintervals; if you enter an odd number the calculator rounds up to the next even value for that method.
What functions can I integrate?
Use x as the variable with standard notation: plus, minus, times as star, divide, power as caret, and parentheses. Supported functions include sin, cos, tan, exp, ln, log base 10, sqrt, abs and the inverse and hyperbolic trig functions. Constants pi and e are recognised.
Can it handle improper integrals or singularities?
No. The methods assume the function is finite and well behaved on the closed interval. If the function blows up inside the interval or at an endpoint, the numerical estimate will be inaccurate or non-finite. Split the integral or use a different technique in those cases.
Why do the two rules sometimes disagree?
The trapezoidal rule has error proportional to the square of the step size, while Simpson's rule has error proportional to the fourth power, so Simpson's is normally closer to the true value. A large gap between the two suggests the function is changing quickly and you should increase the number of subintervals.
Official sources
- NIST Digital Library of Mathematical Functions: Numerical Methods, quadrature.
- U.S. National Institute of Standards and Technology: NIST home, mathematical references.
Reviewed by the CalculatorHub team, edited by James Graham, 17 June 2026. See our methodology.