3.2 The Improved Euler Method and Related Methods

In Section 3.1 we saw that the global truncation error of Euler’s method is \(O(h)\), which would seem to imply that we can achieve arbitrarily accurate results with Euler’s method by simply choosing the step size sufficiently small. However, this isn’t a good idea, for two reasons. First, after a certain point decreasing the step size will increase roundoff errors to the point where the accuracy will deteriorate rather than improve. The second and more important reason is that in most applications of numerical methods to an initial value problem

\begin{equation} y'=f(x,y),\quad y(x_0)=y_0, \tag{3.2.1}\end{equation}

the expensive part of the computation is the evaluation of \(f\). Therefore we want methods that give good results for a given number of such evaluations. This is what motivates us to look for numerical methods better than Euler’s.

To clarify this point, suppose we want to approximate the value of \(e\) by applying Euler’s method to the initial value problem

\[ y'=y,\quad y(0)=1,\quad\mbox{(with solution $y=e^x$)} \]

on \([0,1]\), with \(h=1/12\), \(1/24\), and \(1/48\), respectively. Since each step in Euler’s method requires one evaluation of \(f\), the number of evaluations of \(f\) in each of these attempts is \(n=12\), \(24\), and \(48\), respectively. In each case we accept \(y_n\) as an approximation to \(e\). The second column of Table 3.2.1 shows the results. The first column of the table indicates the number of evaluations of \(f\) required to obtain the approximation, and the last column contains the value of \(e\) rounded to ten significant figures.

In this section we’ll study the improved Euler method, which requires two evaluations of \(f\) at each step. We’ve used this method with \(h=1/6\), \(1/12\), and \(1/24\). The required number of evaluations of \(f\) were 12, 24, and \(48\), as in the three applications of Euler’s method; however, you can see from the third column of Table 3.2.1 that the approximation to \(e\) obtained by the improved Euler method with only 12 evaluations of \(f\) is better than the approximation obtained by Euler’s method with 48 evaluations.

In Section 3.1 we’ll study the Runge- Kutta method, which requires four evaluations of \(f\) at each step. We’ve used this method with \(h=1/3\), \(1/6\), and \(1/12\). The required number of evaluations of \(f\) were again 12, 24, and \(48\), as in the three applications of Euler’s method and the improved Euler method; however, you can see from the fourth column of Table 3.2.1 that the approximation to \(e\) obtained by the Runge-Kutta method with only 12 evaluations of \(f\) is better than the approximation obtained by the improved Euler method with 48 evaluations.

Table 3.2.1. Approximations to \(e\) obtained by three numerical methods.
\(n\)EulerImproved EulerRunge-KuttaExact
122.6130352902.7071889942.7180697642.718281828
242.6637312582.7153273712.7182666122.718281828
482.6904965992.7175195652.7182808092.718281828

The Improved Euler Method

The improved Euler method for solving the initial value problem (3.2.1) is based on approximating the integral curve of (3.2.1) at \((x_i,y(x_i))\) by the line through \((x_i,y(x_i))\) with slope

\[ m_i={f(x_i,y(x_i))+f(x_{i+1},y(x_{i+1}))\over2}; \]

that is, \(m_i\) is the average of the slopes of the tangents to the integral curve at the endpoints of \([x_i,x_{i+1}]\). The equation of the approximating line is therefore

\begin{equation} y=y(x_i)+{f(x_i,y(x_i))+f(x_{i+1},y(x_{i+1}))\over2}(x-x_i). \tag{3.2.2}\end{equation}

Setting \(x=x_{i+1}=x_i+h\) in (3.2.2) yields

\begin{equation} y_{i+1}=y(x_i)+{h\over2}\left(f(x_i,y(x_i))+f(x_{i+1},y(x_{i+1}))\right) \tag{3.2.3}\end{equation}

as an approximation to \(y(x_{i+1})\). As in our derivation of Euler’s method, we replace \(y(x_i)\) (unknown if \(i>0\)) by its approximate value \(y_i\); then (3.2.3) becomes

\[ y_{i+1}=y_i+{h\over2}\left(f(x_i,y_i)+f(x_{i+1},y(x_{i+1})\right). \]

However, this still won’t work, because we don’t know \(y(x_{i+1})\), which appears on the right. We overcome this by replacing \(y(x_{i+1})\) by \(y_i+hf(x_i,y_i)\), the value that the Euler method would assign to \(y_{i+1}\). Thus, the improved Euler method starts with the known value \(y(x_0)=y_0\) and computes \(y_1\), \(y_2\), …, \(y_n\) successively with the formula

\begin{equation} y_{i+1}=y_i+{h\over2}\left(f(x_i,y_i)+f(x_{i+1},y_i+hf(x_i,y_i))\right). \tag{3.2.4}\end{equation}

The computation indicated here can be conveniently organized as follows: given \(y_i\), compute

\begin{eqnarray*} k_{1i}&=&f(x_i,y_i), \\ k_{2i}&=&f\left(x_i+h,y_i+hk_{1i}\right), \\ y_{i+1}&=&y_i+{h\over2}(k_{1i}+k_{2i}). \end{eqnarray*}

The improved Euler method requires two evaluations of \(f(x,y)\) per step, while Euler’s method requires only one. However, we’ll see at the end of this section that if \(f\) satisfies appropriate assumptions, the local truncation error with the improved Euler method is \(O(h^3)\), rather than \(O(h^2)\) as with Euler’s method. Therefore the global truncation error with the improved Euler method is \(O(h^2)\); however, we won’t prove this.

We note that the magnitude of the local truncation error in the improved Euler method and other methods discussed in this section is determined by the third derivative \(y'''\) of the solution of the initial value problem. Therefore the local truncation error will be larger where \(|y'''|\) is large, or smaller where \(|y'''|\) is small.

The next example, which deals with the initial value problem considered in Example 3.1.1, illustrates the computational procedure indicated in the improved Euler method.

Example 3.2.1

Use the improved Euler method with \(h=0.1\) to find approximate values of the solution of the initial value problem

\begin{equation} y'+2y=x^3e^{-2x},\quad y(0)=1 \tag{3.2.5}\end{equation}

at \(x=0.1,0.2,0.3\).

Solution As in Example 3.1.1, we rewrite (3.2.5) as

\[ y'=-2y+x^3e^{-2x},\quad y(0)=1, \]

which is of the form (3.2.1), with

\[ f(x,y)=-2y+x^3e^{-2x},\; x_0=0,\mbox{\; and}\; y_0=1. \]

The improved Euler method yields

\begin{eqnarray*} k_{10} & = & f(x_0,y_0) = f(0,1)=-2, \\ k_{20} & = & f(x_1,y_0+hk_{10})=f(.1,1+(.1)(-2)) \\ &=& f(.1,.8)=-2(.8)+(.1)^3e^{-.2}=-1.599181269, \\ y_1&=&y_0+{h\over2}(k_{10}+k_{20}), \\ &=&1+(.05)(-2-1.599181269)=.820040937, \\[12pt] k_{11} & = & f(x_1,y_1) = f(.1,.820040937)= -2(.820040937)+(.1)^3e^{-.2}=-1.639263142, \\ k_{21} & = & f(x_2,y_1+hk_{11})=f(.2,.820040937+.1(-1.639263142)), \\ &=& f(.2,.656114622)=-2(.656114622)+(.2)^3e^{-.4}=-1.306866684, \\ y_2&=&y_1+{h\over2}(k_{11}+k_{21}), \\ &=&.820040937+(.05)(-1.639263142-1.306866684)=.672734445, \\[12pt] k_{12} & = & f(x_2,y_2) = f(.2,.672734445)= -2(.672734445)+(.2)^3e^{-.4}=-1.340106330, \\ k_{22} & = & f(x_3,y_2+hk_{12})=f(.3,.672734445+.1(-1.340106330)), \\ &=& f(.3,.538723812)=-2(.538723812)+(.3)^3e^{-.6}=-1.062629710, \\ y_3&=&y_2+{h\over2}(k_{12}+k_{22}) \\ &=&.672734445+(.05)(-1.340106330-1.062629710)=.552597643. \end{eqnarray*}

Example 3.2.2

Table 3.2.2 shows results of using the improved Euler method with step sizes \(h=0.1\) and \(h=0.05\) to find approximate values of the solution of the initial value problem

\[ y'+2y=x^3e^{-2x},\quad y(0)=1 \]

at \(x=0\), \(0.1\), \(0.2\), \(0.3\), …, \(1.0\). For comparison, it also shows the corresponding approximate values obtained with Euler’s method in 3.1.2, and the values of the exact solution

\[ y={e^{-2x}\over4}(x^4+4). \]

The results obtained by the improved Euler method with \(h=0.1\) are better than those obtained by Euler’s method with \(h=0.05\).

Table 3.2.2. Numerical solution of \(y'+2y=x^3e^{-2x},\ y(0)=1\), by Euler’s method and the improved Euler method.
\(x\)\(h=0.1\)\(h=0.05\)\(h=0.1\)\(h=0.05\)Exact
0.01.0000000001.0000000001.0000000001.0000000001.000000000
0.10.8000000000.8100056550.8200409370.8190505720.818751221
0.20.6400818730.6562664370.6727344450.6710864550.670588174
0.30.5126017540.5322909810.5525976430.5505438780.549922980
0.40.4115631950.4328870560.4551606370.4528906160.452204669
0.50.3321262610.3537850150.3766812510.3743357470.373627557
0.60.2702995020.2914042560.3139709200.3116522390.310952904
0.70.2227453970.2427072570.2642876110.2620676240.261398947
0.80.1866545930.2051057540.2252677020.2231942810.222570721
0.90.1596607760.1763968830.1948795010.1929817570.192412038
1.00.1397789100.1547159250.1713880700.1696806730.169169104
EulerImproved EulerExact

Example 3.2.3

Table 3.2.3 shows analogous results for the nonlinear initial value problem

\[ y'=-2y^2+xy+x^2,\ y(0)=1. \]

We applied Euler’s method to this problem in Example 3.1.3.

Table 3.2.3. Numerical solution of \(y'=-2y^2+xy+x^2,\ y(0)=1\), by Euler’s method and the improved Euler method.
\(x\)\(h=0.1\)\(h=0.05\)\(h=0.1\)\(h=0.05\)“Exact”
0.01.0000000001.0000000001.0000000001.0000000001.000000000
0.10.8000000000.8213750000.8405000000.8382883710.837584494
0.20.6810000000.7077953770.7334308460.7305566770.729641890
0.30.6058678000.6337765900.6616008060.6585521900.657580377
0.40.5596286760.5874545260.6159618410.6128844930.611901791
0.50.5353769720.5629061690.5916347420.5885589520.587575491
0.60.5298201200.5571435350.5860069350.5829272240.581942225
0.70.5414674550.5687169350.5977121200.5946180120.593629526
0.80.5697327760.5969519880.6260088240.6228982790.621907458
0.90.6143923110.6414577290.6703512250.6672376170.666250842
1.00.6751920370.7017644950.7300696100.7269858370.726015790
EulerImproved Euler“Exact”

Example 3.2.4

Use step sizes \(h=0.2\), \(h=0.1\), and \(h=0.05\) to find approximate values of the solution of

\begin{equation} y'-2xy=1,\quad y(0)=3 \tag{3.2.6}\end{equation}

at \(x=0\), \(0.2\), \(0.4\), \(0.6\), …, \(2.0\) by (a) the improved Euler method; (b) the improved Euler semilinear method. (We used Euler’s method and the Euler semilinear method on this problem in 3.1.4.)

Solution (a) Rewriting (3.2.6) as

\[ y'=1+2xy,\quad y(0)=3 \]

and applying the improved Euler method with \(f(x,y)=1+2xy\) yields the results shown in Table 3.2.4.

Solution (b) Since \(y_1=e^{x^2}\) is a solution of the complementary equation \(y'-2xy=0\), we can apply the improved Euler semilinear method to (3.2.6), with

\[ y=ue^{x^2}\mbox{\quad and \quad} u'=e^{-x^2},\quad u(0)=3. \]

The results listed in Table 3.2.5 are clearly better than those obtained by the improved Euler method.

Table 3.2.4. Numerical solution of \(y'-2xy=1,\ y(0)=3\), by the improved Euler method.
\(x\)\(h=0.2\)\(h=0.1\)\(h=0.05\)“Exact”
0.03.0000000003.0000000003.0000000003.000000000
0.23.3280000003.3281824003.3279736003.327851973
0.43.9646592003.9663401173.9662166903.966059348
0.65.0577124975.0657005155.0668483815.067039535
0.86.9000881566.9286489736.9348623676.936700945
1.010.06572553410.15487254710.17743073610.184923955
1.215.70895442015.97003326116.04190486216.067111677
1.426.24489419226.99162096027.21000171527.289392347
1.646.95891574649.09612552449.75413106050.000377775
1.889.98231264196.20050621898.21057738598.982969504
2.0184.563776288203.151922739209.464744495211.954462214
Table 3.2.5. Numerical solution of \(y'-2xy=1,\ y(0)=3\), by the improved Euler semilinear method.
\(x\)\(h=0.2\)\(h=0.1\)\(h=0.05\)“Exact”
0.03.0000000003.0000000003.0000000003.000000000
0.23.3265134003.3275183153.3277686203.327851973
0.43.9633830703.9653920843.9658926443.966059348
0.65.0630272905.0660387745.0667894875.067039535
0.86.9313553296.9353668476.9363675646.936700945
1.010.17824841710.18325673310.18450725310.184923955
1.216.05911051116.06511159916.06661167216.067111677
1.427.28007067427.28705973227.28880905827.289392347
1.649.98974153149.99771299749.99971122650.000377775
1.898.97102542098.97997298898.98221972298.982969504
2.0211.941217796211.951134436211.953629228211.954462214

A Family of Methods with \(O(h^3)\) Local Truncation Error

We’ll now derive a class of methods with \(O(h^3)\) local truncation error for solving (3.2.1). For simplicity, we assume that \(f\), \(f_x\), \(f_y\), \(f_{xx}\), \(f_{yy}\), and \(f_{xy}\) are continuous and bounded for all \((x,y)\). This implies that if \(y\) is the solution of (3.2.1 then \(y''\) and \(y'''\) are bounded (Exercise 31).

We begin by approximating the integral curve of (3.2.1) at \((x_i,y(x_i))\) by the line through \((x_i,y(x_i))\) with slope

\[ m_i=\sigma y'(x_i)+\rho y'(x_i+\theta h), \]

where \(\sigma\), \(\rho\), and \(\theta\) are constants that we’ll soon specify; however, we insist at the outset that \(0<\theta\le 1\), so that

\[ x_i<x_i+\theta h\le x_{i+1}. \]

The equation of the approximating line is

\begin{equation} \begin{array}{rcl} y&=&y(x_i)+m_i(x-x_i)\\ &=&y(x_i)+\left[\sigma y'(x_i)+\rho y'(x_i+\theta h)\right](x-x_i). \end{array} \tag{3.2.7}\end{equation}

Setting \(x=x_{i+1}=x_i+h\) in (3.2.7) yields

\[ \hat y_{i+1}=y(x_i)+h\left[\sigma y'(x_i)+\rho y'(x_i+\theta h)\right] \]

as an approximation to \(y(x_{i+1})\).

To determine \(\sigma\), \(\rho\), and \(\theta\) so that the error

\begin{equation} \begin{array}{rcl} E_i&=&y(x_{i+1})-\hat y_{i+1}\\ &=&y(x_{i+1})-y(x_i)-h\left[\sigma y'(x_i)+\rho y'(x_i+\theta h)\right] \end{array} \tag{3.2.8}\end{equation}

in this approximation is \(O(h^3)\), we begin by recalling from Taylor’s theorem that

\[ y(x_{i+1})=y(x_i)+hy'(x_i)+{h^2\over2}y''(x_i)+{h^3\over6}y'''(\hat x_i), \]

where \(\hat x_i\) is in \((x_i,x_{i+1})\). Since \(y'''\) is bounded this implies that

\[ y(x_{i+1})-y(x_i)-hy'(x_i)-{h^2\over2}y''(x_i)=O(h^3). \]

Comparing this with (3.2.8) shows that \(E_i=O(h^3)\) if

\begin{equation} \sigma y'(x_i)+\rho y'(x_i+\theta h)=y'(x_i)+{h\over2}y''(x_i) +O(h^2). \tag{3.2.9}\end{equation}

However, applying Taylor’s theorem to \(y'\) shows that

\[ y'(x_i+\theta h)=y'(x_i)+\theta h y''(x_i)+{(\theta h)^2\over2}y'''(\overline x_i), \]

where \(\overline x_i\) is in \((x_i,x_i+\theta h)\). Since \(y'''\) is bounded, this implies that

\[ y'(x_i+\theta h)=y'(x_i)+\theta h y''(x_i)+O(h^2). \]

Substituting this into (3.2.9) and noting that the sum of two \(O(h^2)\) terms is again \(O(h^2)\) shows that \(E_i=O(h^3)\) if

\[ (\sigma+\rho)y'(x_i)+\rho\theta h y''(x_i)= y'(x_i)+{h\over2}y''(x_i), \]

which is true if

\begin{equation} \sigma+\rho=1 \mbox{\quad and \quad} \rho\theta={1\over2}. \tag{3.2.10}\end{equation}

Since \(y'=f(x,y)\), we can now conclude from (3.2.8) that

\begin{equation} y(x_{i+1})=y(x_i)+h\left[\sigma f(x_i,y_i)+\rho f(x_i+\theta h,y(x_i+\theta h))\right]+O(h^3) \tag{3.2.11}\end{equation}

if \(\sigma\), \(\rho\), and \(\theta\) satisfy (3.2.10). However, this formula would not be useful even if we knew \(y(x_i)\) exactly (as we would for \(i=0\)), since we still wouldn’t know \(y(x_i+\theta h)\) exactly. To overcome this difficulty, we again use Taylor’s theorem to write

\[ y(x_i+\theta h)=y(x_i)+\theta h y'(x_i)+{h^2\over2}y''(\tilde x_i), \]

where \(\tilde x_i\) is in \((x_i,x_i+\theta h)\). Since \(y'(x_i)=f(x_i,y(x_i))\) and \(y''\) is bounded, this implies that

\begin{equation} |y(x_i+\theta h)-y(x_i)-\theta h f(x_i,y(x_i))|\le Kh^2 \tag{3.2.12}\end{equation}

for some constant \(K\). Since \(f_y\) is bounded, the mean value theorem implies that

\[ |f(x_i+\theta h,u)-f(x_i+\theta h,v)|\le M|u-v| \]

for some constant \(M\). Letting

\[ u=y(x_i+\theta h)\mbox{\quad and \quad} v=y(x_i)+\theta h f(x_i,y(x_i)) \]

and recalling (3.2.12) shows that

\[ f(x_i+\theta h,y(x_i+\theta h))=f(x_i+\theta h,y(x_i)+\theta h f(x_i,y(x_i)))+O(h^2). \]

Substituting this into (3.2.11) yields

\begin{eqnarray*} y(x_{i+1})&=&y(x_i)+h\left[\sigma f(x_i,y(x_i))+\right. \\ &&\left.\rho f(x_i+\theta h,y(x_i)+\theta hf(x_i,y(x_i)))\right]+O(h^3). \end{eqnarray*}

This implies that the formula

\[ y_{i+1}=y_i+h\left[\sigma f(x_i,y_i)+\rho f(x_i+\theta h,y_i+\theta hf(x_i,y_i))\right] \]

has \(O(h^3)\) local truncation error if \(\sigma\), \(\rho\), and \(\theta\) satisfy (3.2.10). Substituting \(\sigma=1-\rho\) and \(\theta=1/2\rho\) here yields

\begin{equation} y_{i+1}=y_i+h\left[(1-\rho)f(x_i,y_i)+\rho f\left(x_i+{h\over2\rho}, y_i+{h\over2\rho}f(x_i,y_i)\right)\right]. \tag{3.2.13}\end{equation}

The computation indicated here can be conveniently organized as follows: given \(y_i\), compute

\begin{eqnarray*} k_{1i}&=&f(x_i,y_i), \\ k_{2i}&=&f\left(x_i+{h\over2\rho}, y_i+{h\over2\rho}k_{1i}\right), \\ y_{i+1}&=&y_i+h[(1-\rho)k_{1i}+\rho k_{2i}]. \end{eqnarray*}

Consistent with our requirement that \(0<\theta<1\), we require that \(\rho\ge1/2\). Letting \(\rho=1/2\) in (3.2.13) yields the improved Euler method (3.2.4). Letting \(\rho=3/4\) yields Heun’s method,

\[ y_{i+1}=y_i+h\left[{1\over4}f(x_i,y_i)+{3\over4}f\left( x_i+{2\over3}h,y_i+{2\over3}hf(x_i,y_i)\right)\right], \]

which can be organized as

\begin{eqnarray*} k_{1i}&=&f(x_i,y_i), \\ k_{2i}&=&f\left(x_i+{2h\over3}, y_i+{2h\over3}k_{1i}\right), \\ y_{i+1}&=&y_i+{h\over4}(k_{1i}+3k_{2i}). \end{eqnarray*}

Letting \(\rho=1\) yields the midpoint method,

\[ y_{i+1}=y_i+hf\left(x_i+{h\over2},y_i+{h\over2}f(x_i,y_i)\right), \]

which can be organized as

\begin{eqnarray*} k_{1i}&=&f(x_i,y_i), \\ k_{2i}&=&f\left(x_i+{h\over2}, y_i+{h\over2}k_{1i}\right), \\ y_{i+1}&=&y_i+hk_{2i}. \end{eqnarray*}

Examples involving the midpoint method and Heun’s method are given in Exercises 23-30.

3.2 Exercises

Most of the following numerical exercises involve initial value problems considered in the exercises in Section 3.1. You’ll find it instructive to compare the results that you obtain here with the corresponding results that you obtained in Section 3.1.

In Exercises 15 use the improved Euler method to find approximate values of the solution of the given initial value problem at the points \(x_i=x_0+ih\), where \(x_0\) is the point where the initial condition is imposed and \(i=1\), \(2\), \(3\).

  1. C \(y'=2x^2+3y^2-2,\quad y(2)=1;\quad h=0.05\)  

    Show answer

    \(y_1=1.542812500,\; y_2=2.421622101,\; y_3=4.208020541\)

  2. C \(y'=y+\sqrt{x^2+y^2},\quad y(0)=1;\quad h=0.1\)  

    Show answer

    \(y_1=1.220207973,\; y_2=1.489578775\; y_3=1.819337186\)

  3. C \(y'+3y=x^2-3xy+y^2,\quad y(0)=2;\quad h=0.05\)  

    Show answer

    \(y_1=1.890687500,\; y_2=1.763784003,\; y_3=1.622698378\)

  4. C \(y'=\dst{1+x\over1-y^2},\quad y(2)=3;\quad h=0.1\)

    Show answer

    \(y_1=2.961317914\)  \(y_2=2.920132727\)  \(y_3=2.876213748\).

  5. C \(y'+x^2y=\sin xy,\quad y(1)=\pi;\quad h=0.2\)

    Show answer

    \(y_1=2.478055238,\; y_2=1.844042564,\; y_3=1.313882333\)

  6. C Use the improved Euler method with step sizes \(h=0.1\), \(h=0.05\), and \(h=0.025\) to find approximate values of the solution of the initial value problem

    \[ y'+3y=7e^{4x},\quad y(0)=2 \]

    at \(x=0\), \(0.1\), \(0.2\), \(0.3\), …, \(1.0\). Compare these approximate values with the values of the exact solution \(y=e^{4x}+e^{-3x}\), which can be obtained by the method of Section 2.1. Present your results in a table like Table 3.2.2.

    Show answer
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)Exact
    1.056.13448000955.00339044854.73467483654.647937102

  7. C Use the improved Euler method with step sizes \(h=0.1\), \(h=0.05\), and \(h=0.025\) to find approximate values of the solution of the initial value problem

    \[ y'+{2\over x}y={3\over x^3}+1,\quad y(1)=1 \]

    at \(x=1.0\), \(1.1\), \(1.2\), \(1.3\), …, \(2.0\). Compare these approximate values with the values of the exact solution

    \[ y={1\over3x^2}(9\ln x+x^3+2) \]

    which can be obtained by the method of Section 2.1. Present your results in a table like Table 3.2.2.

    Show answer
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)Exact
    2.01.3535018391.3532884931.3532194851.353193719

  8. C Use the improved Euler method with step sizes \(h=0.05\), \(h=0.025\), and \(h=0.0125\) to find approximate values of the solution of the initial value problem

    \[ y'={y^2+xy-x^2\over x^2},\quad y(1)=2, \]

    at \(x=1.0\), \(1.05\), \(1.10\), \(1.15\), …, \(1.5\). Compare these approximate values with the values of the exact solution

    \[ y={x(1+x^2/3)\over1-x^2/3} \]

    obtained in Example 2.4.3. Present your results in a table like Table 3.2.2.

    Show answer
    \(x\)\(h=0.05\)\(h=0.025\)\(h=0.0125\)Exact
    1.5010.14196958510.39677040910.47250211110.500000000

  9. C In Example 3.2.2 it was shown that

    \[ y^5+y=x^2+x-4 \]

    is an implicit solution of the initial value problem

    \[ y'={2x+1\over5y^4+1},\quad y(2)=1. \tag*{\rm(A)} \]

    Use the improved Euler method with step sizes \(h=0.1\), \(h=0.05\), and \(h=0.025\) to find approximate values of the solution of (A) at \(x=2.0\), \(2.1\), \(2.2\), \(2.3\), …, \(3.0\). Present your results in tabular form. To check the error in these approximate values, construct another table of values of the residual

    \[ R(x,y)=y^5+y-x^2-x+4 \]

    for each value of \((x,y)\) appearing in the first table.

    Show answer
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)\(h=0.1\)\(h=0.05\)\(h=0.025\)
    3.01.4556748161.4559351271.456001289-0.00818-0.00207-0.000518
    Approximate SolutionsResiduals

  10. C You can see from Example 2.5.1 that

    \[ x^4y^3+x^2y^5+2xy=4 \]

    is an implicit solution of the initial value problem

    \[ y'=-{4x^3y^3+2xy^5+2y\over3x^4y^2+5x^2y^4+2x},\quad y(1)=1. \tag*{\rm(A)} \]

    Use the improved Euler method with step sizes \(h=0.1\), \(h=0.05\), and \(h=0.025\) to find approximate values of the solution of (A) at \(x=1.0\), \(1.14\), \(1.2\), \(1.3\), …, \(2.0\). Present your results in tabular form. To check the error in these approximate values, construct another table of values of the residual

    \[ R(x,y)=x^4y^3+x^2y^5+2xy-4 \]

    for each value of \((x,y)\) appearing in the first table.

    Show answer
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)\(h=0.1\)\(h=0.05\)\(h=0.025\)
    2.00.4928629990.4927099310.4926748550.003350.0007770.000187
    Approximate SolutionsResiduals

  11. C Use the improved Euler method with step sizes \(h=0.1\), \(h=0.05\), and \(h=0.025\) to find approximate values of the solution of the initial value problem

    \[ (3y^2+4y)y'+2x+\cos x=0, \quad y(0)=1 \mbox{\ (Exercise~2.2.~\hspace*{-3pt}\ref{exer:2.2.13})} \]

    at \(x=0\), \(0.1\), \(0.2\), \(0.3\), …, \(1.0\).

    Show answer
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)“Exact"
    1.00.6602681590.6600285050.6599744640.659957689

  12. C Use the improved Euler method with step sizes \(h=0.1\), \(h=0.05\), and \(h=0.025\) to find approximate values of the solution of the initial value problem

    \[ y'+{(y+1)(y-1)(y-2)\over x+1}=0, \quad y(1)=0 \mbox{\ (Exercise~2.2.~\hspace*{-3pt}\ref{exer:2.2.14})} \]

    at \(x=1.0\), \(1.1\), \(1.2\), \(1.3\), …, \(2.0\).

    Show answer
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)“Exact"
    2.0-0.749751364-0.750637632-0.750845571-0.750912371

  13. C Use the improved Euler method and the improved Euler semilinear method with step sizes \(h=0.1\), \(h=0.05\), and \(h=0.025\) to find approximate values of the solution of the initial value problem

    \[ y'+3y=e^{-3x}(1-2x),\quad y(0)=2, \]

    at \(x=0\), \(0.1\), \(0.2\), \(0.3\), …, \(1.0\). Compare these approximate values with the values of the exact solution \(y=e^{-3x}(2+x-x^2)\), which can be obtained by the method of Section 2.1. Do you notice anything special about the results? Explain.

    Show answer

    Applying variation of parameters to the given initial value problem

    \(y=ue^{-3x}\), where (A) \(u'=1-2x,\quad u(0)=2\). Since \(u'''=0\), the improved Euler method yields the exact solution of (A). Therefore the improved Euler semilinear method produces the exact solution of the given problem.

    Improved Euler method
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)Exact
    1.00.1056604010.1009243990.0998936850.099574137

    Improved Euler semilinear method
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)Exact
    1.00.0995741370.0995741370.0995741370.099574137

The linear initial value problems in Exercises 1419 can’t be solved exactly in terms of known elementary functions. In each exercise use the improved Euler and improved Euler semilinear methods with the indicated step sizes to find approximate values of the solution of the given initial value problem at 11 equally spaced points (including the endpoints) in the interval.

  1. C \(y'-2y=\dst{1\over1+x^2},\quad y(2)=2\);   \(h=0.1,0.05,0.025\) on \([2,3]\)

    Show answer
    Improved Euler method
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)“Exact"
    3.015.10760096815.23485600015.26975507215.282004826

    Improved Euler semilinear method
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)“Exact"
    3.015.28523172615.28281242415.28220678015.282004826

  2. C \(y'+2xy=x^2,\quad y(0)=3\);  \(h=0.2,0.1,0.05\) on \([0,2]\)   (Exercise 2.1. 38)

    Show answer
    Improved Euler method
    \(x\)\(h=0.2\)\(h=0.1\)\(h=0.05\)“Exact"
    2.00.9243353750.9078660810.9050582010.904276722

    Improved Euler semilinear method
    \(x\)\(h=0.2\)\(h=0.1\)\(h=0.05\)“Exact"
    2.00.9696707890.9208618580.9084382610.904276722

  3. C \(\dst{y'+{1\over x}y={\sin x\over x^2},\quad y(1)=2}\),   \(h=0.2,0.1,0.05\) on \([1,3]\)   (Exercise 2.1.39)

    Show answer
    Improved Euler method
    \(x\)\(h=0.2\)\(h=0.1\)\(h=0.05\)“Exact"
    3.00.9674737210.9675107900.9675200620.967523153

    Improved Euler semilinear method
    \(x\)\(h=0.2\)\(h=0.1\)\(h=0.05\)“Exact"
    3.00.9674737210.9675107900.9675200620.967523153

  4. C \(\dst{y'+y={e^{-x}\tan x\over x},\quad y(1)=0}\);  \(h=0.05,0.025,0.0125\) on \([1,1.5]\)  (Exercise 2.1. 40),

    Show answer
    Improved Euler method
    \(x\)\(h=0.0500\)\(h=0.0250\)\(h=0.0125\)“Exact"
    1.500.3491760600.3451716640.3441312820.343780513

    Improved Euler semilinear method
    \(x\)\(h=0.0500\)\(h=0.0250\)\(h=0.0125\)“Exact"
    1.500.3493502060.3452168940.3441428320.343780513

  5. C \(\dst{y'+{2x\over 1+x^2}y={e^x\over (1+x^2)^2}, \quad y(0)=1}\);  \(h=0.2,0.1,0.05\) on \([0,2]\)  (Exercise 2.1. 41)

    Show answer
    Improved Euler method
    \(x\)\(h=0.2\)\(h=0.1\)\(h=0.05\)“Exact"
    2.00.7326792230.7327216130.7326679050.732638628

    Improved Euler semilinear method
    \(x\)\(h=0.2\)\(h=0.1\)\(h=0.05\)“Exact"
    2.00.7321666780.7325210780.7326092670.732638628

  6. C \(xy'+(x+1)y=e^{x^2},\quad y(1)=2\);  \(h=0.05,0.025,0.0125\) on \([1,1.5]\)  (Exercise 2.1. 42)

    Show answer
    Improved Euler method
    \(x\)\(h=0.0500\)\(h=0.0250\)\(h=0.0125\)“Exact"
    1.502.2478803152.2449751812.2442601432.244023982

    Improved Euler semilinear method
    \(x\)\(h=0.0500\)\(h=0.0250\)\(h=0.0125\)“Exact"
    1.502.2486035852.2451697072.2443104652.244023982

In Exercises 2022 use the improved Euler method and the improved Euler semilinear method with the indicated step sizes to find approximate values of the solution of the given initial value problem at 11 equally spaced points (including the endpoints) in the interval.

  1. C \(y'+3y=xy^2(y+1),\quad y(0)=1\);  \(h=0.1,0.05,0.025\) on \([0,1]\)

    Show answer
    Improved Euler method
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)“Exact"
    1.00.0590718940.0569990280.0565530230.056415515

    Improved Euler semilinear method
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)“Exact"
    1.00.0562959140.0563857650.0564081240.056415515

  2. C \(\dst{y'-4y={x\over y^2(y+1)},\quad y(0)=1}\);  \(h=0.1,0.05,0.025\) on \([0,1]\)

    Show answer
    Improved Euler method
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)“Exact"
    1.050.53455634653.48394701354.39154444054.729594761

    Improved Euler semilinear method
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)“Exact"
    1.054.70904143454.72408357254.72819136654.729594761

  3. C \(\dst{y'+2y={x^2\over1+y^2},\quad y(2)=1}\);  \(h=0.1,0.05,0.025\) on \([2,3]\)

    Show answer
    Improved Euler method
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)“Exact"
    3.01.3613953091.3613792591.3613822391.361383810

    Improved Euler semilinear method
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)“Exact"
    3.01.3756999331.3647309371.3621939971.361383810

  4. C Do Exercise 7 with “improved Euler method” replaced by “midpoint method.”

    Show answer
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)Exact
    2.01.3494890561.3523459001.3529908221.353193719

  5. C Do Exercise 7 with “improved Euler method” replaced by “Heun’s method.”

    Show answer
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)Exact
    2.01.3508907361.3526675991.3530679511.353193719

  6. C Do Exercise 8 with “improved Euler method” replaced by “midpoint method.”

    Show answer
    \(x\)\(h=0.05\)\(h=0.025\)\(h=0.0125\)Exact
    1.5010.13302131110.39165509810.47073141110.500000000

  7. C Do Exercise 8 with “improved Euler method” replaced by “Heun’s method.”

    Show answer
    \(x\)\(h=0.05\)\(h=0.025\)\(h=0.0125\)Exact
    1.5010.13632964210.39341968110.47073141110.500000000

  8. C Do Exercise 11 with “improved Euler method” replaced by “midpoint method.”

    Show answer
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)“Exact"
    1.00.6608468350.6601897490.6600169040.659957689

  9. C Do Exercise 11 with “improved Euler method” replaced by “Heun’s method.”

    Show answer
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)“Exact"
    1.00.6606584110.6601366300.6600028400.659957689

  10. C Do Exercise 12 with “improved Euler method” replaced by “midpoint method.”

    Show answer
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)“Exact"
    2.0-0.750626284-0.750844513-0.750895864-0.751331499
  11. C Do Exercise 12 with “improved Euler method” replaced by “Heun’s method.”

    Show answer
    \(x\)\(h=0.1\)\(h=0.05\)\(h=0.025\)“Exact"
    2.0-0.750335016-0.750775571-0.750879100-0.751331499

  12. Show that if \(f\), \(f_x\), \(f_y\), \(f_{xx}\), \(f_{yy}\), and \(f_{xy}\) are continuous and bounded for all \((x,y)\) and \(y\) is the solution of the initial value problem

    \[ y'=f(x,y),\quad y(x_0)=y_0, \]

    then \(y''\) and \(y'''\) are bounded.

  13. Numerical Quadrature (see Exercise 3.1. 23).

    1. Derive the quadrature formula

      \[ \int_a^bf(x)\,dx\approx .5h(f(a)+f(b))+ h\sum_{i=1}^{n-1}f(a+ih)\mbox{\quad(where $h=(b-a)/n)$} \tag*{\rm(A)} \]

      by applying the improved Euler method to the initial value problem

      \[ y'=f(x),\quad y(a)=0. \]
    2. The quadrature formula (A) is called the trapezoid rule. Draw a figure that justifies this terminology.

    3. L For several choices of \(a\), \(b\), \(A\), and \(B\), apply (A) to \(f(x)=A+Bx\), with \(n = 10,20,40,80,160,320\). Compare your results with the exact answers and explain what you find.

    4. L For several choices of \(a\), \(b\), \(A\), \(B\), and \(C\), apply (A) to \(f(x)=A+Bx+Cx^2\), with \(n=10\), \(20\), \(40\), \(80\), \(160\), \(320\). Compare your results with the exact answers and explain what you find.