Download (direct link):
Then we approximate the derivative in Eq. (8) by the corresponding (forward) difference quotient, obtaining
tn+1 - tn
= f [n ,0(tn )] (9)
Finally, if we replace 0(tn+j) and 0(tn) by their approximate values yn+1 and yn, respectively, and solve for yn+ p we obtain the Euler formula (3).
Another point of view is to write the problem as an integral equation, as follows. Since y = 0(t) is a solution of the initial value problem (1), (2), by integrating from t
to tn+j we obtain
I 0'(t) dt =1 f[t,¹] dt
0(tn+j) = 0(tn) + j f[t,0(t)] dt (10)
Chapter 8. Numerical Methods
The integral in Eq. (10) is represented geometrically as the area under the curve in Figure 8.1.1 between t = tn and t = t 1. If we approximate the integral by replacing f [t, 0(t)] by its value f [tn, 0 (tn)] at t = tn, then we are approximating the actual area by the area of the shaded rectangle. In this way we obtain
0(tn+1) = 0(tn) + f [tn, 0(tn)](tn+1 - tn)
= 0(tn) + hf[tn ,0(tn)]. (11)
Finally, to obtain an approximation yn+1 for 0(tn+1) we make a second approximation by replacing 0(tn) by its approximate value yn in Eq. (11). This gives the Euler formula yn+1 = yn + hf (tn, yn). A more accurate algorithm can be obtained by approximating the integral more accurately. This is discussed in Section 8.2.
A third approach is to assume that the solution y = 0(t) has a Taylor series about the point tn. Then
0(tn + h) = 0(tn) + 0\tn )h + 0"(tn) 2! +
0(tn+1) = 0(tn) + f [tn,0( tn)]h + 0"(tn) 2! + . (12)
If the series is terminated after the first two terms, and 0(tn+1) and 0(tn) are replaced by their approximate values yn+1 and yn, we again obtain the Euler formula (4). If more terms in the series are retained, a more accurate formula is obtained. Further, by using a Taylor series with a remainder it is possible to estimate the magnitude of the error in the formula. This is discussed later in this section.
The Backward Euler Formula. A variation on the Euler formula can be obtained by approximating the derivative in Eq. (8) by the backward difference quotient [0(tn) 0(tn_ 1)]/h instead of the forward difference quotient used in Eq. (9). In this way we obtain
0(tn) 0(tn1) = hf(tn, yn)
yn = yn1 + hf(tn, yn).
8.1 The Euler or Tangent Line Method
Stepping the index up from n to n + 1, we obtain the backward Euler formula
yn+1 = yn + hf(tn+v yn+1). (13)
Assuming that yn is known and yn+1 is to be calculated, observe that Eq. (13) does not provide an explicit formula for yn+1. Rather, it is an equation that implicitly defines yn+1 and must be solved to determine the value of yn+1. How difficult this is depends entirely on the nature of the function f.
Use the backward Euler formula (13) and step sizes h = 0.05, 0.025, 0.01, and 0.001 to find approximate values of the solution of the initial value problem (5), (6) on the interval 0 < t < 2.
For this problem the backward Euler formula (13) becomes
yn+l = yn + h(1 - tn+1 + 4yn+J-
We will show the first two steps in detail so that it will be clear how the method works. At the first step we have
y = y + h(1 - tx + 4*) = 1 + (0.05)(1 - 0.05 + 4y)
Solving this equation for y1, we obtain
y1 = 1.0475/0.8 = 1.309375.
Observe that because the differential equation is linear, the implicit equation for y1 is also linear and therefore easy to solve. Next,
y2 = yl + h(1 - t2 + 4y2) = 1.309375 + (0.05)(1 - 0.1 + 4y2), which leads to
y2 = 1.354375/0.8 = 1.69296875.
Continuing the computations on a computer, we obtain the results shown in Table 8.1.2. The values given by the backward Euler method are uniformly too large for this problem, whereas the values obtained from the Euler method were too small. In this problem the errors are somewhat larger for the backward Euler method than for the Euler method, although for small values of h the differences are insignificant. Since the backward Euler method appears to be no more accurate than the Euler method, and is somewhat more complicated, a natural question is why it should even be mentioned. The answer is that it is the simplest example of a class of methods known as backward differentiation formulas that are very useful for certain types of differential equations. We will return to this issue later in this chapter.
Chapter 8. Numerical Methods
TABLE 8.1.2 Results for the Numerical Solution of / = 1 t + 4y, y(0) = 1 Using the Backward Euler Method for Different Step Sizes h
t h = 0.05 h = 0.025 h = 0.01 h = 0.001 Exact
0 1.0000000 1 . 0000000 1.0000000 1 . 0000000 1 . 0000000
0.1 1.6929688 1.6474374 1.6236638 1.6104634 1.6090418
0.2 2.7616699 2.6211306 2.5491368 2.5095731 2.5053299
0.3 4.4174530 4.0920886 3.9285724 3.8396379 3.8301388
0.4 6.9905516 6.3209569 5.9908303 5.8131282 5.7942260
0.5 10.996956 9.7050002 9.0801473 8.7472667 8.7120041
1.0 103.06171 80.402761 70.452395 65.419964 64.897803
1.5 959.44236 661.00731 542.12432 485.05825 479.25919