2.5 A Closer Look at the Euler Method

The Euler method as presented in Section 2.4 is not often used in practice, mainly because more accurate methods are available. But Euler’s method has the advantage of simplicity, and a careful study of this method yields insights into the workings of more accurate methods, because many of the latter are extensions or refinements of the Euler method.

To compare two different methods of numerical approximation, we need some way to measure the accuracy of each. Theorem 1 tells what degree of accuracy we can expect when we use Euler’s method.

Remark

The error

yactualyapprox=y(xn)yn

in (2) denotes the [cumulative] error in Euler’s method after n steps in the approximation, exclusive of roundoff error (as though we were using a perfect machine that made no roundoff errors). The theorem can be summarized by saying that the error in Euler’s method is of order h; that is, the error is bounded by a [predetermined] constant C multiplied by the step size h. It follows, for instance, that (on a given closed interval) halving the step size cuts the maximum error in half; similarly, with step size h/10 we get 10 times the accuracy (that is, 1/10 the maximum error) as with step size h. Consequently, we can—in principle—get any degree of accuracy we want by choosing h sufficiently small.

We will omit the proof of this theorem, but one can be found in Chapter 7 of G. Birkhoff and G.-C. Rota, Ordinary Differential Equations, 4th ed. (New York: John Wiley, 1989). The constant C deserves some comment. Because C tends to increase as the maximum value of |y(x)| on [a, b] increases, it follows that C must depend in a fairly complicated way on y, and actual computation of a value of C such that the inequality in (2) holds is usually impractical. In practice, the following type of procedure is commonly employed.

  1. Apply Euler’s method to the initial value problem in (1) with a reasonable value of h.

  2. Repeat with h/2, h/4, and so forth, at each stage halving the step size for the next application of Euler’s method.

  3. Continue until the results obtained at one stage agree—to an appropriate number of significant digits—with those obtained at the previous stage. Then the approximate values obtained at this stage are considered likely to be accurate to the indicated number of significant digits.

Example 1

Carry out this procedure with the initial value problem

dydx=2xy1+x2,y(0)=1
(3)

to approximate accurately the value y(1) of the solution at x=1.

Solution

Using an Euler method program, perhaps one of those listed in Figs. 2.4.13 and 2.4.14, we begin with a step size h=0.04 requiring n=25 steps to reach x=1. The table in Fig. 2.5.1 shows the approximate values of y(1) obtained with successively smaller values of h. The data suggest that the true value of y(1) is exactly 0.5. Indeed, the exact solution of the initial value problem in (3) is y(x)=1/(1+x2), so the true value of y(1) is exactly 12.

FIGURE 2.5.1.

Table of values in Example 1.

h Approximate y(1) Actual y(1) |Error|/h
0.04 0.50451 0.50000 0.11
0.02 0.50220 0.50000 0.11
0.01 0.50109 0.50000 0.11
0.005 0.50054 0.50000 0.11
0.0025 0.50027 0.50000 0.11
0.00125 0.50013 0.50000 0.10
0.000625 0.50007 0.50000 0.11
0.0003125 0.50003 0.50000 0.10

The final column of the table in Fig. 2.5.1 displays the ratio of the magnitude of the error to h; that is, |yactualyapprox|/h. Observe how the data in this column substantiate Theorem 1—in this computation, the error bound in (2) appears to hold with a value of C slightly larger than 0.1.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.17.46