3.2: The Improved Euler Method
- Page ID
- 103483
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\dsum}{\displaystyle\sum\limits} \)
\( \newcommand{\dint}{\displaystyle\int\limits} \)
\( \newcommand{\dlim}{\displaystyle\lim\limits} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)Section 3.1 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 is not 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
\[\label{eq:3.2.1} y'=f(x,y),\quad y(x_0)=y_0,\]
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 \nonumber\]
(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 will 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.3, we will 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.
| \(n\) | Euler | Improved Euler | Runge-Kutta | Exact |
|---|---|---|---|---|
| 12 | 2.613035290 | 2.707188994 | 2.718069764 | 2.718281828 |
| 24 | 2.663731258 | 2.715327371 | 2.718266612 | 2.718281828 |
| 48 | 2.690496599 | 2.717519565 | 2.718280809 | 2.718281828 |
The Improved Euler Method
The improved Euler method for solving the initial value problem Equation \ref{eq:3.2.1} is based on approximating the integral curve of Equation \ref{eq: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};\nonumber \]
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
\[\label{eq:3.2.2} y=y(x_i)+{f(x_i,y(x_i))+f(x_{i+1},y(x_{i+1}))\over2}(x-x_i).\]
Setting \(x=x_{i+1}=x_i+h\) in Equation \ref{eq:3.2.2} yields
\[\label{eq:3.2.3} y_{i+1}=y(x_i)+{h\over2}\left(f(x_i,y(x_i))+f(x_{i+1},y(x_{i+1}))\right)\]
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 Equation \ref{eq: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).\nonumber \]
However, this still will not work, because we do not know \(y(x_{i+1})\). 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
\[\label{eq:3.2.4} 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).\]
The computation indicated here can be conveniently organized as follows: given \(y_i\), compute
\[\begin{aligned} 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{aligned}\nonumber \]
The improved Euler method requires two evaluations of \(f(x,y)\) per step, while Euler’s method requires only one. However, as we can see the error is significantly reduced.
Example 3.2.1 illustrates the computational procedure indicated in the improved Euler method.
Use the improved Euler method with \(h=0.1\) to find approximate values of the solution of the initial value problem
\[\label{eq:3.2.5} y'+2y=x^3e^{-2x},\quad y(0)=1\]
at \(x=0.1,0.2,0.3\).
Solution
As in Example 3.1.1, we rewrite Equation \ref{eq:3.2.5} as
\[y'=-2y+x^3e^{-2x},\quad y(0)=1,\nonumber \]
which is of the form Equation \ref{eq:3.2.1}, with
\[f(x,y)=-2y+x^3e^{-2x}, x_0=0,\text{and } y_0=1.\nonumber \]
The improved Euler method yields
\[\begin{aligned} k_{10} & = f(x_0,y_0) = f(0,1)=-2,\\ k_{20} & = f(x_1,y_0+hk_{10})=f(0.1,1+(0.1)(-2))\\ &= f(0.1,0.8)=-2(0.8)+(0.1)^3e^{-0.2}=-1.599181269,\\ y_1&=y_0+{h\over2}(k_{10}+k_{20}),\\ &=1+(0.05)(-2-1.599181269)=0.820040937,\\[4pt] k_{11} & = f(x_1,y_1) = f(0.1,0.820040937)= -2(0.820040937)+(0.1)^3e^{-0.2}=-1.639263142,\\ k_{21} & = f(x_2,y_1+hk_{11})=f(0.2,0.820040937+0.1(-1.639263142)),\\ &= f(0.2,0.656114622)=-2(0.656114622)+(.2)^3e^{-0.4}=-1.306866684,\\ y_2&=y_1+{h\over2}(k_{11}+k_{21}),\\ &=.820040937+(.05)(-1.639263142-1.306866684)=0.672734445,\\[4pt] 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)=0.552597643.\end{aligned}\]
Examples Illustrating The Error in the Improved Euler’s Method
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\nonumber \]
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 Example 3.1.2, and the values of the exact solution
\[y={e^{-2x}\over4}(x^4+4). \nonumber\]
Note: 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\).
| Euler | Improved Euler | Exact | |||
|---|---|---|---|---|---|
| \(x\) | \(h=0.1\) | \(h=0.05\) | \(h=0.1\) | \(h=0.05\) | Exact |
| 0.0 | 1.000000000 | 1.000000000 | 1.000000000 | 1.000000000 | 1.000000000 |
| 0.1 | 0.800000000 | 0.810005655 | 0.820040937 | 0.819050572 | 0.818751221 |
| 0.2 | 0.640081873 | 0.656266437 | 0.672734445 | 0.671086455 | 0.670588174 |
| 0.3 | 0.512601754 | 0.532290981 | 0.552597643 | 0.550543878 | 0.549922980 |
| 0.4 | 0.411563195 | 0.432887056 | 0.455160637 | 0.452890616 | 0.452204669 |
| 0.5 | 0.332126261 | 0.353785015 | 0.376681251 | 0.374335747 | 0.373627557 |
| 0.6 | 0.270299502 | 0.291404256 | 0.313970920 | 0.311652239 | 0.310952904 |
| 0.7 | 0.222745397 | 0.242707257 | 0.264287611 | 0.262067624 | 0.261398947 |
| 0.8 | 0.186654593 | 0.205105754 | 0.225267702 | 0.223194281 | 0.222570721 |
| 0.9 | 0.159660776 | 0.176396883 | 0.194879501 | 0.192981757 | 0.192412038 |
| 1.0 | 0.139778910 | 0.154715925 | 0.171388070 | 0.169680673 | 0.169169104 |
Table 3.2.3 shows analogous results for the initial value problem
\[y'=-2y^2+xy+x^2,\ y(0)=1. \nonumber\]
We applied Euler’s method to this problem in Example 3.1.3.
| Euler | Improved Euler | Exact | |||
|---|---|---|---|---|---|
| \(x\) | \(h=0.1\) | \(h=0.05\) | \(h=0.1\) | \(h=0.05\) | Exact |
| 0.0 | 1.000000000 | 1.000000000 | 1.000000000 | 1.000000000 | 1.000000000 |
| 0.1 | 0.800000000 | 0.821375000 | 0.840500000 | 0.838288371 | 0.837584494 |
| 0.2 | 0.681000000 | 0.707795377 | 0.733430846 | 0.730556677 | 0.729641890 |
| 0.3 | 0.605867800 | 0.633776590 | 0.661600806 | 0.658552190 | 0.657580377 |
| 0.4 | 0.559628676 | 0.587454526 | 0.615961841 | 0.612884493 | 0.611901791 |
| 0.5 | 0.535376972 | 0.562906169 | 0.591634742 | 0.588558952 | 0.587575491 |
| 0.6 | 0.529820120 | 0.557143535 | 0.586006935 | 0.582927224 | 0.581942225 |
| 0.7 | 0.541467455 | 0.568716935 | 0.597712120 | 0.594618012 | 0.593629526 |
| 0.8 | 0.569732776 | 0.596951988 | 0.626008824 | 0.622898279 | 0.621907458 |
| 0.9 | 0.614392311 | 0.641457729 | 0.670351225 | 0.667237617 | 0.666250842 |
| 1.0 | 0.675192037 | 0.701764495 | 0.730069610 | 0.726985837 | 0.726015790 |


