Let’s apply adaptive quadrature using Simpson’s rule as above with the goal of computing \(\int _0^1\sqrt{x}\ \dee{x}\) with an error of at most \(\varepsilon=0.0005=5\times 10^{-4}\text{.}\) Observe that \(\diff{}{x}\sqrt{x}=\frac{1}{2\sqrt{x}}\) blows up as \(x\) tends to zero. The integrand changes very quickly when \(x\) is small. So we will probably need to make the step size small near the limit of integration \(x=0\text{.}\)
- Step 1 — the interval \([0,1]\text{.}\) (The notation \([0,1]\) stands for the interval \(0\le x\le 1\text{.}\))\begin{align*} S(0,1\,;\tfrac{1}{2})&= 0.63807119 \\ S(0,\tfrac{1}{2}\,;\tfrac{1}{4})&= 0.22559223 \\ S(\tfrac{1}{2},1\,;\tfrac{1}{4})&= 0.43093403 \\ \text{error}&=\tfrac{1}{15}\left|S(0,\tfrac{1}{2}\,;\tfrac{1}{4}) +S(\tfrac{1}{2},1\,;\tfrac{1}{4}) -S(0,1\,;\tfrac{1}{2})\right| =0.0012 \\ &\gt\varepsilon =0.0005 \end{align*}This is unacceptably large, so we subdivide the interval \([0,1]\) into the two halves \(\big[0,\tfrac{1}{2}\big]\) and \(\big[\tfrac{1}{2},1\big]\) and apply the procedure separately to each half.
- Step 2a — the interval \([0,\half]\text{.}\)\begin{align*} S(0,\tfrac{1}{2}\,;\tfrac{1}{4})&= 0.22559223 \\ S(0,\tfrac{1}{4}\,;\tfrac{1}{8})&= 0.07975890 \\ S(\tfrac{1}{4},\tfrac{1}{2}\,;\tfrac{1}{8})&= 0.15235819 \\ \text{error}&=\tfrac{1}{15}\left|S(0,\tfrac{1}{4}\,;\tfrac{1}{8}) +S(\tfrac{1}{4},\tfrac{1}{2}\,;\tfrac{1}{8}) -S(0,\tfrac{1}{2}\,;\tfrac{1}{4})\right| = 0.00043 \\ & \gt\tfrac{\varepsilon}{2} = 0.00025 \end{align*}This error is unacceptably large.
- Step 2b — the interval \([\tfrac{1}{2},1]\text{.}\)\begin{align*} S(\tfrac{1}{2},1\,;\tfrac{1}{4})&= 0.43093403 \\ S(\tfrac{1}{2},\tfrac{3}{4}\,;\tfrac{1}{8})&= 0.19730874 \\ S(\tfrac{3}{4},1\,;\tfrac{1}{8})&= 0.23365345 \\ \text{error}&=\tfrac{1}{15}\left|S(\tfrac{1}{2},\tfrac{3}{4}\,;\tfrac{1}{8}) +S(\tfrac{3}{4},1\,;\tfrac{1}{8}) -S(\tfrac{1}{2},1\,;\tfrac{1}{4})\right| = 0.0000019 \\ &\lt\tfrac{\varepsilon}{2} = 0.00025 \end{align*}This error is acceptable.
-
Step 2 resumé. The error for the interval \([\tfrac{1}{2},1]\) is small enough, so we accept\begin{equation*} S(\tfrac{1}{2},1\,;\tfrac{1}{8}) = S(\tfrac{1}{2},\tfrac{3}{4}\,;\tfrac{1}{8}) + S(\tfrac{3}{4},1\,;\tfrac{1}{8}) = 0.43096219 \end{equation*}as the approximate value of \(\int_{1/2}^1\sqrt{x}\,\dee{x}\text{.}\)The error for the interval \([0,\tfrac{1}{2}]\) is unacceptably large, so we subdivide the interval \([0,\tfrac{1}{2}]\) into the two halves \([0,\tfrac{1}{4}]\) and \([\tfrac{1}{4},\tfrac{1}{2}]\) and apply the procedure separately to each half.
- Step 3a — the interval \([0,\tfrac{1}{4}]\text{.}\)\begin{align*} S(0,\tfrac{1}{4}\,;\tfrac{1}{8})&= 0.07975890 \\ S(0,\tfrac{1}{8}\,;\tfrac{1}{16})&= 0.02819903 \\ S(\tfrac{1}{8},\tfrac{1}{4}\,;\tfrac{1}{16})&= 0.05386675 \\ \text{error}&=\tfrac{1}{15}\left|S(0,\tfrac{1}{8}\,;\tfrac{1}{16}) +S(\tfrac{1}{8},\tfrac{1}{4}\,;\tfrac{1}{16}) -S(0,\tfrac{1}{4}\,;\tfrac{1}{8})\right|\\ &= 0.000153792 > \tfrac{\varepsilon}{4} = 0.000125 \end{align*}This error is unacceptably large.
- Step 3b — the interval \([\tfrac{1}{4},\tfrac{1}{2}]\text{.}\)\begin{align*} S(\tfrac{1}{4},\tfrac{1}{2}\,;\tfrac{1}{8})&= 0.15235819 \\ S(\tfrac{1}{4},\tfrac{3}{8}\,;\tfrac{1}{16})&= 0.06975918 \\ S(\tfrac{3}{8},\tfrac{1}{2}\,;\tfrac{1}{16})&= 0.08260897 \\ \text{error}&=\tfrac{1}{15}\left|S(\tfrac{1}{4},\tfrac{3}{8}\,;\tfrac{1}{16}) +S(\tfrac{3}{8},\tfrac{1}{2}\,;\tfrac{1}{16}) -S(\tfrac{1}{4},\tfrac{1}{2}\,;\tfrac{1}{8})\right|\\ & = 0.00000066 \lt\tfrac{\varepsilon}{4} = 0.000125 \end{align*}This error is acceptable.
-
Step 3 resumé. The error for the interval \([\tfrac{1}{4},\tfrac{1}{2}]\) is small enough, so we accept\begin{equation*} S(\tfrac{1}{4},\tfrac{1}{2}\,;\tfrac{1}{16}) = S(\tfrac{1}{4},\tfrac{3}{8}\,;\tfrac{1}{16}) + S(\tfrac{3}{8},\tfrac{1}{2}\,;\tfrac{1}{16}) = 0.15236814 \end{equation*}as the approximate value of \(\int_{1/4}^{1/2}\sqrt{x}\,\dee{x}\text{.}\)The error for the interval \([0,\tfrac{1}{4}]\) is unacceptably large, so we subdivide the interval \([0,\tfrac{1}{4}]\) into the two halves \([0,\tfrac{1}{8}]\) and \([\tfrac{1}{8},\tfrac{1}{4}]\) and apply the procedure separately to each half.
- Step 4a — the interval \([0,\tfrac{1}{8}]\text{.}\)\begin{align*} S(0,\tfrac{1}{8}\,;\tfrac{1}{16})&= 0.02819903 \\ S(0,\tfrac{1}{16}\,;\tfrac{1}{32})&= 0.00996986 \\ S(\tfrac{1}{16},\tfrac{1}{8}\,;\tfrac{1}{32})&= 0.01904477 \\ \text{error}&=\tfrac{1}{15}\left|S(0,\tfrac{1}{16}\,;\tfrac{1}{32}) +S(\tfrac{1}{16},\tfrac{1}{8}\,;\tfrac{1}{32}) -S(0,\tfrac{1}{8}\,;\tfrac{1}{16})\right|\\ & = 0.000054 \lt \tfrac{\varepsilon}{8} = 0.0000625 \end{align*}This error is acceptable.
- Step 4b — the interval \([\tfrac{1}{8},\tfrac{1}{4}]\text{.}\)\begin{align*} S(\tfrac{1}{8},\tfrac{1}{4}\,;\tfrac{1}{16})&= 0.05386675 \\ S(\tfrac{1}{8},\tfrac{3}{16}\,;\tfrac{1}{32})&= 0.02466359 \\ S(\tfrac{3}{16},\tfrac{1}{4}\,;\tfrac{1}{32})&= 0.02920668 \\ \text{error}&=\tfrac{1}{15}\left|S(\tfrac{1}{8},\tfrac{3}{16}\,;\tfrac{1}{32}) +S(\tfrac{3}{6},\tfrac{1}{4}\,;\tfrac{1}{32}) -S(\tfrac{1}{8},\tfrac{1}{4}\,;\tfrac{1}{16})\right|\\ & = 0.00000024 \lt \tfrac{\varepsilon}{8} = 0.0000625 \end{align*}This error is acceptable.
-
Step 4 resumé. The error for the interval \([0,\tfrac{1}{8}]\) is small enough, so we accept\begin{equation*} S(0,\tfrac{1}{8}\,;\tfrac{1}{32}) = S(0,\tfrac{1}{16}\,;\tfrac{1}{32}) + S(\tfrac{1}{16},\tfrac{1}{8}\,;\tfrac{1}{32}) = 0.02901464 \end{equation*}as the approximate value of \(\int_0^{1/8}\sqrt{x}\,\dee{x}\text{.}\)The error for the interval \([\tfrac{1}{8},\tfrac{1}{4}]\) is small enough, so we accept\begin{equation*} S(\tfrac{1}{8},\tfrac{1}{4}\,;\tfrac{1}{32}) = S(\tfrac{1}{8},\tfrac{3}{16}\,;\tfrac{1}{32}) + S(\tfrac{3}{16},\tfrac{1}{4}\,;\tfrac{1}{32}) = 0.05387027 \end{equation*}as the approximate value of \(\int_{1/8}^{1/4}\sqrt{x}\,\dee{x}\text{.}\)
- Conclusion. The approximate value for \(\int_0^1\sqrt{x}\ \dee{x}\) is\begin{align*} & S(0,\tfrac{1}{8}\,;\tfrac{1}{32}) +S(\tfrac{1}{8},\tfrac{1}{4}\,;\tfrac{1}{32}) +S(\tfrac{1}{4},\tfrac{1}{2}\,;\tfrac{1}{16}) +S(\tfrac{1}{2},1\,;\tfrac{1}{8})\\ &\hskip1in =0.66621525 \tag{E8} \end{align*}
Of course the exact value of \(\int_0^1\sqrt{x}\ \dee{x}=\tfrac{2}{3}\text{,}\) so the actual error in our approximation is
\begin{equation*}
\tfrac{2}{3}-0.66621525 = 0.00045 \lt \varepsilon = 0.0005
\end{equation*}
Here is what Simpson’s rule gives us when applied with some fixed step sizes.
\begin{align*}
S(0,1\,;\tfrac{1}{8}) &= 0.66307928 \\
S(0,1\,;\tfrac{1}{16}) &= 0.66539819 \\
S(0,1\,;\tfrac{1}{32}) &= 0.66621818 \\
S(0,1\,;\tfrac{1}{64}) &= 0.66650810
\end{align*}
So to get an error comparable to that in (E8) from Simpson’s rule with a fixed step size, we need to use \(h=\frac{1}{32}\text{.}\) In (E8) the step size \(h=\frac{1}{32}\) was just used on the subinterval \(\big[0,\frac{1}{4}\big]\text{.}\)