# Elementary Differential Equations and Boundary Value Problems - Boyce W.E.

**Download**(direct link)

**:**

**233**> 234 235 236 237 238 239 .. 609 >> Next

Ó' Ó' = f[t, ^(t)]

f[tn+1 ' Ô (tn+l)] -

f ²¯ï.ô (tn)] --- 1 t

2{f [tn. Ô (tn)] +

f [tn+1. Ô (tn+1)]}

³ .

tt

Ln cn+1

FIGURE 8.2.1 Derivation of the improved Euler method.

8.2 Improvements on the Euler Method

431

EXAMPLE

1

difficulty can be overcome by replacing yn+1 on the right side ofEq. (4) by the value obtained using the Euler formula (3). Thus

Óâ+1 = Óï + f^• yB) + f[tB +2hyB + hf (tB. yB)] „

= ya + fB + f (tB +h yn + hfB) h, (5)

where tn+1 has been replaced by tn + h.

Equation (5) gives an explicit formula for computing yn+1, the approximate value of ô^ï+1), in terms of the data at tn. This formula is known as the improved Euler

formula or the Heun formula. The improved Euler formula is an example of a two-

stage method; that is, we first calculate yn + hfn from the Euler formula and then use this result to calculate yn 1 from Eq. (5). The improved Euler formula (5) does represent an improvement over the Euler formula (3) because the local truncation error in using Eq. (5) is proportional to h3, while for the Euler method it is proportional to h2. This error estimate for the improved Euler formula is established in Problem 14. It can also be shown that for a finite interval the global truncation error for the improved Euler formula is bounded by a constant times h2, so this method is a second order method. Note that this greater accuracy is achieved at the expense of more computational work, since it is now necessary to evaluate f (t, y) twice in order to go from tn to tn+1.

If f (t, y) depends only on t and not on y, then solving the differential equation Ó = f(t, y) reduces to integrating f (t). In this case the improved Euler formula (5) becomes

Óï+1 - Óï = 2[ f (tn) + f (tn + h)]> (6)

which is just the trapezoid rule for numerical integration.

Use the improved Euler formula (5) to calculate approximate values of the solution of the initial value problem

Ó = 1 - t + 4y, y(0) = 1. (7)

To make clear exactly what computations are required, we show a couple of steps in detail. For this problem f (t, y) = 1 - t + 4y; hence

B = 1 - tn + 4 Óï

and

f(tn + h, Óï + hfB) = 1 - (tn + h) + 4(Óï + hfB).

Further, t0 = 0, y0 = 1, and f0 = 1 - t0 + 4y0 = 5. If h = 0.025, then

f(t0 + h, y0 + hf0) = 1 - 0.025 + 4[1 + (0.025)(5)] = 5.475.

Then, from Eq. (5),

y1 = 1 + (0.5)(5 + 5.475)(0.025) = 1.1309375. (8)

At the second step we must calculate

f1 = 1 - 0.025 + 4(1.1309375) = 5.49875, y1 + hf1 = 1.1309375 + (0.025)(5.49875) = 1.26840625,

432

Chapter 8. Numerical Methods

and

f(t2, y + hf1) = 1 — 0.05 + 4(1.26840625) = 6.023625.

Then, from Eq. (5),

y2 = 1.1309375 + (0.5)(5.49875 + 6.023625)(0.025) = 1.2749671875. (9)

Further results for 0 < t < 2 obtained by using the improved Euler method with h = 0.025 and h = 0.01 are given in Table 8.2.1. To compare the results of the improved Euler method with those of the Euler method, note that the improved Euler method requires two evaluations of f at each step while the Euler method requires only one. This is significant because typically most of the computing time in each step is spent in evaluating f, so counting these evaluations is a reasonable way to estimate the total computing effort. Thus, for a given step size h, the improved Euler method requires twice as many evaluations of f as the Euler method. Alternatively, the improved Euler method for step size h requires the same number of evaluations of f as the Euler method with step size h/2.

TABLE 8.2.1 A Comparison of Results Using the Euler and Improved Euler Methods for the Initial Value Problem Ó = 1 — t + 4y, y(0) = 1

t Euler Improved Euler Exact

h = 0.01 h = 0.001 h = 0.025 h = 0.01

0 1.0000000 1 . 0000000 1.0000000 1 . 0000000 1 . 0000000

0.1 1.5952901 1 .6076289 1 .6079462 1.6088585 1 . 6090418

0.2 2.4644587 2.5011159 2.5020619 2.5047828 2.5053299

0.3 3.7390345 3.8207130 3.8228282 3.8289146 3.8301388

0.4 5.6137120 5.7754845 5.7796888 5.7917911 5.7942260

0.5 8.3766865 8.6770692 8.6849039 8.7074637 8.7120041

1.0 60.037126 64.82558 64.497931 64.830722 64.897803

1.5 426.40818 473.55979 474.83402 478.51588 479.25919

2.0 3029.3279 3484.1608 3496.6702 3532.8789 3540.2001

By referring to Table 8.2.1 you can see that the improved Euler method with h = 0.025 gives much better results than the Euler method with h = 0.01. Note that to reach t = 2 with these step sizes the improved Euler method requires 160 evaluations of f while the Euler method requires 200. More noteworthy is that the improved Euler method with h = 0.025 is also slightly more accurate than the Euler method with h = 0.001 (2000 evaluations of f). In other words, with something like one-twelfth of the computing effort, the improved Euler method yields results for this problem that are comparable to, or a bit better than, those generated by the Euler method. This illustrates that, compared to the Euler method, the improved Euler method is clearly more efficient, yielding substantially better results or requiring much less total computing effort, or both.

**233**> 234 235 236 237 238 239 .. 609 >> Next