DigitHelm

Integral Calculator | Numerical

Compute definite integrals numerically using Simpson's rule and the trapezoidal rule.

What Is the Integral Calculator | Numerical?

This numerical integral calculator evaluates definite integrals of standard functions over a specified interval. It combines an exact antiderivative mode for common function types with high-accuracy numerical methods (Simpson's rule and the trapezoidal rule) for comparison.

  • Two evaluation modes: Exact antiderivative (for power, exponential, trig, and reciprocal functions) and numerical approximation via Simpson's rule with up to 1,000 subdivisions.
  • Method comparison: Both Simpson's and trapezoidal approximations are shown side by side, with the error relative to the exact answer displayed when available.
  • Antiderivative display: For the built-in function types, the antiderivative formula (e.g., x³/3 for x²) is shown before the numerical evaluation.
  • Presets: Common textbook integrals pre-loaded, ∫x² [0,3], ∫eˣ [0,1], ∫sin(x) [0,π], ∫1/x [1,e], and more.
  • Step-by-step working: Collapsible panel showing the substitution and evaluation at each bound.

Formula

Definite Integral (Fundamental Theorem of Calculus)

∫ₐᵇ f(x) dx = F(b) − F(a) where F'(x) = f(x)

Simpson's Rule (Numerical Approximation)

∫ₐᵇ f(x) dx ≈ (h/3)[f(x₀) + 4f(x₁) + 2f(x₂) + 4f(x₃) + … + f(xₙ)]

where h = (b − a)/n, n even

Trapezoidal Rule

∫ₐᵇ f(x) dx ≈ (h/2)[f(x₀) + 2f(x₁) + 2f(x₂) + … + f(xₙ)]

SymbolNameDescription
f(x)IntegrandThe function being integrated, entered as an expression (x^2, sin(x), etc.)
aLower boundThe left endpoint of the integration interval
bUpper boundThe right endpoint of the integration interval
nSubdivisionsNumber of equal sub-intervals; more subdivisions = greater accuracy
hStep sizeh = (b − a)/n, the width of each sub-interval
F(x)AntiderivativeA function whose derivative is f(x); used in exact symbolic mode

How to Use

  1. 1
    Select a function type: Choose from power (xⁿ), exponential (eˣ), sin, cos, sec², reciprocal (1/x), arcsin, or arctan.
  2. 2
    Enter the power n if needed: For the xⁿ function type, type the exponent n (e.g., 2 for x²). Leave blank for other types.
  3. 3
    Choose mode: Select "Definite" for a numeric result over [a, b], or "Antiderivative" for the indefinite integral formula.
  4. 4
    Enter the bounds: Type the lower (a) and upper (b) limits of integration. You can enter π as 3.14159 or use the displayed value.
  5. 5
    Try a preset: Click any preset label to load a classic textbook example with all values pre-filled.
  6. 6
    Press Enter or Calculate: Results show the exact value (if available), Simpson's approximation, trapezoidal approximation, and the antiderivative formula.
  7. 7
    Expand the working: Click "Step-by-step" to see the antiderivative evaluated at both bounds and the final subtraction.

Example Calculation

Evaluate ∫₀³ x² dx

f(x) = x², a = 0, b = 3

Step 1: Find the antiderivative

F(x) = x³/3 + C

Step 2: Apply fundamental theorem

∫₀³ x² dx = F(3) − F(0)

= (3³/3) − (0³/3)

= 27/3 − 0

= 9.000000 (exact)

Simpson's rule with n=1000 also gives 9.000000, confirming accuracy for smooth polynomials.

Geometric interpretation

The definite integral ∫₀³ x² dx = 9 represents the area of the region bounded by y = x², the x-axis, and the vertical lines x = 0 and x = 3. The parabola curves from (0,0) to (3,9), and the area below it equals exactly 9 square units.

Understanding Integral | Numerical

What Is a Definite Integral?

A definite integral ∫ₐᵇ f(x) dx gives the signed area between the function f(x) and the x-axis from x = a to x = b. Areas above the x-axis count positive; areas below count negative. The fundamental theorem of calculus connects differentiation and integration: if F'(x) = f(x), then ∫ₐᵇ f(x) dx = F(b) − F(a).

Why Use Numerical Integration?

Many functions do not have a simple closed-form antiderivative. The Gaussian function e^(−x²), for example, cannot be expressed in terms of elementary functions, yet its integral from −∞ to ∞ is √π. Numerical methods like Simpson's rule compute accurate approximations without requiring an antiderivative.

  • Simpson's rule fits parabolic arcs through sets of three points. Error is proportional to h⁴, halving the step size reduces error by a factor of 16. It is significantly more accurate than the trapezoidal rule for smooth functions.
  • Trapezoidal rule approximates the function with straight-line segments between adjacent points. Error is proportional to h². Less accurate than Simpson's but simpler and more stable for discontinuous functions.

Common Integrals to Know

  • ∫ xⁿ dx = xⁿ⁺¹/(n+1) + C (n ≠ −1)
  • ∫ eˣ dx = eˣ + C
  • ∫ 1/x dx = ln|x| + C
  • ∫ sin(x) dx = −cos(x) + C
  • ∫ cos(x) dx = sin(x) + C
  • ∫ sec²(x) dx = tan(x) + C

Real-World Applications

  • Physics: work = ∫ F·dx (force over displacement); charge = ∫ I dt (current over time).
  • Statistics: probability of an event = ∫ PDF(x) dx over the event range.
  • Engineering: signal energy = ∫ |x(t)|² dt; heat transferred = ∫ Q dt.
  • Economics: consumer and producer surplus are areas under or above price-quantity curves.

Frequently Asked Questions

What is the difference between definite and indefinite integrals?

A definite integral ∫ₐᵇ f(x) dx has specific limits a and b. It evaluates to a number, the signed area under the curve between those bounds.

An indefinite integral ∫ f(x) dx has no limits. It evaluates to a family of functions F(x) + C (where C is an arbitrary constant), the set of all antiderivatives of f(x).

How accurate is Simpson's rule?

Simpson's rule has error proportional to h⁴ × (b−a), where h = (b−a)/n. With n = 1,000 subdivisions, the error is roughly 10⁻¹² for smooth functions, well within double-precision floating point accuracy.

The rule is exact for polynomials of degree ≤ 3. For functions with sharp discontinuities or spikes, accuracy may degrade, and smaller step sizes are needed.

What does "signed area" mean?

When a function is negative (below the x-axis), the integral contributes a negative area. For example, ∫₀^(2π) sin(x) dx = 0 because the positive area from 0 to π exactly cancels the negative area from π to 2π.

If you want the total (unsigned) area regardless of sign, integrate |f(x)| instead, or split the integral at the zero crossings.

What is the Fundamental Theorem of Calculus?

The Fundamental Theorem of Calculus connects differentiation and integration. It has two parts:

  • Part 1: If F(x) = ∫ₐˣ f(t) dt, then F'(x) = f(x). Integration and differentiation are inverse operations.
  • Part 2: ∫ₐᵇ f(x) dx = F(b) − F(a), where F is any antiderivative of f. This is the practical formula used to evaluate definite integrals.

Can I integrate functions not listed in the calculator?

This calculator supports power, exponential, sine, cosine, sec², arcsin, arctan, and reciprocal (1/x) functions. For other functions, such as ln(x), tan(x), or composite expressions, use the Riemann Sum Calculator or a computer algebra system.

For improper integrals (infinite bounds or discontinuities), see the Improper Integral Calculator.

What is integration by substitution?

Integration by substitution (u-substitution) is the integral analogue of the chain rule. If the integrand contains a composite function f(g(x)) × g'(x), let u = g(x), du = g'(x) dx, transforming the integral into ∫ f(u) du.

For example: ∫ 2x cos(x²) dx. Let u = x², du = 2x dx. The integral becomes ∫ cos(u) du = sin(u) + C = sin(x²) + C.

Related Calculators