Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

Numerical Integration Calculator (Trapezoidal & Simpson’s Rule)

Riemann sums, trapezoid, Simpson, Boole and Gauss rules, with the working and the error.

Free preview, no sign-upIncluded in your pass Pro tool Pro pass: ₹179 / $5.99 for 30 days On this device: nothing is sent
+3 +1 more details No uploadWorks offline once opened Math

Free preview: a watermarked drawing of the rule’s rectangles, trapezoids or parabolas and the first table rows (up to 3), with the value, the errors and every figure hidden. Locked until you unlock it: download and copy.

Pro pass ₹179 for 30 days or ₹79 for 1 week, one‑time. Pro pass $5.99 for 30 days or $2.99 for 1 week, one‑time. How to unlock

Try before you buy.

  • Free preview: a watermarked drawing of the rule’s rectangles, trapezoids or parabolas and the first table rows (up to 3), with the value, the errors and every figure hidden.
  • Locked until you unlock it: download and copy.
  • Unlock: Pro pass, ₹179 for 30 days or ₹79 for 1 week, a one-time payment that never renews. Unlock: Pro pass, $5.99 for 30 days or $2.99 for 1 week, a one-time payment that never renews.

Ways to unlock shows how to get the full result.

See passes (opens in a new tab)

Printing this result is locked in the free preview.

Use ^ for powers and * or a space for products: e^(-x^2), sqrt(1 + x^3), sin(x)/x, x ln(x).

With an exact value the errors are measured against it; without one, against a reference worked out to about 13 digits (functions only).

Examples:

Result

Integral

Next steps Done. What next?

Start over

A Pro pass unlocks the full result. See passes

All math calculators & solvers

About the Numerical Integration Calculator (Trapezoidal & Simpson’s Rule)

Approximate a definite integral ∫ₐᵇ f(x) dx — or the area under a table of measured (x, y) values — with the left, right and midpoint Riemann sums, the trapezoidal rule, Simpson’s 1/3 rule, Simpson’s 3/8 rule, Boole’s rule and Gauss–Legendre quadrature. Type a function such as e^(-x^2), the limits and the number of subintervals n, and pick the rule.

You get the working table — every node xᵢ, f(xᵢ), its coefficient (1, 4, 2, 4 … for Simpson) and its contribution to the sum — the drawing of the rectangles, trapezoids, parabolas or Gauss nodes the rule integrates, and a comparison of all the rules on the same n. Each approximation is checked against the exact value if you enter it, or against a reference worked out by adaptive Gauss–Kronrod quadrature to about 13 significant digits, and shown with the rule’s theoretical error bound, using the largest derivative of f found on [a, b]. Everything runs in your browser.

How to use it

  1. Choose Function and type f(x) using ^ for powers, sqrt( ), ln( ), e^x and sin, cos …; or choose Table of data and paste one x, y pair per line (two spreadsheet columns work too).
  2. Enter the limits a and b (pi/2 and similar are fine) and the number of subintervals n. Simpson’s 1/3 rule needs an even n, the 3/8 rule a multiple of 3 and Boole’s rule a multiple of 4; Gauss–Legendre uses m points on each subinterval.
  3. Optionally type the exact value (such as ln(2) or sqrt(pi)/2*erf(1)) to see the true error of every rule.
  4. Read the approximation, the working table and the comparison, and copy the results or download the table as CSV or the drawing as a PNG — with a Pro pass or after unlocking this result; without one you see the free preview.

Examples

A Gaussian integral, n = 10
Input
∫₀¹ e^(−x²) dx (reference 0.746824132812427)
Result
Trapezoid 0.746210796 (error −6.13 × 10⁻⁴); Simpson 0.746824948 (error 8.15 × 10⁻⁷); 3-point Gauss on 10 subintervals 0.746824132811 (error −1.5 × 10⁻¹²)

Simpson’s bound (b − a)h⁴/180 · max|f⁽⁴⁾| with max|f⁽⁴⁾| = 12 gives 6.67 × 10⁻⁶, comfortably above the actual error.

A textbook check: ∫₀^π sin x dx = 2
Input
Simpson’s 1/3 rule with n = 18, and Boole’s rule with n = 12
Result
Simpson 2.00001035, within the 2 × 10⁻⁵ target of Burden & Faires’ example (§4.4); Boole 1.999998587 (error −1.41 × 10⁻⁶)
ln 2 as an integral
Input
∫₁² dx/x with n = 8, exact value ln(2)
Result
Simpson 0.693154531 (error 7.35 × 10⁻⁶); Boole 0.693147901 (error 7.2 × 10⁻⁷); 2-point Gauss on each subinterval 0.693146866 (error −3.15 × 10⁻⁷)
Measured data
Input
x = 0, 0.25, 0.5, 0.75, 1 and y = 1, 1.2, 1.6, 1.7, 1.5
Result
Trapezoid 1.4375; Simpson 1.44166667; Boole 1.43888889

With h = 0.25, Simpson gives (h/3)(1 + 4·1.2 + 2·1.6 + 4·1.7 + 1.5) = (0.25/3)·17.3.

Common uses

  • Checking numerical-methods homework: the same nodes, coefficients and sums as the textbook table.
  • Integrating functions that have no elementary antiderivative, such as e^(−x²), sin x / x or √(1 + x³).
  • Finding areas, volumes, distances or totals from measured data — speed against time, flow against depth.
  • Seeing how the error of each rule falls as n grows, and how many subintervals a required accuracy needs.

The rules (h = (b − a)/n, xᵢ = a + ih)

  • Left and right Riemann sums: h·[f(x₀) + … + f(xₙ₋₁)] and h·[f(x₁) + … + f(xₙ)].
  • Midpoint rule: h·Σ f(mᵢ), with mᵢ the middle of each subinterval.
  • Trapezoidal rule: (h/2)·[f(x₀) + 2f(x₁) + … + 2f(xₙ₋₁) + f(xₙ)].
  • Simpson’s 1/3 rule (n even): (h/3)·[f(x₀) + 4f(x₁) + 2f(x₂) + 4f(x₃) + … + 4f(xₙ₋₁) + f(xₙ)] — a parabola through each pair of subintervals.
  • Simpson’s 3/8 rule (n a multiple of 3): (3h/8)·[f(x₀) + 3f(x₁) + 3f(x₂) + 2f(x₃) + … + f(xₙ)] — a cubic through each three.
  • Boole’s rule (n a multiple of 4): (2h/45)·[7f(x₀) + 32f(x₁) + 12f(x₂) + 32f(x₃) + 14f(x₄) + … + 7f(xₙ)].
  • Gauss–Legendre quadrature: on each subinterval, Σ wⱼ f at m nodes placed at the roots of the Legendre polynomial Pₘ; exact for polynomials of degree up to 2m − 1.

The rules and their error terms follow Burden, Faires and Burden, Numerical Analysis, 10th ed., Chapter 4.

Error terms and bounds

For a smooth f the composite errors are: Riemann sums at most (b − a)h/2 · max|f′|; midpoint (b − a)h²/24 · max|f″|; trapezoid (b − a)h²/12 · max|f″|; Simpson (b − a)h⁴/180 · max|f⁽⁴⁾|; 3/8 rule (b − a)h⁴/80 · max|f⁽⁴⁾|; Boole 2(b − a)h⁶/945 · max|f⁽⁶⁾|; and m-point Gauss–Legendre (b − a)h²ᵐ(m!)⁴/((2m + 1)[(2m)!]³) · max|f⁽²ᵐ⁾|. The calculator finds the largest derivative on a fine grid over [a, b] by automatic differentiation — an estimate of the maximum, so treat the bound as a careful guide rather than a guarantee. Where a derivative does not exist (√(1 − x²) at ±1, |x| at 0), no bound is given.

Choosing n

Halving h divides the trapezoid and midpoint errors by about 4, Simpson’s and the 3/8 rule’s by 16 and Boole’s by 64, so the comparison table shows which rule needs the fewest function values for your accuracy. Burden & Faires’ example: for ∫₀^π sin x dx within 2 × 10⁻⁵ the trapezoidal rule needs n = 360 but Simpson’s rule only n = 18. Rounding error grows slowly with n, so huge n rarely helps.

Tabulated data and unequal spacing

With data you cannot choose the nodes, so the midpoint and Gauss rules are not available. For equally spaced points the textbook coefficients apply. For unequal spacing, each panel’s weights come from integrating the polynomial through its points (two for the trapezoid, three for Simpson, four for the 3/8 rule, five for Boole), which gives the textbook weights again when the spacing is equal. With an odd number of intervals Simpson’s 1/3 rule covers all but the last three, which use the 3/8 rule.

Limitations

  • Finite limits only. For improper integrals (an infinite limit) or an exact antiderivative, use the Integral Calculator.
  • Up to 100,000 subintervals or data points (Gauss–Legendre quadrature: up to 200,000 nodes, n × m); the page lists the first 1,000 rows of the working table, and the CSV has all of them.
  • Where f is undefined at a node the rule cannot be used (choose the midpoint or Gauss rules, which avoid the ends), except at removable 0/0 points such as sin x / x at 0, where the limit is used.
  • Discontinuous or singular integrands slow every rule down and can make the reference value unreliable; the page says when it is.

Privacy

On this device: nothing is sent

Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot.

Frequently asked questions

What do I get without a pass?

Without a pass, Numerical Integration Calculator (Trapezoidal & Simpson’s Rule) shows a watermarked drawing of the rule’s rectangles, trapezoids or parabolas and the first table rows (up to 3), with the value, the errors and every figure hidden. Until you unlock it, the result can’t be downloaded or copied. A Pro, Premium or Ultimate pass, a one-time payment that never renews, unlocks the full result. The pricing page lists the passes and their prices.

Is Simpson’s rule more accurate than the trapezoidal rule?

For smooth functions, yes: its error falls like h⁴ instead of h². For ∫₀¹ e^(−x²) dx with n = 10 the trapezoid is off by 6.1 × 10⁻⁴ and Simpson by 8.2 × 10⁻⁷. For functions with corners or very little smoothness the advantage shrinks.

Why does Simpson’s 1/3 rule need an even number of subintervals?

Each parabola spans two subintervals (three points), so the subintervals must pair up. With an odd number of data intervals the calculator uses the 3/8 rule (a cubic over three intervals) for the last three; for a function, choose an even n.

How do I choose n for a required accuracy?

Set the error bound below your tolerance and solve for h. For the trapezoidal rule (b − a)h²/12 · max|f″| < ε gives h < √(12ε/((b − a)·max|f″|)). The comparison table shows the bound for the n you chose, so you can raise n until it is small enough.

Can I integrate measured data instead of a formula?

Yes: choose Table of data and paste x, y pairs. The trapezoidal rule works for any spacing; Simpson’s, the 3/8 and Boole’s rules work for equal and unequal spacing through local interpolating polynomials. Without the true function the error cannot be measured, but the spread between the rules is a rough guide.

What is Gaussian quadrature?

Instead of equally spaced points, Gauss–Legendre quadrature places m points at the roots of the Legendre polynomial Pₘ with matching weights, which makes it exact for polynomials of degree up to 2m − 1 — twice what m equally spaced points achieve. With 3 points on 10 subintervals of [0, 1] it integrates e^(−x²) to about 12 digits.

Where does the reference value come from?

From adaptive Gauss–Kronrod quadrature (the 7- and 15-point pair of QUADPACK): it keeps splitting the subinterval with the largest estimated error until the total estimate is below about 10⁻¹³ of the result. If you enter an exact value, that is used instead, and the calculator warns when the two disagree.

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.