The Initial Value Problem y' = f(x, y) ; y(c) = d 87
method, the second order Runge-Kutta method, or the Heun method
for producing an approximation to the solution of the IVP (1):
(14)
where hn = (xn+l - Xn)· The loca l discretization error for this method is
(15)
where hn = (xn+l - Xn)· Thus, the local discretization error for the improved
Euler's method is proportional to the cube of the stepsize; whereas, the loca l
discretization error for Euler's method is proportional to the square of the
stepsize. The greater accuracy of the improved Euler's method must be paid
for by an increase in the total number of computations which must b e per-
formed and the number off function evaluations per step. Notice that f must
be evaluated twice for each step when using the improved Euler's method;
whereas, f is only evaluated once per step when using Euler's method.
EXAMPLE 4 Improved Euler's Approximation of the Solution
to the IVP: y' = y + x ; y(O) = 1
a. Find an approximate solution to the initial value problem
(7) y' = y + x = f(x, y); y(O) = 1
on the interval [O, l] using the improved Euler's method and a constant stepsize
h = .1.
b. Use equation (15) to estimate the maximum local discretization error on
[O, l].
SOLUTION
a. Table 2.3 is the improved Euler's approximation to the IVP (7) on the
interval [O, l] obtained using a constant stepsize of h = .1. The value S1 =
f(xn, Yn) = Yn + Xn is an approximation to the slope to the exact solution
of (7) at Xn (the left endpoint of the interval of integration [xn, Xn+iD· And
S2 = f(Xn+i, Yn + f(xn, Yn)h) = Yn + f(xn, Yn)h + Xn+l is an approximation
to the slope of the exact solution at Xn+i (the right endpoint of the interval
of integration). All calculations were performed using six significant digits.
b. We shall assume, as we did in the Taylor series expansion example, that
lv(x)I < 7 on [O, l]. Since y<^3 l = y + x + 1 and since h = .1, we see from
equation (15) that the maximum loca l discretization error on [O, l] satisfies
IE,;I = l<f>(xn) -vnl::; ~h^3 max lv(^3 )1::; ~(.1)^3 (9) ~ .00075.
12 xE[O,l] 12