Definite Integral Calculator (Numerical)
This calculator numerically estimates the definite integral of any function f(x) from a lower limit a to an upper limit b. It uses Simpson's rule with 1000 equal subintervals, which gives very high accuracy for smooth functions. Simpson's rule approximates the area under the curve by fitting quadratic polynomials through triplets of consecutive points. Enter f(x) as a JavaScript expression, the lower limit a, and the upper limit b. For example, to integrate sin(x) from 0 to pi, enter Math.sin(x) with a=0 and b=3.14159265. The exact answer is 2.000 and this calculator will match it to at least 6 decimal places. The calculator supports +, -, *, /, ** (power), Math.sqrt, Math.sin, Math.cos, Math.tan, Math.exp, Math.log (natural log), and Math.PI. The result shown is the net signed area: regions below the x-axis count negatively. The Fundamental Theorem of Calculus guarantees that for any continuous f with antiderivative F, the definite integral equals F(b) minus F(a).
Simpson's rule formula
h = (b - a) / n (n = 1000, must be even)
Integral ≈ (h/3) * [f(x0) + 4f(x1) + 2f(x2) + 4f(x3) + ... + 4f(x(n-1)) + f(xn)]
Error bound: |error| ≤ (b-a)^5 * max|f''''| / (180 * n^4)
With n=1000, error is negligible for smooth functions.
Common integrals reference
| f(x) | a | b | Exact integral |
|---|---|---|---|
| sin(x) | 0 | pi | 2 |
| cos(x) | 0 | pi/2 | 1 |
| x^2 | 0 | 3 | 9 |
| e^x | 0 | 1 | e - 1 ≈ 1.71828 |
| 1/x | 1 | e | 1 (= ln(e)) |
Definite integrals: frequently asked questions
What is a definite integral?
The definite integral of f(x) from a to b, written as the integral from a to b of f(x) dx, represents the net signed area between the curve y = f(x) and the x-axis over the interval [a, b]. Positive area above the x-axis contributes positively; negative area below contributes negatively.
What is Simpson's rule?
Simpson's rule approximates an integral by fitting parabolas to consecutive triplets of equally spaced points. For n subintervals (n must be even), it computes h = (b-a)/n and approximates the integral as (h/3)*(f(x0) + 4*f(x1) + 2*f(x2) + 4*f(x3) + ... + f(xn)). The error is proportional to (b-a)*h^4, much smaller than the rectangle rule.
What functions can I enter?
This calculator accepts JavaScript mathematical expressions. Use x as the variable. You can use +, -, *, /, ** (power), Math.sqrt(), Math.sin(), Math.cos(), Math.tan(), Math.exp(), Math.log() (natural log), Math.abs(), Math.PI. Example: Math.sin(x)**2 for sin squared x, or Math.exp(-x**2) for the Gaussian.
How accurate is this calculator?
With 1000 subintervals, Simpson's rule gives typically 8 to 12 significant figures of accuracy for smooth functions. Accuracy decreases near discontinuities or singularities. For very rapidly oscillating functions or improper integrals (with infinite limits), accuracy may be lower. Always check results against known values where possible.
What is the Fundamental Theorem of Calculus?
The Fundamental Theorem of Calculus connects differentiation and integration. It states that if F is an antiderivative of f (meaning dF/dx = f(x)), then the integral from a to b of f(x) dx equals F(b) - F(a). This means integration and differentiation are inverse operations. Numerical integration like Simpson's rule is used when no closed-form antiderivative exists.
Sources
- Numerical integration, Simpson's rule: NIST DLMF 3.5, Quadrature.
- Fundamental Theorem of Calculus: NIST DLMF 1.4, Calculus of One Variable.
Reviewed by the CalculatorHub team, edited by James Graham, 14 June 2026. See our methodology.