Skip to content
TheCalcUniverse

Integral Calc

Calculate definite integrals numerically using Simpsons rule with step-by-step formula breakdown. Supports polynomial, trig, and exponential functions.

✓ Tested formula & cited sources Formula verified 2026-01-15 Runs in your browser — inputs never sent anywhere

The formula

∫ₐᵇ f(x)dx ≈ (h/3)[f(a) + f(b) + 4 Σ f(x_odd) + 2 Σ f(x_even)], h = (b−a)/n, n even

f(x)
Integrand
a
Lower limit
b
Upper limit
n
Subdivisions
h
Step size
Full explanation ↓

How Integral Calc Works

∫ₐᵇ f(x)dx ≈ (h/3)[f(a) + f(b) + 4 Σ f(x_odd) + 2 Σ f(x_even)], h = (b−a)/n, n even

Simpson's 1/3 rule is a numerical integration method that approximates the definite integral by fitting quadratic (parabolic) arcs through every three consecutive points on the function. The interval [a, b] is divided into an even number n of equally-spaced subintervals of width h = (b − a) / n. Interior points are weighted alternately by 4 (odd indices) and 2 (even indices), reflecting the underlying quadratic interpolation. This method achieves O(h⁴) accuracy — significantly better than the trapezoidal rule's O(h²) — making it exact for polynomials up to degree 3.

f(x)
IntegrandThe function to be integrated, expressed in terms of the variable x.
a
Lower limitThe starting point of the integration interval.
b
Upper limitThe ending point of the integration interval.
n
SubdivisionsThe number of subintervals used for the numerical approximation. Must be even for Simpson's rule.
h
Step sizeThe width of each subinterval, computed as h = (b − a) / n.
The definite integral from a to b equals the signed area between the function curve and the x-axis.

How to Use

  1. Enter the function f(x) using x as the variable. Use ^ for powers (e.g., x^2 for x squared), * for explicit multiplication, and parentheses for grouping (e.g., (x^2 + 1) / (x - 1)).
  2. Enter the lower bound a and upper bound b to define the integration interval. The calculator automatically sorts a and b so lower ≤ upper.
  3. Optionally adjust the number of subdivisions n (default 100). Use higher values (e.g., 500–1000) for greater accuracy, especially for oscillatory functions.
  4. The result shows the approximate integral using Simpson's rule, along with the trapezoidal rule result for comparison. A small discrepancy between the two methods indicates high confidence in the result.
  5. The step-by-step work panel breaks down the computation: step size h, endpoint values, sums of odd/even terms, and the final Simpson formula application.

Quick Reference

∫ x² dx from 0 to 11/3 ≈ 0.33333
∫ 1 dx from 0 to 55
∫ x dx from 0 to 22
∫ (3x² + 2x) dx from 0 to 336

Common Uses

  • Computing areas under curves in physics (e.g., work from force–distance graph, displacement from velocity)
  • Calculating probabilities and cumulative distribution functions in statistics
  • Determining total accumulated quantities in engineering (charge, energy, fluid volume)
  • Verifying analytic integration done by hand in calculus coursework
  • Computing arc lengths, volumes of revolution, and centroids in geometry

Understanding the Result

Numerical integration is essential when a function has no elementary antiderivative (e.g., e^(−x²), sin(x)/x) or when only discrete data points from experiments or sensors are available. Simpson's 1/3 rule is one of the most widely used Newton–Cotes formulas for numerical integration. It works by dividing the interval [a, b] into an even number n of subintervals of equal width h = (b − a) / n. Over each pair of adjacent subintervals (three points: x_{i−1}, x_i, x_{i+1}), the function is approximated by a quadratic (degree-2) Lagrange interpolating polynomial.

The area under each quadratic segment is then computed exactly via analytical integration and summed to produce the total approximation. The error term for Simpson's rule is −(b − a)h⁴ / 180 × f⁽⁴⁾(ξ) for some ξ in (a, b), provided f is four times continuously differentiable. This means the method is exact for polynomials up to degree 3 (cubic), and doubling n reduces error by roughly a factor of 16 — much faster than the trapezoidal rule (factor of 4).

However, Simpson's rule can produce poor results for functions with sharp peaks, discontinuities, or rapid oscillations within the interval. In such cases, adaptive quadrature methods (which concentrate subdivisions where the function varies most) may be preferred. The calculator provides both Simpson and trapezoidal results so you can assess the reliability of the approximation: a large discrepancy between the two suggests the result should be treated with caution, or that more subdivisions are needed.

Frequently Asked Questions

Why must the number of subdivisions be even?
Simpson's 1/3 rule fits a quadratic polynomial through every three consecutive sample points (two adjacent subintervals). This requires an even total number of subintervals. If you enter an odd value, the calculator automatically increments it by 1 to make it even.
How does Simpson's rule compare to the trapezoidal rule?
Simpson's rule is significantly more accurate for smooth functions. The trapezoidal rule uses straight-line segments (linear interpolation) between points, giving error O(h²). Simpson's rule uses parabolic arcs (quadratic interpolation), giving error O(h⁴). For most smooth functions, Simpson's rule achieves the same accuracy with far fewer subdivisions.
What does the method discrepancy tell me?
The discrepancy between Simpson and trapezoidal results gives a rough error estimate. If the two methods agree closely (discrepancy < 0.001), you can have high confidence. A large discrepancy suggests the function has high curvature or irregularities — try increasing n or breaking the interval at points of rapid change.
What happens if my function has a singularity inside the interval?
Numerical integration methods including Simpson's rule assume the function is finite and well-behaved throughout [a, b]. If your function has a division by zero, vertical asymptote, or discontinuity within the interval, the result will be inaccurate or NaN. Consider splitting the interval at the singularity or using an improper integral technique.
Can I integrate exponential or trigonometric functions?
Yes — the basic expression parser supports standard arithmetic operators (+, -, *, /, ^) and parentheses. For example, you can integrate e^x by entering e^x if your expression uses Euler's number... wait, the basic parser does not support the constant "e" or "sin"/"cos". For those, see the Limit Calculator which supports trigonometric and exponential functions.
Was this calculator helpful?
Cite this calculator

TheCalcUniverse. "Integral Calculator — Compute Definite Integrals Numerically." TheCalcUniverse, 2026, https://thecalcuniverse.com/math/integral-calculator/. Accessed July 27, 2026.

Embed this calculator on your site

Free to embed. Paste this into any HTML page — it stays up to date automatically.

Open embed ↗

You may also like