Lecture Notes in Differential Equations - Bruce E. Shapiro

Lecture Notes in Differential Equations - Bruce E. Shapiro Lecture Notes in Differential Equations - Bruce E. Shapiro

bruce.shapiro.com
from bruce.shapiro.com More from this publisher
21.04.2015 Views

362 LESSON 33. NUMERICAL METHODS We then observe that since y n ≈ y(t n ) and y n+1 ≈ y(t n+1 ), then (33.12) follows immediately from (33.16). If the scalar initial value problem of equation (33.4) is replaced by a systems of equations y ′ = f(t, y), y(t 0 ) = y 0 (33.17) then the Forward Euler’s Method has the obvious generalization y n+1 = yn + hf(t n , y n ) (33.18) Example 33.1. Solve y ′ = y, y(0) = 1 on the interval [0, 1] using h = 0.25. The exact solution is y = e x . We compute the values using Euler’s method. For any given time point t k , the value y k depends purely on the values of t k1 and y k1 . This is often a source of confusion for students: although the formula y k+1 = y k + hf(t k , y k ) only depends on t k and not on t k+1 it gives the value of y k+1 . We are given the following information: ⎫ (t 0 , y 0 ) = (0, 1) ⎪⎬ f(t, y) = y ⎪⎭ h = 0.25 We first compute the solution at t = t 1 . (33.19) y 1 = y 0 + hf(t 0 , y 0 ) = 1 + (0.25)(1) = 1.25 (33.20) t 1 = t 0 + h = 0 + 0.25 = 0.25 (33.21) (t 1 , y 1 ) = (0.25, 1.25) (33.22) Then we compute the solutions at t = t 1 , t 2 , . . . until t k+1 = 1. y 2 = y 1 + hf(t 1 , y 1 ) (33.23) = 1.25 + (0.25)(1.25) = 1.5625 (33.24) t 2 = t 1 + h = 0.25 + 0.25 = 0.5 (33.25) (t 2 , y 2 ) = (0.5, 1.5625) (33.26) y 3 = y 2 + hf(t 2 , y 2 ) (33.27) = 1.5625 + (0.25)(1.5625) = 1.953125 (33.28) t 3 = t 2 + h = 0.5 + 0.25 = 0.75 (33.29) (t 3 , y 3 ) = (0.75, 1.953125) (33.30)

363 y 4 = y 3 + hf(t 3 , y 3 ) (33.31) = 1.953125 + (0.25)(1.953125) = 2.44140625 (33.32) t 4 = t 3 + 0.25 = 1.0 (33.33) (t 4 , y 4 ) = (1.0, 2.44140625) (33.34) Since t 4 = 1 we are done. The solutions are tabulated in table ?? for this and other step sizes. t h = 1/2 h = 1/4 h = 1/8 h = 1/16 exact solution 0.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.0625 1.0625 1.0645 0.1250 1.1250 1.1289 1.1331 0.1875 1.1995 1.2062 0.2500 1.2500 1.2656 1.2744 1.2840 0.3125 1.3541 1.3668 0.3750 1.4238 1.4387 1.4550 0.4375 1.5286 1.5488 0.5000 1.5000 1.5625 1.6018 1.6242 1.6487 0.5625 1.7257 1.7551 0.6250 1.8020 1.8335 1.8682 0.6875 1.9481 1.9887 0.7500 1.9531 2.0273 2.0699 2.1170 0.8125 2.1993 2.2535 0.8750 2.2807 2.3367 2.3989 0.9375 2.4828 2.5536 1.0000 2.2500 2.4414 2.5658 2.6379 2.7183

363<br />

y 4 = y 3 + hf(t 3 , y 3 ) (33.31)<br />

= 1.953125 + (0.25)(1.953125) = 2.44140625 (33.32)<br />

t 4 = t 3 + 0.25 = 1.0 (33.33)<br />

(t 4 , y 4 ) = (1.0, 2.44140625) (33.34)<br />

S<strong>in</strong>ce t 4 = 1 we are done. The solutions are tabulated <strong>in</strong> table ?? for this<br />

and other step sizes.<br />

t h = 1/2 h = 1/4 h = 1/8 h = 1/16 exact solution<br />

0.0000 1.0000 1.0000 1.0000 1.0000 1.0000<br />

0.0625 1.0625 1.0645<br />

0.1250 1.1250 1.1289 1.1331<br />

0.1875 1.1995 1.2062<br />

0.2500 1.2500 1.2656 1.2744 1.2840<br />

0.3125 1.3541 1.3668<br />

0.3750 1.4238 1.4387 1.4550<br />

0.4375 1.5286 1.5488<br />

0.5000 1.5000 1.5625 1.6018 1.6242 1.6487<br />

0.5625 1.7257 1.7551<br />

0.6250 1.8020 1.8335 1.8682<br />

0.6875 1.9481 1.9887<br />

0.7500 1.9531 2.0273 2.0699 2.1170<br />

0.8125 2.1993 2.2535<br />

0.8750 2.2807 2.3367 2.3989<br />

0.9375 2.4828 2.5536<br />

1.0000 2.2500 2.4414 2.5658 2.6379 2.7183

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!