Download (direct link):
TABLE 8.5.1 Approximations to the Solution of the Initial Value Problem y = 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 = $( t) 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.
y = t2 + y2, y(0) = 1.
TABLE 8.5.2 Calculation of the Solution of the Initial Value Problem y = t2 + y2, y(0) = 1 Using the Runge-Kutta Method
h t = 0.90 t= 1.0
0.1 14.02182 735.0991
0.05 14.27117 1.75863 x 105
0.01 14.30478 2.0913 x 102893
Chapter 8. Numerical Methods
While the values at t = 0.90 are reasonable and we might well believe that the solution has a value of about 14.305 at t = 0.90, it is clear that something strange is happening between t = 0.9 and t = 1.0. To help determine what is happening let us turn to some analytical approximations to the solution of the initial value problem (3). Note that on 0 < t < 1
y2 < t2 + y2 < 1 + y2. (4)
This suggests that the solution y = 01(t) of
/= 1 + y2, y(0) = 1 (5)
and the solution y = 02(t) of
/ = y2, y(0) = 1 (6)
are upper and lower bounds, respectively, for the solution y = fi(t) of the original problem, since all these solutions pass through the same initial point. Indeed, it can be shown (for example, by the iteration method of Section 2.8) that &2(t) < $(t) < $() as long as these functions exist. The important thing to note is that we can solve Eqs. (5) and (6) for 01 and 02 by separation of variables. We find that