The numerical results of the previous section indicate that the fourth order Runge-Kutta method leads to more reliable results than Euler’s method in the sense that the solution of the initial value problem (??) is much better approximated (see Figures ?? and ??). The purpose of the following sections is to derive error bounds for some numerical methods. These error bounds allow us to compare the accuracy of different methods when solving initial value problems.

To motivate the general treatment, let us explicitly compute the error of a specific numerical method. We apply the “simplest” method, Euler’s method, to the “simplest” initial value problem that is not solved exactly by Euler’s method,

More precisely, we approximate the solution on the interval with step size , so that the numerical approximation consists of points. With and , Euler’s method (??) takes the form where .

There are two essentially different types of error that are both relevant: the local and the global discretization error. Roughly speaking, the local discretization error is the error that is made by one single step in the numerical integration whereas the global error is the error that is made on the whole time interval in the course of the approximation.

Local Error for Euler’s Method

First we discuss the local error for Euler’s method. We assume that the numerical solution is exact up to step , that is, in our case we start in . Then the local discretization error is given by the error made in the following step:

For instance, since and , In general and we obtain from (??) The exponential function has the expansion and therefore it follows that Since for we finally have the desired bound Observe that we have obtained a bound for the local discretization error that just depends on the step size and not on the actual step .
Global Error for Euler’s Method

We now consider the global discretization error after steps. It is defined by The basic trick in the computation of a bound for is to derive an equation for the evolution of this error while is varied. We do this as follows. By (??) we have for and, on the other hand, Euler’s method applied to (??) is given by Subtracting these two equations from each other we obtain and therefore with the bound (??) for the local error

with We have accomplished our first goal: the global discretization error at step is expressed in terms of the global discretization error at step in combination with a bound for the local discretization error. This allows us to apply this formula repeatedly until is zero, But and using the formula with we obtain By (??) and we finally obtain the desired bound on the global discretization error for Euler’s method applied to (??):

We summarize our computations in the following proposition.

Proof
The statements (a) and (b) are precisely (??) and (??). Moreover, (c) follows from (??) since the right hand side in becomes arbitrarily small for and uniformly in .
Verification of Error Analysis using MATLAB

Let us verify the estimate in (??) using MATLAB. For a numerical approximation of the solution of the initial value problem (??) with step size on the interval we type

                                                                  

                                                                  
h      = 0.1;
 
t(1)   = 0;  
x(1)   = 1;  
err(1) = 0;  
est(1) = 0;  
K      = 1/h;  
for k = 1:K  
    t(k+1) = t(k)+h;  
    x(k+1) = (1+h)*x(k);  
  err(k+1) = exp(t(k+1))-x(k+1);  
  est(k+1) = exp(1)*(exp(k*h)-1)*h/2;  
end  
plot(t,err,’+’)  
hold on  
plot(t,est,’x’)  
xlabel(’(a)’)

The result is shown in Figure ??(a). It can be seen that, indeed, we have obtained an upper bound for the global discretization error in (??). In the proof of part (c) of Proposition ?? we have used the fact that this upper bound tends to zero with decreasing step size . This fact is illustrated in Figure ??(b), where we have changed the step size to .


PIC PIC

Figure 1: Comparison of the global discretization error (marked by ) with its estimate given in (??) (marked by ) for the step sizes (a) and (b) .

Explicit Computation of Error Bounds

Another important consequence of Proposition ?? is that it allows us to compute the solution of the initial value problem (??) on a given interval up to a prescribed accuracy. Indeed, we just have to use the estimate (??) on the global discretization error.

For an illustration of this fact suppose that we want to approximate a solution of (??) on the interval where the maximal global discretization error is less than . It follows from (??) that this is certainly the case if the step size is chosen such that or, equivalently, Indeed, if this is the case then we find with (??) The result of the corresponding MATLAB computation of the global discretization error is shown in Figure ??.


PIC

Figure 2: The global discretization error for the solution of (??) on the interval with step size .

Exercises

In Exercises ?? – ?? compute bounds on the local and global error for Euler’s method applied to the given initial value problem. Perform the same steps as in the treatment of the initial value problem (??) in the text.

.
.
.
Apply the implicit Euler method to the initial value problem (??). Then determine a formula for the local discretization error that is analogous to (??). Hint: Before proceeding as for Euler’s method solve for in (??) in this specific case.

In Exercises ?? – ?? determine a step size such that the global discretization error for the solution of (??) on the given interval using Euler’s method is less than the given absolute tolerance. Verify your results by a computation of the global discretization error using MATLAB.

Interval and absolute tolerance .
Interval and absolute tolerance .
Suppose that you want to solve (??) by Euler’s method with a fixed step size on the interval . How large can you choose so that the global discretization error does not exceed ? Confirm your result using MATLAB.