You are on page 1of 3

Improved Eulers Method

We begin with a derivation of Eulers method that is somewhat dierent from that we discussed previously. Consider the initial value problem y = f (x, y), y(x0) = y0 . (1)

Let h > 0 be xed and consider the equally spaced points xn = x0 + nh, n = 0, 1, 2, . . . . Our goal is to obtain an approximation to the solution (x) of the initial value problem (1) at those points xn that lie in some interval (a, b). Namely, we will describe a method that generates values y0 , y1, y2, . . . that approximate (x) at the respective points x0 , x1, x2, . . . ; that is yn (xn ), n = 0, 1, 2, . . .. Of course, the rst approximant y0 is exact, since y0 = (x0) is given. Thus we must describe how to compute y1 , y2 , . . .. For Eulers method, we begin by integrating both sides of equation (1) from xn to xn+1 to obtain
xn+1 xn+1

(xn+1 ) (xn ) =
xn

(t)dt =
xn

f (t, (t))dt,

where we have substituted (x) for y. Solving for (xn+1 ), we have


xn+1

(xn+1 ) = (xn ) +
xn

f (t, (t))dt.

(2)

Without knowing (t), we cannot integrate f (t, (t)). Hence, we must approximate the integral in (2). Assuming we have already found yn (xn ), the simplest approach is to approximate the area under the function f (t, (t)) by rectangle with base [xn , xn+1 ] and height f (xn , (xn )) (see Figure 1). This gives (xn+1 ) (xn ) + (xn+1 xn )f (xn , (xn )).

Fig. 1. Approximation by a rectangle

Substituting h for xn+1 xn and the approximation yn for (xn ), we arrive at the numerical scheme yn+1 = yn + hf (xn , yn ), n = 0, 1, 2, . . ., which is Eulers method. 1 (3)

How can we improve Eulers method? To answer this, consider the derivation expressed in (2) and (3) and analyze the errors that were introduced to get the approximation. The crucial step in the process was to approximate the integral
xn+1

f (t, (t))dt
xn

by using a rectangle as in Figure 1. This step gives rise to what is called the local truncation error in the method. We know that a better (more accurate) approach to approximating the integral is to use a trapezoid; that is, to apply the trapezoidal rule (see Figure 2). This gives
xn+1

f (t, (t))dt
xn

h [f (xn , (xn) + f (xn+1 , (xn+1))], 2

Fig. 2. Approximation by a trapezoid

which leads to the numerical scheme h (4) [f (xn , yn ) + f (xn+1 , yn+1 )], n = 0, 1, 2, . . . . 2 We call equation (4) the trapezoid scheme. It is an example of an implicit method. That is, unlike Eulers method, equation (4) gives only an implicit formula for yn+1 , since yn+1 appears as an argument of f . Assuming we have already computed yn , some root-nding technique such as Newtons method might be needed to compute yn+1 . Can we somehow modify the trapezoid scheme in order to obtain an explicit method? One idea is rst to get an estimate, say, yn+1 , of the value yn+1 using Eulers method and then use formula (4) with yn+1 replaced by yn+1 on the right-hand side. This two-step process is an example of a predictor-corrector method. That is, we predict yn+1 using Eulers method and then use that value in (4) to obtain a more correct approximation. Setting yn+1 = yn + hf (xn , yn ) in the right-hand side of (4), we obtain yn+1 = yn + yn+1 = yn + h [f (xn , yn ) + f (xn + h, yn + hf (xn , yn ))], n = 0, 1, 2, . . .. 2

where xn+1 = xn + h. This explicit scheme is known as the improved Eulers method.

Problem 1. Compute the improved Eulers method approximation to the solution (x) = ex of y = y, y(0) = 1 at x = 1 using step sizes of h = 1, 101, 102, 103, 104. Problem 2. Use the improved Eulers method with tolerance of = 103 to approximate the solution to the initial value problem y = x + 2y, y(0) = 0.25 at x = 2.

You might also like