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

ISBN 0-471-31999-6

**Download**(direct link)

**:**

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

TABLE 8.2.1 A Comparison of Results Using the Euler and Improved Euler Methods for the Initial Value Problem / = 1 — t + 4y, /(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.

The percentage errors at t = 2 for the improved Euler method are 1.22% for h = 0.025 and 0.21% for h = 0.01.

8.2 Improvements on the Euler Method

433

A computer program for the Euler method can be readily modified to implement the improved Euler method instead. All that is required is to replace Step 6 in the algorithm in Section 8.1 by the following:

Step 6. k 1 = f (t, y)

k2 = f (t + h, y + h * k 1) y = y + (h/2) * (k 1 + k2) t = t + h

Variation of Step Size. In Section 8.1 we mentioned the possibility of adjusting the step size as a calculation proceeds so as to maintain the local truncation error at a more or less constant level. The goal is to use no more steps than necessary, and at the same time to keep some control over the accuracy of the approximation. Here we will describe how this can be done. Suppose that after n steps we have reached the point (tn, Yn). We choose a step size h and calculate yn+r Next we need to estimate the error we have made in calculating yn 1. In the absence of knowing the actual solution the

best that we can do is to use a more accurate method and repeat the calculation starting

from (tn, yn). For example, if we used the Euler method for the original calculation, we might repeat with the improved Euler method. Then the difference between the two calculated values is an estimate ens+1 of the error in using the original method. If the estimated error is different from the error tolerance e, then we adjust the step size and repeat the calculation. The key to making this adjustment efficiently is knowing how the local truncation error en 1 depends on the step size h. For the Euler method the local truncation error is proportional to h2, so to bring the estimated error down (or up) to the tolerance level e we must multiply the original step size by the factor Ve/e-.

To illustrate this procedure consider the example problem (7),

/ = 1 — t + 4 y, y (0) = 1.

You can verify that after one step with h = 0.1 we obtain the values 1.5 and 1.595 from the Euler method and the improved Euler method, respectively. Thus the estimated error in using the Euler method is 0.095. If we have chosen an error tolerance of 0.05, for instance, then we need to adjust the step size downward by the factor ^/0.05/0.095 = 0.73. Rounding downward to be conservative, let us choose the adjusted step size h = 0.07. Then, from the Euler formula we obtain

y1 = 1 + (0.07) f(0, 1) = 1.35 = 0(0.07).

Using the improved Euler method we obtain y1 = 1.39655, so the estimated error in using the Euler formula is 0.04655, which is slightly less than the specified tolerance. The actual error, based on a comparison with the solution itself, is somewhat greater, namely, 0.05122.

The same procedure can be followed at each step of the calculation, thereby keeping the local truncation error approximately constant throughout the entire numerical process. Modern adaptive codes for solving differential equations adjust the step size as they proceed in very much this way, although they usually use more accurate formulas than the Euler and improved Euler formulas. Consequently, they are able to achieve both efficiency and accuracy by using very small steps only where they are really needed.

434

Chapter 8. Numerical Methods

PROBLEMS In each of Problems 1 through 6 find approximate values of the solution of the given initial

value problem at t = 0.1, 0.2, 0.3, and 0.4. Compare the results with those obtained by the Euler

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