Numerical Integration Error Bound Calculator
Enter the interval, derivative bounds, and target absolute error. The calculator sizes the midpoint, trapezoidal, and Simpson rules and compares their guaranteed function-evaluation cost.
Fewest function evaluationsSimpson (9)
- Minimum midpoint subintervals
- 29
- Midpoint bound at recommended n
- 0.000099088387
- Minimum trapezoidal subintervals
- 41
- Trapezoidal bound at recommended n
- 0.000099147333
- Minimum Simpson subintervals
- 8
- Simpson bound at recommended n
- 0.000032552083
- Interval length
- 1
Method comparison
| Method | n | Step size h | Guaranteed bound | Function evaluations |
|---|---|---|---|---|
| Midpoint | 29 | 0.034482759 | 0.000099088387 | 29 |
| Trapezoidal | 41 | 0.024390244 | 0.000099147333 | 42 |
| Simpson | 8 | 0.125 | 0.000032552083 | 9 |
The bounds use the absolute interval length, so reversed endpoints give the same recommendation.
Function evaluations count one new function value per midpoint panel and shared endpoints for trapezoidal and Simpson panels.
How to use this calculator
- Enter the two endpoints of the integration interval.
- Enter valid upper bounds for the absolute second and fourth derivatives on the whole interval.
- Enter the largest absolute integration error you can allow.
- Compare the recommended subinterval count, step size, certified bound, and function evaluations for each method.
How the error-bound counts are calculated
This calculator uses the standard composite-rule error bounds and solves each one backward for the number of subintervals. Let L = |b - a|, eps be the target absolute error, M2 be an upper bound for |f''(x)|, and M4 be an upper bound for |f^(4)(x)| on the full interval.
For the composite midpoint rule, the sufficient bound is:
|E_M| <= M2 x L^3 / (24 x n_M^2)
Solving for n_M gives ceil(sqrt(M2 x L^3 / (24 x eps))), with a minimum of 1 subinterval. The composite trapezoidal rule uses the same derivative order but twice the constant:
|E_T| <= M2 x L^3 / (12 x n_T^2)
So n_T = ceil(sqrt(M2 x L^3 / (12 x eps))), also with a minimum of 1. Simpson's rule uses the fourth derivative and requires an even number of subintervals:
|E_S| <= M4 x L^5 / (180 x n_S^4)
The calculator first computes (M4 x L^5 / (180 x eps))^(1/4), then rounds up to the next even integer, with a minimum of 2.
How to read the comparison
Each row reports the recommended n, the step size h = L / n, the guaranteed error bound at that n, and the number of function evaluations. Midpoint uses one sample per subinterval. Trapezoidal and Simpson use the shared endpoints, so their evaluation count is n + 1.
The interval length, derivative bounds, and target error move the recommendation most. Doubling the interval can matter much more than doubling a derivative bound because the bounds use L^3 for midpoint and trapezoidal rules and L^5 for Simpson's rule. Tightening the tolerance increases all three counts, but Simpson often grows more slowly because its bound is proportional to 1 / n^4.
What this calculator leaves out
These are sufficient worst-case bounds. They certify that the theoretical bound is no larger than the tolerance when the derivative bounds are valid, but they do not predict the actual integration error. A smooth function may have much smaller actual error, while an invalid derivative bound can make the guarantee meaningless.
The calculation also leaves out floating-point roundoff, noisy function values, singularities, discontinuities, adaptive quadrature, and the cost of finding the derivative bounds. Very small tolerances can imply more panels than a practical static calculator should report, so the tool caps the displayed count and says so in the notes.
Worked example
Suppose a = 0, b = 1, M2 = 2, M4 = 24, and the target absolute error is 0.0001. Then L = 1.
Midpoint gives ceil(sqrt(2 / (24 x 0.0001))) = 29, with a bound of about 0.0000990884. Trapezoidal gives ceil(sqrt(2 / (12 x 0.0001))) = 41, with a bound of about 0.0000991473. Simpson gives a fourth-root value of about 6.04, which rounds up to the next even count, 8, with a bound of about 0.0000325521.
The function-evaluation counts are 29 for midpoint, 42 for trapezoidal, and 9 for Simpson, so Simpson needs the fewest evaluations for this set of bounds.
Common questions
How many subintervals are needed for a given accuracy?
Use the error formula for the rule you plan to apply, solve it for n, and round upward. This calculator does that for midpoint, trapezoidal, and Simpson rules, including Simpson's even-number requirement.
Why must Simpson's rule use an even number of subintervals?
Composite Simpson's rule applies a quadratic approximation across pairs of subintervals. Because each panel uses two subintervals, the total subinterval count must be even.
How do I find a bound for the second or fourth derivative?
Differentiate the function, then bound the absolute value of that derivative over the entire interval. For simple functions you can often check endpoints and critical points; for harder functions, use a conservative bound rather than a best guess.
Why is an error bound different from the actual error?
An error bound is a worst-case guarantee based on derivative limits and interval length. The actual error depends on the shape of the function and may be much smaller, but the bound is useful when you need a certificate before computing the integral.
Which numerical integration method needs the fewest function evaluations?
The answer depends on the interval, tolerance, and derivative bounds. Simpson's rule often needs fewer evaluations for smooth functions with a reasonable fourth-derivative bound, but a large fourth derivative can make midpoint or trapezoidal more attractive.
When do these numerical integration error formulas apply?
They apply to the composite midpoint, trapezoidal, and Simpson rules when the required derivatives exist and remain continuous on the full interval. They do not cover singularities, jumps, noisy samples, or adaptive rules that choose unequal step sizes.