Many integrands are easy almost everywhere and hard in a few places: a spike, a corner, a steep start. Spreading panels evenly wastes effort on the easy parts. Adaptive integration puts small panels only where they are needed, and it decides where by using Richardson's idea on Simpson's rule as an error estimate.
- On $[a, b]$ compute $S_1$, Simpson's rule on the whole interval, and $S_2$, Simpson's rule on each half, added.
- Estimate the error of $S_2$ by $\frac{|S_2 - S_1|}{15}$.
- If it is at most the tolerance for this interval, accept $S_2 + \frac{S_2 - S_1}{15}$ (or simply $S_2$).
- Otherwise split the interval in two, give each half half the tolerance, and repeat on each half.
Key idea
Why it works
Worked example: The estimate can be exact
- $S_1 = \frac{2}{6}[0 + 4(1) + 16] = \frac{20}{3} \approx 6.66667$.
- $S_2 = \frac{1}{6}[0 + 4(0.0625) + 1] + \frac{1}{6}[1 + 4(5.0625) + 16] = \frac{1.25 + 37.25}{6} \approx 6.41667$.
- Estimate: $\frac{S_2 - S_1}{15} = \frac{-0.25}{15} \approx -0.016667$. True error of $S_2$: $6.4 - 6.41667 = -0.016667$. Identical, because $f^{(4)}$ is constant.
Answer: $-0.016667$, the exact error
Worked example: Accept or split?
- $\frac{|S_2 - S_1|}{15} = \frac{0.000176}{15} \approx 1.2 \times 10^{-5}$.
- That exceeds $10^{-5}$: split into two halves, each with tolerance $5 \times 10^{-6}$.
Answer: split
Worked example: Where the work goes
- $\sqrt{x}$ has an infinite slope at $0$, so its derivatives are huge near $0$ and Simpson's error there is large.
- Intervals near $0$ keep failing the test and get split again and again; on $[\frac{1}{2}, 1]$ one or two panels pass at once.
- The panels shrink geometrically toward $0$. A uniform grid fine enough for $0$ would waste thousands of function values on the easy part.
Answer: clustered near 0
Common mistake