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

ISBN 0-471-31999-6

**Download**(direct link)

**:**

**180**> 181 182 183 184 185 186 .. 486 >> Next

8.1 The Euler or Tangent Line Method

To discuss the development and use of numerical procedures we will concentrate mainly on the first order initial value problem consisting of the differential equation

dy

i =f(t ? y> (1)

and the initial condition

y(t0) = Y0- (2)

We assume that the functions f and f are continuous on some rectangle in the ty-plane containing the point (t0, y0). Then, by Theorem 2.4.2, there exists a unique solution

419

420

Chapter 8. Numerical Methods

y = <p( t) of the given problem in some interval about t0. If Eq. (1) is nonlinear, then the interval of existence of the solution may be difficult to determine and may have no simple relationship to the function f. However, in all our discussions we assume that there is a unique solution of the initial value problem (1), (2) in the interval of interest.

In Section 2.7 we described the oldest and simplest numerical approximation method, namely, the Euler or tangent line method. This method is expressed by the equation

yn+1 = yn + f(tn, yn)(tn+1 - tn), n = 0 1 2.... (3)

If the step size has a uniform value h and if we denote f (tn, yn) by fn, then Eq. (3) simplifies to

yn+1 = yn + fnh, n = 0 1 2>---- (4)

Eulers method consists of repeatedly evaluating Eq. (3) or (4), using the result of each step to execute the next step. In this way you obtain a sequence of values y0, yv y2,, yn,... that approximate the values of the solution $(t) at the points

t0, t1, t2,..., tn,....

In Section 2.7 we pointed out that a computer program for Eulers method has the structure given below. The specific instructions can be written in any convenient programming language.

The Euler Method

Step 1. define f ( t, y)

Step 2. input initial values t0 and y0

Step 3. input step size h and number of steps n

Step 4. output t0 and y0

Step 5. for j from 1 to n do

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

y = y + h + k1 t = t + h Step 7. output t and y

Step 8. end

Some examples of Eulers method appear in Section 2.7. As another example, consider the initial value problem

y= 1 - t + 4y, (5)

y(0) = 1. (6)

Equation (5) is a first order linear equation, and it is easily verified that the solution satisfying the initial condition (6) is

y = 0(t) = 41 - 16 + 19e4t. (7)

Since the exact solution is known, we do not need numerical methods to solve the initial value problem (5), (6). On the other hand, the availability of the exact solution makes it easy to determine the accuracy of any numerical procedure that we use on this problem. We will use this problem throughout the chapter to illustrate and compare different numerical methods. The solutions of Eq. (5) diverge rather rapidly from each other, so we should expect that it will be fairly difficult to approximate the solution

(7) well over any considerable interval. Indeed, this is the reason for choosing this

particular problem; it will be relatively easy to observe the benefits of using more accurate methods.

8.1 The Euler or Tangent Line Method

421

EXAMPLE

1

Using the Euler formula (4) and step sizes h = 0.05, 0.025, 0.01, and 0.001, determine approximate values of the solution y = 0(t) of the problem (5), (6) on the interval

0 < t < 2.

The indicated calculations were carried out on a computer and some of the results are shown in Table 8.1.1. Their accuracy is not particularly impressive. For h = 0.01 the percentage error is 3.85% at t = 0.5, 7.49% at t = 1.0, and 14.4% at t = 2.0. The corresponding percentage errors for h = 0.001 are 0.40%, 0.79%, and 1.58%, respectively. Observe that if h = 0.001, then it requires 2,000 steps to traverse the interval from t = 0 to t = 2. Thus considerable computation is needed to obtain even reasonably good accuracy for this problem using the Euler method. When we discuss other numerical approximation methods later in this chapter, we will find that it is possible to obtain comparable or better accuracy with much larger step sizes and many fewer computational steps.

TABLE 8.1.1 A Comparison of Results for the Numerical Solution of / = 1 t + 4y, y(0) = 1 Using the Euler Method for Different Step Sizes h

t h = 0 05 h = 0 025 h = 0 01 h = 0 001 Exact

00 1 0000000 1 0000000 1 0000000 1 0000000 1 0000000

0T 1 5475000 15761188 1 5952901 1 6076289 1 6090418

0^2 2 3249000 2 4080117 2 4644587 2 5011159 2 5053299

0T 3^ 4333560 3 6143837 3 7390345 3^ 8207130 3 8301388

0 4 5 0185326 5 3690304 5 6137120 5 7754845 5 7942260

0 5 7 2901870 7 9264062 8 3766865 8 6770692 8 7120041

1 0 45 588400 53 807866 60 037126 64 382558 64 897803

1 5 282 07187 361 75945 42640818 473 55979 479 25919

2 0 1745 6662 2432 7878 3029 3279 34841608 3540 2001

To begin to investigate the errors in using numerical approximations and also to suggest ways to construct more accurate algorithms it is helpful to mention some alternative ways to look at the Euler method.

First, let us write the differential equation (1) at the point t = tn in the form

dd0 in) = f[tn ,Htn)]. (8)

**180**> 181 182 183 184 185 186 .. 486 >> Next