Books
in black and white
Main menu
Share a book About us Home
Books
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics
Ads

Elementary Differential Equations and Boundary Value Problems - Boyce W.E.

Boyce W.E. Elementary Differential Equations and Boundary Value Problems - John Wiley & Sons, 2001. - 1310 p.
Download (direct link): elementarydifferentialequations2001.pdf
Previous << 1 .. 54 55 56 57 58 59 < 60 > 61 62 63 64 65 66 .. 609 >> Next

Finally, if we assume that there is a uniform step size h between the points t0, tv t2,,
then tn+1 = tn + h for each n and we obtain Eulerís formula in the form
”Ô+1 = ”Ô + fnh> Ō = 1 2, . . . . (8)
To use Eulerís method you simply evaluate Eq. (7) or Eq. (8) repeatedly, depending
on whether or not the step size is constant, using the result of each step to execute the next step. In this way you generate a sequence of values y1, y2, y3,... that approximate the values of the solution Ű(t) at the points tv t2, t3,.... If, instead of a sequence of points, you need an actual function to approximate the solution Ű(t), then you can use the piecewise linear function constructed from the collection of tangent line segments. That is, let y be given by Eq. (2) in [t0, t1], by Eq. (4) in [tp t2], and, in general, by
” = ”Ô + f (tn> ”Ô)(t - tn) (9)
in [tn, tn+1].
Consider the initial value problem
dy = 3 + e-t - 1 y, y(0) = 1. (10)
Use Eulerís method with step size h = 0.1 to find approximate values of the solution of Eqs. (10) at t = 0.1, 0.2, 0.3, and 0.4. Compare them with the corresponding values of the actual solution of the initial value problem.
Proceeding as in Section 2.1, we find the solution of Eqs. (10) to be
” = Ű(1) = 6 - 2e- - 3e-t/2. (11)
To use Eulerís method we note that in this case f (t, y) = 3 + e~l - y/2. Using the initial values t0 = 0 and y0 = 1, we find that
f0 = f(t0, y0) = f(0, 1) = 3 + e0 - 0.5 = 3 + 1 - 0.5 = 3.5
and then, from Eq. (8) with n = 0,
”1 = ”Ó + foh = 1 + (3.5)(0.1) = 1.35.
At the next step we have
f1 = f(0.1, 1.35) = 3 + e-01 - (0.5)(1.35) = 3 + 0.904837 - 0.675 = 3.229837
and then
y2 = y1 + f1h = 1.35 + (3.229837)(0.1) = 1.672984.
2.7 Numerical Approximations: Eulerís Method
99
Repeating the computation two more times, we obtain
f2 = 2.982239, y3 = 1.971208
and
f3 = 2.755214, y4 = 2.246729.
Table 2.7.1 shows these computed values, the corresponding values of the solution (11), and the differences between the two, which is the error in the numerical approximation.
TABLE 2.7.1 A Comparison of Exact Solution with Euler Method for h = 0.1 for
/ = 3 + e-t - Iy, y(0) = 1
t Exact Euler Error
with h = 0.1
0.0 1.0000 1.0000 0.0000
0.1 1.3366 1 . 3500 0.0134
0.2 1.6480 1.6730 0.0250
0.3 1.9362 1 . 9712 0.0350
0.4 2.2032 2.2467 0.0435
The purpose of Example 1 is to show you the details of implementing a few steps of Eulerís method so that it will be clear exactly what computations are being executed. Of course, computations such as those in Example 1 are usually done on a computer. Some software packages include code for the Euler method, while others do not. In any case, it is easy to write a computer program to carry out the calculations required to produce results such as those in Table 2.7.1. The outline of such a program is given below; the specific instructions can be written in any high-level programming language.
The Euler Method
Step 1. define f (t, y)
Step 2. input initial values tO and yO
Step 3. input step size h and number of steps n
Step 4. output 10 and yO
Step 5. for j from 1 to n do
Step 6. k 1 = f ( t, y)
y = y + h * k1 t = t + h Step 7. output t and y
Step 8. end
The output of this algorithm can be numbers listed on the screen or printed on a printer, as in the third column of Table 2.7.1. Alternatively, the calculated results can be displayed in graphical form.
100
Chapter 2. First Order Differential Equations
EXAMPLE
2
Consider again the initial value problem (10),
ddy = 3 + e~< - 1 y, y(0) = 1.
Use Eulerís method with various step sizes to calculate approximate values of the solution for 0 < t < 5. Compare the calculated results with the corresponding values of the exact solution (11),
y = Ű(≥) = 6 - 2e-t - 3e-t/2.
We used step sizes h = 0.1, 0.05, 0.025, and 0.01, corresponding respectively to 50, 100, 200, and 500 steps to go from t = 0 to t = 5. The results of these calculations, along with the values of the exact solution, are presented in Table 2.7.2. All computed entries are rounded to four decimal places, although more digits were retained in the intermediate calculations.
TABLE 2.7.2 A Comparison of Exact Solution with Euler Method for Several Step Sizes h for y1 = 3 + - 2y, y(0) = 1
t Exact h = 0.1 h = 0.05 h = 0.025 h = 0.01
0.0 1.0000 1 . 0000 1.0000 1 .0000 1 . 0000
Previous << 1 .. 54 55 56 57 58 59 < 60 > 61 62 63 64 65 66 .. 609 >> Next