Tutorials › Calculus II › Adaptive Simpson Error Estimates

Quadrature and Error Bounds · Tutorial 370 of 998

Adaptive Simpson Error Estimates

Compare coarse and refined Simpson approximations to estimate local error and guide interval subdivision.

Intermediate 9 min read

What You'll Learn

  • Define the one-panel and two-panel Simpson approximations on the same interval
  • Derive why their difference estimates the refined approximation’s error after division by fifteen
  • Distinguish an error estimate from a guaranteed error bound
  • Use the sign of the difference to form a corrected approximation
  • Apply the estimate repeatedly to decide whether to subdivide an interval
  • Recognize when smoothness, cancellation, or a small difference can make the estimate misleading

Why Compare Two Simpson Approximations?

Simpson’s rule can be accurate without requiring an exact antiderivative, but a numerical approximation is more useful when accompanied by information about its likely error. A common strategy is to calculate Simpson’s approximation on an interval, then calculate a second approximation using two half-intervals. The difference between these values provides a practical estimate of the error in the more refined approximation.

This comparison is the basis of adaptive Simpson quadrature. “Adaptive” means that subdivision is guided by the behaviour of the integrand: intervals where the estimated error is large are divided further, while intervals with small estimated error may be accepted at the current resolution.

The Two Approximations on One Interval

Let \(f\) be a function on \([a,b]\), let \(H=b-a\), and write \(m=(a+b)/2\). The one-panel Simpson approximation uses the endpoints and midpoint:

$$ S_1=\frac{H}{6}\left[f(a)+4f(m)+f(b)\right]. $$

To obtain the two-panel approximation, apply Simpson’s rule separately to \([a,m]\) and \([m,b]\). This requires the additional quarter points \(a+H/4\) and \(a+3H/4\). Adding the two results gives

$$ S_2=\frac{H}{12}\left[ f(a)+4f\left(a+\frac{H}{4}\right)+2f(m) +4f\left(a+\frac{3H}{4}\right)+f(b) \right]. $$

Here, “two-panel” means two applications of Simpson’s rule, each on half of the original interval. The refined result uses four equal subintervals across \([a,b]\). Define the signed difference by \(D=S_2-S_1\). The usual estimate of the absolute error in \(S_2\) is \(|D|/15\).

Definition: The difference-over-fifteen estimate for the refined Simpson approximation is $$ \text{estimated absolute error of }S_2 =\frac{|S_2-S_1|}{15}. $$ It is an estimate, not a guaranteed upper bound.

Why the Denominator Is Fifteen

The factor comes from how Simpson error changes under refinement. Suppose \(E_H\) denotes the signed error of a Simpson approximation at a given scale, using the convention “exact integral minus approximation.” For a sufficiently smooth function, the leading Simpson error is fourth order in the step size. If the step size is halved, that leading error is therefore approximately divided by \(2^4=16\).

In the comparison above, \(S_1\) uses a coarser step size than \(S_2\). In the regime where the leading error term dominates, the errors approximately satisfy

$$ E_{\mathrm{coarse}}\approx 16E_{\mathrm{fine}}. $$

Since \(E_{\mathrm{coarse}}=I-S_1\) and \(E_{\mathrm{fine}}=I-S_2\), where \(I=\int_a^b f(x)\,dx\), their difference is

$$ S_2-S_1 =(I-S_1)-(I-S_2) =E_{\mathrm{coarse}}-E_{\mathrm{fine}} \approx 16E_{\mathrm{fine}}-E_{\mathrm{fine}} =15E_{\mathrm{fine}}. $$

Thus, \((S_2-S_1)/15\) estimates the signed error \(I-S_2\), and its absolute value estimates the absolute error in \(S_2\). This also gives a corrected approximation:

$$ I\approx S_2+\frac{S_2-S_1}{15}. $$

This reasoning depends on the leading fourth-order error being a useful description at the scales being compared. In the standard asymptotic setting, for example when the integrand has six continuous derivatives, the composite Simpson error has a leading term proportional to the fourth power of the step size, followed by higher-order terms. If the interval is too wide for the leading term to dominate, or if error terms cancel, the difference may not reliably reflect the true error. The factor fifteen is therefore an asymptotic error-estimation rule, not an error-bound theorem.

1
Compute the coarse value.
Evaluate \(S_1\) on the full interval.
2
Compute the refined value.
Evaluate \(S_2\) using the two half-intervals.
3
Estimate the refined error.
Calculate \(|S_2-S_1|/15\), and use the signed difference if forming a corrected value.
4
Decide whether to subdivide.
If the estimate is too large for the task, split the interval and repeat the comparison on the smaller pieces.

Worked Example: An Exact Difference-Over-Fifteen Estimate

Worked Example: An Exact Difference-Over-Fifteen Estimate

Estimate the error in the two-panel Simpson approximation to \(\int_0^1 x^4\,dx\), and check the result against the exact integral.

Here \(H=1\), and the midpoint is \(1/2\). The one-panel approximation is

$$ S_1=\frac{1}{6}\left[ 0^4+4\left(\frac12\right)^4+1^4 \right] =\frac{1}{6}\left(0+\frac14+1\right) =\frac{5}{24}. $$

The quarter-point values are \(f(1/4)=1/256\) and \(f(3/4)=81/256\). Therefore

$$ \begin{aligned} S_2 &=\frac{1}{12}\left[ 0+4\left(\frac{1}{256}\right) +2\left(\frac{1}{16}\right) +4\left(\frac{81}{256}\right)+1 \right]\\ &=\frac{1}{12}\left[ \frac{4}{256}+\frac{1}{8}+\frac{324}{256}+1 \right]\\ &=\frac{1}{12}\left(\frac{77}{32}\right) =\frac{77}{384}. \end{aligned} $$

Since \(5/24=80/384\), the signed difference and estimated absolute error are

$$ D=S_2-S_1=\frac{77-80}{384}=-\frac{1}{128}, \qquad \frac{|D|}{15}=\frac{1}{1920}. $$

The exact integral is \(\int_0^1x^4\,dx=1/5\). Checking the error in \(S_2\) gives

$$ S_2-\frac15 =\frac{77}{384}-\frac15 =\frac{385-384}{1920} =\frac{1}{1920}. $$

In this example the estimate equals the actual absolute error. The signed correction also recovers the exact value:

$$ S_2+\frac{D}{15} =\frac{77}{384}-\frac{1}{1920} =\frac{384}{1920} =\frac15. $$

Exact agreement is especially convenient here; it should not be expected for every integrand.

Worked Example: Estimating Error for a Rational Function

Worked Example: Estimating Error for a Rational Function

Use one-panel and two-panel Simpson approximations on \([0,1]\) for \(f(x)=1/(1+x)\). Find the estimated error in the refined value.

The sampled values are \(f(0)=1\), \(f(1/2)=2/3\), \(f(1)=1/2\), \(f(1/4)=4/5\), and \(f(3/4)=4/7\). Thus

$$ S_1=\frac16\left(1+4\cdot\frac23+\frac12\right) =\frac16\left(\frac{25}{6}\right) =\frac{25}{36}. $$

For the refined value, substitute the same samples into the two-panel formula:

$$ \begin{aligned} S_2 &=\frac{1}{12}\left(1+4\cdot\frac45 +2\cdot\frac23+4\cdot\frac47+\frac12\right)\\ &=\frac{1}{12}\left(\frac{1747}{210}\right) =\frac{1747}{2520}. \end{aligned} $$

Writing \(S_1\) with denominator \(2520\) gives \(S_1=1750/2520\). Therefore

$$ D=S_2-S_1=-\frac{3}{2520}=-\frac{1}{840}, \qquad \frac{|D|}{15}=\frac{1}{12600}. $$

The estimate for the absolute error in \(S_2\) is \(1/12600\), or approximately \(0.00007937\). The negative sign of \(D\) indicates that the coarse approximation is larger than the refined one. It also suggests the corrected value

$$ S_2+\frac{D}{15} =\frac{1747}{2520}-\frac{1}{12600} =\frac{4367}{6300}. $$

The correction is a further estimate, not a substitute for the error check: without knowing the exact integral or an independent bound, this comparison alone cannot certify the true error.

Using the Estimate to Guide Subdivision

On an interval being tested, compare the estimated error with the accuracy needed for the calculation. If the estimate is acceptable, retain \(S_2\) as the approximation on that interval. If it is too large, divide the interval in half and repeat the one-panel-versus-two-panel comparison on each half. The refined approximations from accepted pieces are then added.

Subdivision is useful because a single wide interval may not capture changes in the function well. Smaller intervals can reveal where the approximation changes substantially under refinement. However, a small difference does not prove that the error is small: both approximations may miss a feature, or their errors may cancel. Smoothness of the integrand and sensible interval boundaries remain important.

Worked Example: Subdivide When the Local Estimate Is Too Large

Worked Example: Subdivide When the Local Estimate Is Too Large

Use the local estimates for \(f(x)=x^4\) on \([0,1]\) to decide whether to bisect the interval when the desired local error is \(0.0001\). Then find the sum of the refined approximations on the two halves.

The first comparison, computed above, gives an estimated error of \(1/1920\), approximately \(0.00052083\). Since this is greater than \(0.0001\), bisect the interval.

On \([0,1/2]\), the one-panel value is

$$ S_{1,L} =\frac{1/2}{6}\left[ 0+4\left(\frac14\right)^4+\left(\frac12\right)^4 \right] =\frac{1}{12}\left(\frac{1}{64}+\frac{1}{16}\right) =\frac{5}{768}. $$

The two-panel value uses \(x=0,1/8,1/4,3/8,1/2\). Its spacing is \(1/8\), so the Simpson factor is \((1/8)/3=1/24\):

$$ \begin{aligned} S_{2,L} &=\frac{1}{24}\left[ 0+4\left(\frac{1}{4096}\right) +2\left(\frac{1}{256}\right) +4\left(\frac{81}{4096}\right)+\frac{1}{16} \right]\\ &=\frac{1}{24}\left(\frac{77}{512}\right) =\frac{77}{12288}. \end{aligned} $$

Since \(5/768=80/12288\), the left-half estimate is

$$ \frac{|S_{2,L}-S_{1,L}|}{15} =\frac{3/12288}{15} =\frac{1}{61440} \approx 0.00001628. $$

For the right half, put \(u=x-1/2\). The integrand becomes \((u+1/2)^4\), whose fourth-degree term is \(u^4\); its lower-degree terms are integrated exactly by Simpson’s rule. Thus the Simpson error on a width-\(1/2\) interval is the same as for \(u^4\) on \([0,1/2]\), and the right-half estimate is also \(1/61440\). The sum of the two local estimates is

$$ \frac{1}{61440}+\frac{1}{61440} =\frac{1}{30720} \approx 0.00003255, $$

which is less than \(0.0001\). The sum of the two refined approximations can also be checked from the exact integral. For \(x^4\), Simpson’s error on a width-\(w\) interval is \(w^5/1920\); for \(w=1/2\), this is \(1/61440\) on each half. Hence

$$ S_{2,L}+S_{2,R} =\frac15+\frac{1}{61440}+\frac{1}{61440} =\frac{6145}{30720}. $$

The exact integral is \(1/5=6144/30720\), so the actual error of this sum is \(1/30720\), matching the summed estimate in this particular case. The tolerance comparison has guided subdivision, but the estimate still should not be treated as a guaranteed bound in general.

A Common Mistake: Treating the Difference as the Error

A frequent mistake is to use \(|S_2-S_1|\) itself as the estimated error of \(S_2\). In the quartic example, the difference is \(1/128\), while the actual error in \(S_2\) is \(1/1920\). In fact, \(1/128=15/1920\). Under the fourth-order refinement assumption, the difference is approximately fifteen times the refined error, so the estimate requires division by fifteen.

A second, related mistake is to describe the difference-over-fifteen value as a rigorous upper bound. It is an estimate based on the expected scaling of Simpson error; it can be misleading when the function is insufficiently smooth, when the interval is too large, or when error terms cancel. A rigorous guarantee requires an applicable error bound with its stated smoothness conditions, rather than this comparison alone.

Key takeaway: Compare Simpson’s rule on an interval with Simpson’s rule on its two halves. When the leading fourth-order error dominates, \(|S_2-S_1|/15\) estimates the refined error, and a large estimate signals that further subdivision may be useful.

Check Your Understanding

Use the definitions and reasoning above to answer these questions.

  1. What function values are needed for \(S_1\), and what additional values are needed for \(S_2\)?
  2. Why does halving the step size lead to the factor \(2^4=16\) for the leading Simpson error?
  3. If \(S_2-S_1<0\), what does the signed correction \(S_2+(S_2-S_1)/15\) do to \(S_2\)?
  4. Why is \(|S_2-S_1|/15\) an estimate rather than a guaranteed error bound?
  5. If the local estimate exceeds the required accuracy, what subdivision step should be taken?