EXERCISES 5.4

\(\def\ds{\displaystyle} \) 1 (a) For \(f(x)=x^2\), the Trapezoid Rule is \(S_{[a,b]}= (b-a)(a^2+b^2)/2\). Begin with one interval \(S_{[0,1]} = 1/2\). Checking the interval \([0,1]\), \[S_{[0,\frac{1}{2}]}= \frac{1}{16}, S_{[\frac{1}{2},1]}= \frac{5}{16}, |S_{[0,1]}-S_{[0,\frac{1}{2}]} -S_{[\frac{1}{2},1]}|=\frac{1}{8}<3\ \text{TOL}=0.15,\] therefore the estimate \[S_{[0,\frac{1}{2}]}+S_{[\frac{1}{2},1]}= \frac{3}{8}\] is accepted for the integral. The error is \(|\frac{3}{8} -\frac{1}{3}|=\frac{1}{24}\approx 0.0417<0.05\) as required.

1 (b) For \(f(x)=\cos x\), the Trapezoid Rule is \(S_{[a,b]}= (b-a)(\cos a+\cos b)/2\). Begin with one interval \(S_{[0,\frac{\pi}{2}]} = 0.7854\). Checking the interval \([0,\frac{\pi}{2}]\), \[S_{[0,\frac{\pi}{4}]}\approx 0.6704,\quad S_{[\frac{\pi}{4},\frac{\pi}{2}]} \approx 0.2777, \quad |S_{[0,\frac{\pi}{2}]} -S_{[0,\frac{\pi}{4}]} -S_{[\frac{\pi}{4},\frac{\pi}{2}]}|\approx 0.1627>3\ \text{TOL}=0.15,\] therefore \(S_{[0,\frac{\pi}{2}]}\) is rejected and \([0,\frac{\pi}{4}], [\frac{\pi}{4},\frac{\pi}{2}]\) are added to the list of intervals.

Checking the interval \([0,\frac{\pi}{4}]\), \[S_{[0,\frac{\pi}{8}]}\approx 0.3778,\quad S_{[\frac{\pi}{8},\frac{\pi}{4}]} \approx 0.3202, \quad |S_{[0,\frac{\pi}{4}]} -S_{[0,\frac{\pi}{8}]} -S_{[\frac{\pi}{8},\frac{\pi}{4}]}|\approx 0.0275<\frac{3}{2}\text{TOL}=0.075,\] therefore the estimate \(S_{[0,\frac{\pi}{8}]}+ S_{[\frac{\pi}{8},\frac{\pi}{4}]}=0.6980\) is accepted for \([0,\pi/4]\).

Checking the interval \([\frac{\pi}{4},\frac{\pi}{2}]\), \[S_{[\frac{\pi}{4},\frac{3\pi}{8}]}\approx 0.2140, S_{[\frac{3\pi}{8},\frac{\pi}{2}]} \approx 0.0751, |S_{[\frac{\pi}{4},\frac{\pi}{2}]} -S_{[\frac{\pi}{4},\frac{3\pi}{8}]} -S_{[\frac{3\pi}{8},\frac{\pi}{2}]}|\approx 0.0114<\frac{3}{2}\text{TOL}=0.075,\] therefore the estimate \(S_{[\frac{\pi}{4},\frac{3\pi}{8}]}+ S_{[\frac{3\pi}{8},\frac{\pi}{2}]}=0.2891\) is accepted for \([\pi/4,\pi/2]\). Adding the accepted estimates above, the approximate integral is \(0.6980+ 0.2891 = 0.9871\). Compared to the correct value \(1\) of the integral, the error is \(0.0129<0.05\) as required.

1 (c) For \(f(x)=e^x\), the Trapezoid Rule is \(S_{[a,b]}= (b-a)(e^a+e^b)/2\). Begin with one interval \(S_{[0,1]} = (1+e)/2\approx 1.8591\). Checking the interval \([0,1]\), \[S_{[0,\frac{1}{2}]}\approx 0.6622, S_{[\frac{1}{2},1]}\approx 1.0917, |S_{[0,1]}-S_{[0,\frac{1}{2}]} -S_{[\frac{1}{2},1]}|\approx 0.1051<3\ \text{TOL}=0.15,\] therefore the estimate \[S_{[0,\frac{1}{2}]}+S_{[\frac{1}{2},1]}= 1.7539\] is accepted for the integral. The error is \(|(e-1)- 1.7539|\approx 0.0356%lt 0.05\) as required.


3 To construct an Adaptive Midpoint Method we define \(S_{[a,b]}=(b-a)f(\frac{a+b}{2})\). Then (5.26) implies that \[\int_a^b f(x)\ dx = S_{[a,b]}+\frac{h^3}{3}f''(c_1),\] where \(h=(b-a)/2\), and applying the Midpoint Method to both \([a,c]\) and \([c,b]\) where \(c\) is the midpoint of \([a,b]\), \begin{eqnarray*} \int_a^b f(x)\ dx&=&S_{[a,c]}+\frac{h^3}{8}\frac{f''(c_2)}{3} + S_{[c,b]}+\frac{h^3}{8}\frac{f''(c_3)}{3}\\ &=&S_{[a,c]}+S_{[c,b]}+\frac{h^3}{12}f''(c_4). \end{eqnarray*} Theorem 5.1 has been used to consolidate the error terms. Subtracting the two equations yields \[S_{[a,b]}-(S_{[a,c]}+S_{[c,b]})=\frac{h^3}{12}f''(c_4)- \frac{h^3}{3}f''(c_1)\approx -\frac{h^3}{4}f''(c_4),\] assuming \(f''(c_1)\approx f''(c_4)\). Comparing the previous two equations, we conclude that \[|S_{[a,b]}-(S_{[a,c]}+S_{[c,b]})|\approx 3\left|\int_a^b f(x)\ dx-(S_{[a,c]}+S_{[c,b]})\right|\] so we will need to require \[|S_{[a,b]}-(S_{[a,c]}+S_{[c,b]})| \lt 3\ \text{TOL},\] which is the same error tolerance criterion used for Adaptive Trapezoid Rule Quadrature.