Processing math: 100%
Skip to main content
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
Mathematics LibreTexts

3.2: The Improved Euler Method and Related Methods

( \newcommand{\kernel}{\mathrm{null}\,}\)

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 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

y=f(x,y),y(x0)=y0,

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,y(0)=1

(with solution y=ex) 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 yn 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.715327371 2.718280809 2.718281828
24 2.663731258 2.717519565 2.718281763 2.718281828
48 2.690496599 2.718088247 2.718281824 2.718281828
Table 3.2.1 : Approximations to e obtained by three numerical methods.

The Improved Euler Method

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

mi=f(xi,y(xi))+f(xi+1,y(xi+1))2;

that is, mi is the average of the slopes of the tangents to the integral curve at the endpoints of [xi,xi+1]. The equation of the approximating line is therefore

y=y(xi)+f(xi,y(xi))+f(xi+1,y(xi+1))2(xxi).

Setting x=xi+1=xi+h in Equation ??? yields

yi+1=y(xi)+h2(f(xi,y(xi))+f(xi+1,y(xi+1)))

as an approximation to y(xi+1). As in our derivation of Euler’s method, we replace y(xi) (unknown if i>0) by its approximate value yi; then Equation ??? becomes

yi+1=yi+h2(f(xi,yi)+f(xi+1,y(xi+1)).

However, this still will not work, because we do not know y(xi+1), which appears on the right. We overcome this by replacing y(xi+1) by yi+hf(xi,yi), the value that the Euler method would assign to yi+1. Thus, the improved Euler method starts with the known value y(x0)=y0 and computes y1, y2, …, yn successively with the formula

yi+1=yi+h2(f(xi,yi)+f(xi+1,yi+hf(xi,yi))).

The computation indicated here can be conveniently organized as follows: given yi, compute

k1i=f(xi,yi),k2i=f(xi+h,yi+hk1i),yi+1=yi+h2(k1i+k2i).

The improved Euler method requires two evaluations of f(x,y) per step, while Euler’s method requires only one. However, we will see at the end of this section that if f satisfies appropriate assumptions, the local truncation error with the improved Euler method is O(h3), rather than O(h2) as with Euler’s method. Therefore the global truncation error with the improved Euler method is O(h2); however, we will not 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.2.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

y+2y=x3e2x,y(0)=1

at x=0.1,0.2,0.3.

Solution

As in Example 3.1.1, we rewrite Equation ??? as

y=2y+x3e2x,y(0)=1,

which is of the form Equation ???, with

f(x,y)=2y+x3e2x,x0=0,and y0=1.

The improved Euler method yields

k10=f(x0,y0)=f(0,1)=2,k20=f(x1,y0+hk10)=f(0.1,1+(0.1)(2))=f(0.1,0.8)=2(0.8)+(0.1)3e0.2=1.599181269,y1=y0+h2(k10+k20),=1+(0.05)(21.599181269)=0.820040937,k11=f(x1,y1)=f(0.1,0.820040937)=2(0.820040937)+(0.1)3e0.2=1.639263142,k21=f(x2,y1+hk11)=f(0.2,0.820040937+0.1(1.639263142)),=f(0.2,0.656114622)=2(0.656114622)+(.2)3e0.4=1.306866684,y2=y1+h2(k11+k21),=.820040937+(.05)(1.6392631421.306866684)=0.672734445,k12=f(x2,y2)=f(.2,.672734445)=2(.672734445)+(.2)3e.4=1.340106330,k22=f(x3,y2+hk12)=f(.3,.672734445+.1(1.340106330)),=f(.3,.538723812)=2(.538723812)+(.3)3e.6=1.062629710,y3=y2+h2(k12+k22)=.672734445+(.05)(1.3401063301.062629710)=0.552597643.

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=x3e2x,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 [example:3.1.2}, and the values of the exact solution

y=e2x4(x4+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.

  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.2 : Numerical solution of y+2y=x3e2x, y(0)=1, by Euler’s method and the improved Euler method.
Example 3.2.3

Table 3.2.3 shows analogous results for the nonlinear initial value problem

y=2y2+xy+x2, y(0)=1.

We applied Euler’s method to this problem in Example 3.2.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
Table 3.2.3 : Numerical solution of y=2y2+xy+x2, y(0)=1, by Euler’s method and the improved Euler method.
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

y2xy=1,y(0)=3

at x=0, 0.2, 0.4, 0.6, …, 2.0 by:

  1. the improved Euler method;
  2. the improved Euler semilinear method.

We used Euler’s method and the Euler semilinear method on this problem in Example 3.1.4.

Solution a

Rewriting Equation ??? as

y=1+2xy,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 y1=ex2 is a solution of the complementary equation y2xy=0, we can apply the improved Euler semilinear method to Equation ???, with

y=uex2andu=ex2,u(0)=3.

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

x h=0.2 h=0.1 h=0.05 Exact
0.0 3.000000000 3.000000000 3.000000000 3.000000000
0.2 3.328000000 3.328182400 3.327973600 3.327851973
0.4 3.964659200 3.966340117 3.966216690 3.966059348
0.6 5.057712497 5.065700515 5.066848381 5.067039535
0.8 6.900088156 6.928648973 6.934862367 6.936700945
1.0 10.065725534 10.154872547 10.177430736 10.184923955
1.2 15.708954420 15.970033261 16.041904862 16.067111677
1.4 26.244894192 26.991620960 27.210001715 27.289392347
1.6 46.958915746 49.096125524 49.754131060 50.000377775
1.8 89.982312641 96.200506218 98.210577385 98.982969504
2.0 184.563776288 203.151922739 209.464744495 211.954462214
Table 3.2.4 : Numerical solution of y2xy=1, y(0)=3, by the improved Euler method.
x h=0.2 h=0.1 h=0.05 Exact
0.0 3.000000000 3.000000000 3.000000000 3.000000000
0.2 3.326513400 3.327518315 3.327768620 3.327851973
0.4 3.963383070 3.965392084 3.965892644 3.966059348
0.6 5.063027290 5.066038774 5.066789487 5.067039535
0.8 6.931355329 6.935366847 6.936367564 6.936700945
1.0 10.178248417 10.183256733 10.184507253 10.184923955
1.2 16.059110511 16.065111599 16.066611672 16.067111677
1.4 27.280070674 27.287059732 27.288809058 27.289392347
1.6 49.989741531 49.997712997 49.999711226 50.000377775
1.8 98.971025420 98.979972988 98.982219722 98.982969504
2.0 211.941217796 211.951134436 211.953629228 211.954462214
Table 3.2.5 : Numerical solution of y2xy=1, y(0)=3, by the improved Euler semilinear method.

A Family of Methods with O(h³) Local Truncation Error

We will now derive a class of methods with O(h3) local truncation error for solving Equation ???. For simplicity, we assume that f, fx, fy, fxx, fyy, and fxy are continuous and bounded for all (x,y). This implies that if y is the solution of Equation ??? then y and y are bounded (Exercise 3.2.31).

We begin by approximating the integral curve of Equation ??? at (xi,y(xi)) by the line through (xi,y(xi)) with slope

mi=σy(xi)+ρy(xi+θh),

where σ, ρ, and θ are constants that we will soon specify; however, we insist at the outset that 0<θ1, so that

xi<xi+θhxi+1.

The equation of the approximating line is

y=y(xi)+mi(xxi)=y(xi)+[σy(xi)+ρy(xi+θh)](xxi).

Setting x=xi+1=xi+h in Equation ??? yields

ˆyi+1=y(xi)+h[σy(xi)+ρy(xi+θh)]

as an approximation to y(xi+1).

To determine σ, ρ, and θ so that the error

Ei=y(xi+1)ˆyi+1=y(xi+1)y(xi)h[σy(xi)+ρy(xi+θh)]

in this approximation is O(h3), we begin by recalling from Taylor’s theorem that

y(xi+1)=y(xi)+hy(xi)+h22y(xi)+h36y(ˆxi),

where ˆxi is in (xi,xi+1). Since y is bounded this implies that

y(xi+1)y(xi)hy(xi)h22y(xi)=O(h3).

Comparing this with Equation ??? shows that Ei=O(h3) if

σy(xi)+ρy(xi+θh)=y(xi)+h2y(xi)+O(h2).

However, applying Taylor’s theorem to y shows that

y(xi+θh)=y(xi)+θhy(xi)+(θh)22y(¯xi),

where ¯xi is in (xi,xi+θh). Since y is bounded, this implies that

y(xi+θh)=y(xi)+θhy(xi)+O(h2).

Substituting this into Equation ??? and noting that the sum of two O(h2) terms is again O(h2) shows that Ei=O(h3) if

(σ+ρ)y(xi)+ρθhy(xi)=y(xi)+h2y(xi),

which is true if

σ+ρ=1andρθ=12.

Since y=f(x,y), we can now conclude from Equation ??? that

y(xi+1)=y(xi)+h[σf(xi,yi)+ρf(xi+θh,y(xi+θh))]+O(h3)

if σ, ρ, and θ satisfy Equation ???. However, this formula would not be useful even if we knew y(xi) exactly (as we would for i=0), since we still wouldn’t know y(xi+θh) exactly. To overcome this difficulty, we again use Taylor’s theorem to write

y(xi+θh)=y(xi)+θhy(xi)+h22y(˜xi),

where ˜xi is in (xi,xi+θh). Since y(xi)=f(xi,y(xi)) and y is bounded, this implies that

|y(xi+θh)y(xi)θhf(xi,y(xi))|Kh2

for some constant K. Since fy is bounded, the mean value theorem implies that

|f(xi+θh,u)f(xi+θh,v)|M|uv|

for some constant M. Letting

u=y(xi+θh)andv=y(xi)+θhf(xi,y(xi))

and recalling Equation ??? shows that

f(xi+θh,y(xi+θh))=f(xi+θh,y(xi)+θhf(xi,y(xi)))+O(h2).

Substituting this into Equation ??? yields

y(xi+1)=y(xi)+h[σf(xi,y(xi))+ρf(xi+θh,y(xi)+θhf(xi,y(xi)))]+O(h3).

This implies that the formula

yi+1=yi+h[σf(xi,yi)+ρf(xi+θh,yi+θhf(xi,yi))]

has O(h3) local truncation error if σ, ρ, and θ satisfy Equation ???. Substituting σ=1ρ and θ=1/2ρ here yields

yi+1=yi+h[(1ρ)f(xi,yi)+ρf(xi+h2ρ,yi+h2ρf(xi,yi))].

The computation indicated here can be conveniently organized as follows: given yi, compute

k1i=f(xi,yi),k2i=f(xi+h2ρ,yi+h2ρk1i),yi+1=yi+h[(1ρ)k1i+ρk2i].

Consistent with our requirement that 0<θ<1, we require that ρ1/2. Letting ρ=1/2 in Equation ??? yields the improved Euler method Equation ???. Letting ρ=3/4 yields Heun’s method,

yi+1=yi+h[14f(xi,yi)+34f(xi+23h,yi+23hf(xi,yi))],

which can be organized as

k1i=f(xi,yi),k2i=f(xi+2h3,yi+2h3k1i),yi+1=yi+h4(k1i+3k2i).

Letting ρ=1 yields the midpoint method,

yi+1=yi+hf(xi+h2,yi+h2f(xi,yi)),

which can be organized as

k1i=f(xi,yi),k2i=f(xi+h2,yi+h2k1i),yi+1=yi+hk2i.

Examples involving the midpoint method and Heun’s method are given in Exercises 3.2.23 - 3.3.30.


This page titled 3.2: The Improved Euler Method and Related Methods is shared under a CC BY-NC-SA 3.0 license and was authored, remixed, and/or curated by William F. Trench.

Support Center

How can we help?