Download (direct link):
Chapter 8. Numerical Methods
FIGURE 8.5.1 The dependence of truncation and round-off errors on the step size h.
Consider the example problem
Ó = 1 - t + 4 j,
7(0) = 1.
Using the Euler method with various step sizes, calculate approximate values for the solution ô(t) at t = 0.5 and t = 1. Try to determine the optimum step size.
Keeping only four digits in order to shorten the calculations, we obtain the data shown in Table 8.5.1. The first two columns are the step size h and the number of steps N required to traverse the interval 0 < t < 1. Then yN/2 and yN are approximations to ô(0.5) = 8.712 and ô(1) = 64.90, respectively. These quantities appear in the third and fifth columns. The fourth and sixth columns display the differences between the calculated values and the actual value of the solution.
TABLE 8.5.1 Approximations to the Solution of the Initial Value Problem j = 1 — t + 4y, y(0) = 1 Using the Euler Method with Different Step Sizes
h N yN/2 Error yN Error
0.01 100 8.390 0.322 60.12 4.78
0.005 200 8.551 0.161 62.51 2.39
0.002 500 8.633 0.079 63.75 1.15
0.001 1000 8.656 0.056 63.94 0.96
0.0008 1250 8.636 0.076 63.78 1.12
0.000625 1600 8.616 0.096 64.35 0.55
0.0005 2000 8.772 0.060 64.00 0.90
0.0004 2500 8.507 0.205 63.40 1.50
0.00025 4000 8.231 0.481 56.77 8.13
For relatively large step sizes the round-off error is much less than the global truncation error. Consequently, the total error is approximately the same as the global truncation error, which for the Euler method is bounded by a constant times h. Thus, as the step size is reduced, the error is reduced proportionally. The first three lines in Table
8.5.1 show this type of behavior. For h = 0.001 the error has been further reduced, but much less than proportionally; this indicates that round-off error is becoming important. As h is reduced still more, the error begins to fluctuate and further improvements in
8.5 More on Errors; Stability
accuracy become problematical. For values of h less than 0.0005 the error is clearly increasing, which indicates that round-off error is now the dominant part of the total error.
These results can also be expressed in terms of the number of steps N. For N less than about 1000 accuracy is improved by taking more steps, while for N greater than about 2000 using more steps has an adverse effect. Thus for this problem it is best to use an N somewhere between 1000 and 2000. For the calculations shown in Table
8.5.1 the best result at t = 0.5 occurs for N = 1000 while at t = 1.0 the best result is for N = 1600.
One should be careful not to read too much into the results shown in Example 1. The optimum ranges for h and N depend on the differential equation, the numerical method that is used, and the number of digits that are retained in the calculation. Nevertheless, it is generally true that if too many steps are required in a calculation, then eventually round-off error is likely to accumulate to the point that it seriously degrades the accuracy of the procedure. For many problems this is not a concern: For them any of the fourth order methods we have discussed in Sections 8.3 and 8.4 will produce good results with a number of steps far less than the level at which round-off error becomes important. For some problems, however, round-off error does become vitally important. For such problems the choice of method may be crucial. This is also one reason why modern codes provide a means of adjusting the step size as they go along, using a larger step size wherever possible, and a very small step size only where necessary.
Vertical Asymptotes. As a second example, consider the problem of determining the solution y = ô(‘) of
Since the differential equation is nonlinear, the existence and uniqueness theorem (Theorem 2.4.2) guarantees only that there is a solution in some interval about t = 0. Suppose that we try to compute a solution of the initial value problem on the interval
0 < t < 1 using different numerical procedures.
If we use the Euler method with h = 0.1, 0.05, and 0.01, we find the following approximate values at t = 1: 7.189548, 12.32093, and 90.75551, respectively. The large differences among the computed values are convincing evidence that we should use a more accurate numerical procedure—the Runge-Kutta method, for example. Using the Runge-Kutta method with h = 0.1 we find the approximate value 735.0991 at t = 1, which is quite different from those obtained using the Euler method. Repeating the calculations using step sizes of h = 0.05 and h = 0.01, we obtain the interesting information listed in Table 8.5.2.
Ó = t2 + y2, y(0) = 1.
TABLE 8.5.2 Calculation of the Solution of the Initial Value Problem Ó = t2 + y2, y(0) = 1 Using the Runge-Kutta Method