# Elementary differential equations 7th edition - Boyce W.E

ISBN 0-471-31999-6

**Download**(direct link)

**:**

**185**> 186 187 188 189 190 191 .. 486 >> Next

1000

6.010 18.04

2.004 6.000

as follows.

(a) First round each entry in the determinant to two digits.

(b) First round each entry in the determinant to three digits.

(c) Retain all four digits. Compare this value with the results in parts (a) and (b).

27. The distributive law a(b — c) = ab — ac does not hold, in general, if the products are

rounded off to a smaller number of digits. To show this in a specific case take a = 0.22,

b = 3.19, and c = 2.17. After each multiplication round off the last digit.

430

Chapter 8. Numerical Methods

8.2 Improvements on the Euler Method

Since for many problems the Euler method requires a very small step size to produce sufficiently accurate results, much effort has been devoted to the development of more efficient methods. In the next three sections we will discuss some of these methods. Consider the initial value problem

y = f (t> y)> y(to) = Jo (1)

and let y = $(t) denote its solution. Recall from Eq. (10) of Section 8.1 that by

integrating the given differential equation from tn to tn+1 we obtain

r n+i

0(tn+i) = $(tn) + / f[t,¹)] dt. (2)

Jtn

The Euler formula

Jn+1 = Jn + hf(tn, Jn) (3)

is obtained by replacing f [t, $(t)] in Eq. (2) by its approximate value f (tn, yn) at the

left endpoint of the interval of integration.

Improved Euler Formula. A better approximate formula can be obtained if the integrand in Eq. (2) is approximated more accurately. One way to do this is to replace the integrand by the average of its values at the two endpoints, namely, { f [tn, $(tn)] + f [tn+1, $(tn+1)]}/2. This is equivalent to approximating the area under the curve in Figure 8.2.1 between t = tn and t = tn+1 by the area of the shaded trape-zoid. Further, we replace $( tn) and $( tn+1) by their respective approximate values yn and yn 1 . In this way we obtain from Eq. (2)

, f (tn, Jn) + f(tn+1, Jn+1)I.

Jn+1 = yn +------------------2------------------------------------- (4)

Since the unknown yn+1 appears as one of the arguments of f on the right side of Eq. (4), this equation defines yn+1 implicitly rather than explicitly. Depending on the nature of the function f, it may be fairly difficult to solve Eq. (4) for yn+1. This

y- y = f[t. 0 (t)]

f [tn+1 ' $ (tn+1 -

f [tn. 0 (tn)] 1 T 2{f [tn. <l> (tn)] +

f [tn+1. 1 (tn+1)]] i .

t t 1

Ln Ln+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 of Eq. (4) by the value obtained using the Euler formula (3). Thus

yn+_ = ^ + fO.? ) + f[tn + *y, + hf (tn. yn)] h

= y„ + f + f (tn y" + K) 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 0(tn+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 y = f(t, y) reduces to integrating f (t). In this case the improved Euler formula (5) becomes

yn+1 — yn = 2[ f (tn) + f (tn + h)l (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

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

n = 1 — tn + 4 yn

and

f(tn + yn + hfn) = 1 — (tn + h) + 4(yn + hfn).

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, y1 + 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.

**185**> 186 187 188 189 190 191 .. 486 >> Next