Download (direct link):
What conclusions can we draw from the data in Table 2.7.2? In the first place, for a fixed value of t the computed approximate values become more accurate as the step size h decreases. This is what we would expect, of course, but it is encouraging that the data confirm our expectations. For example, for t = 1 the approximate value with h = 0.1 is too large by about 2%, while the value with h = 0.01 is too large by only 0.2%. In this case, reducing the step size by a factor of 10 (and performing 10 times as many computations) also reduces the error by a factor of about 10. A second observation from Table 2.7.2 is that, for a fixed step size h, the approximations become more accurate as t increases. For instance, for h = 0.1 the error for t = 5 is only about 0.5% compared with 2% for t = 1. An examination of data at intermediate points not recorded in Table 2.7.2 would reveal where the maximum error occurs for a given step size and how large it is.
All in all, Eulerís method seems to work rather well for this problem. Reasonably good results are obtained even for a moderately large step size h = 0.1 and the approximation can be improved by decreasing h.
Let us now look at another example.
2.7 Numerical Approximations: Eulerís Method
Consider the initial value problem
= 4 - t + 2y, y(0) = 1.
The general solution of this differential equation was found in Example 3 of Section
2.1, and the solution of the initial value problem (12) is
y = ó + 11 + x e2t.
Use Eulerís method with several step sizes to find approximate values of the solution on the interval 0 < t < 5. Compare the results with the corresponding values of the solution (13).
Using the same range of step sizes as in Example 2, we obtain the results presented in Table 2.7.3.
TABLE 2.7.3 A Comparison of Exact Solution with Euler Method for Several Step Sizes h for
y = 4 - t + 2y, y(0) = 1
t Exact O ii h = 0.05 h = 0.025 h = 0.01
0.0 1.000000 1.000000 1.000000 1.000000 1.000000
1.0 19.06990 15.77728 17.25062 18.10997 18.67278
2.0 149.3949 104.6784 123.7130 135.5440 143.5835
3.0 1109.179 652.5349 837.0745 959.2580 1045.395
4.0 8197.884 4042.122 5633.351 6755.175 7575.577
5.0 60573.53 25026.95 37897.43 47555.35 54881.32
The data in Table 2.7.3 again confirm our expectation that for a given value of t, accuracy improves as the step size h is reduced. For example, for t = 1 the percentage error diminishes from 17.3% when h = 0.1 to 2.1% when h = 0.01. However, the error increases fairly rapidly as t increases for a fixed h. Even for h = 0.01, the error at t = 5 is 9.4%, and it is much greater for larger step sizes. Of course, the accuracy that is needed depends on the purpose for which the results are intended, but the errors in Table 2.7.3 are too large for most scientific or engineering applications. To improve the situation, one might either try even smaller step sizes or else restrict the computations to a rather short interval away from the initial point. Nevertheless, it is clear that Eulerís method is much less effective in this example than in Example 2.
To understand better what is happening in these examples, let us look again at Eulerís method for the general initial value problem (1)
= f (t, y), y(to) =
whose solution we denote by $(t). Recall that a first order differential equation has an infinite family of solutions, indexed by an arbitrary constant c, and that the initial condition picks out one member of this infinite family by determining the value of c. Thus $( t) is the member of the infinite family of solutions that satisfies the initial condition $(t0) = y0.
Chapter 2. First Order Differential Equations
At the first step Eulerís method uses the tangent line approximation to the graph of y = $(t) passing through the initial point (t0, y0) and this produces the approximate value y1 at t1. Usually y1 = ^(t1), so at the second step Eulerís method uses the tangent line approximation not to y = $(t), but to a nearby solution y = ^i(t) that passes through the point (t1, y1). So it is at each following step. Eulerís method uses a succession of tangent line approximations to a sequence of different solutions fi(t), fi1(t), 02(t),... of the differential equation. At each step the tangent line is constructed to the solution passing through the point determined by the result of the preceding step, as shown in Figure 2.7.2. The quality of the approximation after many steps depends strongly on the behavior of the set of solutions that pass through the points (tn, yn) for n = 1, 2, 3,-----
In Example 2 the general solution of the differential equation is
y = 6 - 2e-t + ce~t/2 (14)
and the solution of the initial value problem (10) corresponds to c =ó 3. This family of solutions is a converging family since the term involving the arbitrary constant c approaches zero as t ^?. It does not matter very much which solutions we are approximating by tangent lines in the implementation of Eulerís method, since all the solutions are getting closer and closer to each other as t increases.