9.7 Practice Problems
Problem 9.7.1. Use Euler’s method with \(h = 0.5\) to approximate the solution of \(y' = te^{3t}-2y\), \(y(0) = 0\), at \(t = 1\), and compare with the exact value \(y(1) = \frac 15e^3-\frac 1{25}e^3+\frac 1{25}e^{-2} = 3.2191\).
Show solution
Solution. \(w_1 = 0+0.5(0-0) = 0\), \(w_2 = 0+0.5\bigl (0.5e^{1.5}-0\bigr ) = 1.1204\). The error, \(2.10\), is huge: the solution grows like \(e^{3t}\), and \(h = 0.5\) is far too large for Euler’s method to follow it. (With \(h = 0.05\) the error falls to \(0.23\).)
Problem 9.7.2. For \(y' = y\), \(y(0) = 1\), carry out one step with \(h = 0.1\) of Euler’s method, the modified Euler method and RK4. Show that the results are the Taylor polynomials of \(e^{0.1}\) of degrees \(1\), \(2\) and \(4\).
Show solution
Solution. Euler: \(1+0.1 = 1.1\). Modified Euler: \(1+\frac {0.1}2(1+1.1) = 1.105 = 1+h+\frac {h^2}2\). RK4: \(k_1 = 0.1\), \(k_2 = 0.1(1.05) = 0.105\), \(k_3 = 0.1(1.0525) = 0.10525\), \(k_4 = 0.1(1.10525) = 0.110525\), and \(w_1 = 1+\frac 16(0.1+0.21+0.2105+0.110525) = 1.1051708\overline 3 = 1+h+\frac {h^2}2+\frac {h^3}6+\frac {h^4}{24}\). The errors against \(e^{0.1} = 1.1051709\) are \(5.2\times 10^{-3}\), \(1.7\times 10^{-4}\) and \(8.5\times 10^{-8}\).
Problem 9.7.3. Find a Lipschitz constant for \(f(t,y) = t^2y+\sin y\) on \(D = \{0\leq t\leq 1,\ y\in \mathbb R\}\).
Show solution
Solution. \(\left |\frac {\partial f}{\partial y}\right | = |t^2+\cos y|\leq 1+1 = 2\), so \(L = 2\).
Problem 9.7.4. Write \(y'''+2y''-y'+y = \cos t\), \(y(0) = 1\), \(y'(0) = 0\), \(y''(0) = -1\) as a first-order system, and do one Euler step with \(h = 0.1\).
Show solution
Solution. With \(u_1 = y\), \(u_2 = y'\), \(u_3 = y''\): \(u_1' = u_2\), \(u_2' = u_3\), \(u_3' = \cos t-2u_3+u_2-u_1\), with \(\mathbf u(0) = (1,0,-1)\). Since \(\mathbf f(0,\mathbf u(0)) = (0,-1,1+2+0-1) = (0,-1,2)\), one Euler step gives \(\mathbf u(0.1)\approx (1,-0.1,-0.8)\).
Problem 9.7.5. What is the largest step size for which Euler’s method is stable for \(y' = -100y\)? For RK4?
Show solution
Solution. Euler needs \(h<\frac {2}{100} = 0.02\), and RK4 needs \(100h<2.785\), \(h<0.0279\). For such equations the step size is set by stability, not by the accuracy wanted.
Questions on this section
Stuck on something here? Ask below and it stays attached to this topic.