8.6 Practice Problems
Problem 8.6.1. Use the three-point midpoint formula with \(h = 0.1\) and \(h = 0.05\) to approximate \(f'(1)\) for \(f(x) = e^x\), and apply Richardson extrapolation.
Show solution
Solution. \(N_1(0.1) = \frac {e^{1.1}-e^{0.9}}{0.2} = 2.7228146\) and \(N_1(0.05) = \frac {e^{1.05}-e^{0.95}}{0.1} = 2.7194146\). Then \(N_2 = 2.7194146+\frac {2.7194146-2.7228146}{3} = 2.7182813\), against \(e = 2.7182818\): the error falls from \(1.1\times 10^{-3}\) to \(5\times 10^{-7}\).
Problem 8.6.2. Show that Simpson’s rule is exact for \(f(x) = x^3\) on \([0,2]\) but not for \(x^4\), and find its error for \(x^4\) from the error formula.
Show solution
Solution. \(\frac 13[0+4(1)+8] = 4 = \int _0^2x^3\). For \(x^4\): \(\frac 13[0+4+16] = \frac {20}{3} = 6.6667\), while \(\int _0^2x^4 = 6.4\); the error is \(-0.2667\). The formula gives \(-\frac {h^5}{90}f^{(4)} = -\frac {1}{90}\cdot 24 = -0.2667\) exactly, since \(f^{(4)} = 24\) is constant.
Problem 8.6.3. How many subintervals does the composite trapezoidal rule need to approximate \(\int _1^2\ln x\,dx\) with error below \(10^{-5}\)? And composite Simpson’s rule?
Show solution
Solution. \(f'' = -\frac {1}{x^2}\), \(|f''|\leq 1\), so the trapezoidal rule needs \(\frac {1}{12}h^2<10^{-5}\), \(h<0.01095\), \(n\geq 92\). \(f^{(4)} = -\frac {6}{x^4}\), \(|f^{(4)}|\leq 6\), so Simpson needs \(\frac {6}{180}h^4<10^{-5}\), \(h<0.1316\), \(n\geq 8\) (even).
Problem 8.6.4. Approximate \(\int _0^1e^{-x^2}dx = 0.7468241\) by Gaussian quadrature with \(n = 2\).
Show solution
Solution. \(x = \frac {t+1}{2}\), so the integral is \(\frac 12\int _{-1}^1e^{-(t+1)^2/4}dt\approx \frac 12\left [e^{-(0.4226497)^2/4}+e^{-(1.5773503)^2/4}\right ] = \frac 12[0.9563243+0.5368651] = 0.7465947\), error \(2.3\times 10^{-4}\), from just two function values.
Problem 8.6.5. Show that the second column of the Romberg table, \(R_{k,2}\), is the composite Simpson’s rule with \(2^{k-1}\) subintervals.
Show solution
Solution. Let \(T_n\) be the trapezoidal rule with \(n\) subintervals of width \(h\), and \(T_{2n}\) the one with \(2n\) subintervals of width \(\frac h2\). Then \(R_{k,2} = \frac {4T_{2n}-T_n}{3}\). In \(4T_{2n}\) each original node \(x_j\) (interior) has weight \(4\cdot \frac h2 = 2h\) and each midpoint weight \(2h\); in \(T_n\) the interior nodes have weight \(h\). So \(\frac {4T_{2n}-T_n}{3}\) gives the midpoints weight \(\frac {2h}{3} = \frac {4}{3}\cdot \frac h2\), the interior original nodes weight \(\frac {2h-h}{3} = \frac 23\cdot \frac h2\), and the ends weight \(\frac {h-h/2}{3} = \frac 13\cdot \frac h2\): exactly Simpson’s weights \(1,4,2,4,\dots ,4,1\) times \(\frac {h/2}{3}\).
Questions on this section
Stuck on something here? Ask below and it stays attached to this topic.