3.2: The Improved Euler Method and Related Methods
3.2: The Improved Euler Method and Related Methods
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
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 = x3 e−2x ,y(0) = 1(3.2.5)
at x = 0.1, 0.2, 0.3.
Solution
As in Example 3.1.1, we rewrite Equation as
y′ = −2y + x3 e−2x ,y(0) = 1,
which is of the form Equation , with
f (x, y) = −2y + x3 e−2x , x0 = 0, and y0 = 1.
The improved Euler method yields
h
y3 = y2 + 2 (k12 + k22)
= .672734445 +(.05)(−1.340106330 − 1.062629710) = 0.552597643.
2
ws 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 = x3 e−2x ,y(0) = 1
.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 th
e−2x
y =(x + 44).
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 = x3e−2x, 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.
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
y′ − 2xy = 1,y(0) = 3
(3.2.6)
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 [example:3.1.4}.)
Solution
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.
Since y = ex2 is a solution of the complementary equation y′ − 2xy = 0 , we can apply the improved Euler semilinear
1
method to Equation , with
2 2
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
Table 3.2.5 : Numerical solution of y′ − 2xy = 1, y(0) = 3 , by the improved Euler semilinear method.
where σ, ρ, and θ are constants that we will soon specify; however, we insist at the outset that 0 < θ ≤ 1 , so that
xi < xi + θh ≤ xi+1 .
y =
y(xi) + mi(x − xi)
= (3.2.7)
y (xi ) + [σy ′ (xi ) + ρy ′ (xi + θh)] (x −
xi ).
Setting x = xi+1 = xi +
h in Equation 3.2.7 yields
as an approximation to y(xi+1 ).
To determine σ, ρ, and θ so that the error
Ei = y(xi+1 ) − yi+1
(3.2.8)
= 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
2 3
h ′′ h ′′′
′ y (xi) y (xi),
y(xi+1 ) = y(xi) + hy (xi)
2 6
+ +
Substituting this into Equation 3.2.9 and noting that the sum of two O(h2) terms is again O(h2) shows that Ei = O(h3) if
′ ′′ ′ h ′′
(σ + ρ)y (x ) + ρθhy (x ) = y (x ) + y (x ),
i i i i
2
which is true if
1
σ + ρ = 1 and ρθ = . (3.2.10)
2
Since y′ = f (x, y), we can now conclude from Equation 3.2.8 that
if σ, ρ, and θ satisfy Equation 3.2.10 . 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 + exactly. To overcome this difficulty, we again use Taylor’s theorem to
θh)
write
h2 ′′
y(xi + θh) = y(xi) + θhy′(xi) y (xi),
2
+
where xi is in (xi, xi + θh) . Since y (xi) = f (xi, y(xi)) and y′′ is bounded, this implies that
′
2
|y (xi + θh ) − y (xi ) − θhf (xi , y (xi ))| ≤ Kh (3.2.12)
for some constant K . Since fy is bounded, the mean value theorem implies that
f (xi + θh, y (xi + θh)) = f (xi + θh , y (xi ) + θhf (xi , y (xi ))) + O(h2 ).
has O(h3) local truncation error if σ, ρ, and θ satisfy Equation 3.2.10. Substituting σ = 1 − ρ and θ = 1/2ρ here yields
1
[
yi+ = yi + h (1 − ρ)f (i x ,i y ) + ρf i
h
, yi
2 +
h
2
f (xi , yi (3.2.13)
( x +
ρ ρ
) )] .
The computation indicated here can be conveniently organized as follows: given yi , compute
k2 = f
i
( xi +
2
h
, yi +
2
h
k1
i
),
ρ ρ
yi+1
= yi + h [(1 − ρ)k1i + ρk2i ].
Consistent with our requirement that 0 < θ < 1 , we require that ρ ≥ 1/2. Letting ρ = 1/2 in Equation 3.2.13 yields the
improved Euler method Equation 3.2.4. Letting ρ = 3/4 yields Heun’s method,
y =y +h
i+1 i
[1 f (x , y ) +
i i
3
f ( x +
i
2
h, y +
i
2
hf (x , y )
i i
)] ,
4 4 3 3
which can be organized as
( ),
k1i = f (xi, yi),
2h 2h
k =f x + ,y + k
2i i i 1i
3 3
h
y i+
= yi + (k1i + 3k2i).
1 4
Letting ρ = 1 yields the midpoint method,
y
i+1
= y + hf x +
i
( i
h
,y +
i
h
f (x , y ) ,
i i
)
2 2
which can be organized as
k1i = f (xi, yi),
h h
(
k 2 = f x i + , yi + k1
i 2 2 i
),
yi+1 = yi + hk2i.
Examples involving the midpoint method and Heun’s method are given in Exercises 3.2.23 - 3.3.30.