21.04.2015 Views

The Computable Differential Equation Lecture ... - Bruce E. Shapiro

The Computable Differential Equation Lecture ... - Bruce E. Shapiro

The Computable Differential Equation Lecture ... - Bruce E. Shapiro

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 3. APPROXIMATE SOLUTIONS 57<br />

For the first iteration,<br />

At the second iteration,<br />

After the third iteration,<br />

f(0, y(0)) = (0, −2) (3.123)<br />

y 1 = y 0 + hf(0, y(0)) (3.124)<br />

= (1, 0) T + π 4 (0, −2)T ≈ (1, −1.5708) T (3.125)<br />

t 1 = t 0 + h = π/4 (3.126)<br />

f(t 1 , y 1 ) ≈ f(π/4, (1, −1.5708) T ) (3.127)<br />

≈ (−1.5708, −2) T (3.128)<br />

y 2 = y 1 + hf(t 1 , y 1 ) (3.129)<br />

≈ (1, −1.5708) T + π (−1.5708, −2)<br />

4<br />

(3.130)<br />

≈ (−.2337, −3.1416) (3.131)<br />

t 2 = t 1 + π/4 = π/2 (3.132)<br />

f(t 2 , y 2 ) ≈ f(π/2, (−.2337, −3.1416) T ) (3.133)<br />

After the fourth and final iteration,<br />

≈ (−3.1416, .4674) T (3.134)<br />

y 3 = y 2 + hf(t 2 , y 2 ) (3.135)<br />

≈ (−.2337, −3.1416) T + π 4 (−3.1416, .4674)T (3.136)<br />

≈ (−2.7011, −2.7745) T (3.137)<br />

t 3 = t 2 + π/4 = 3π/4 (3.138)<br />

f(t 3 , y 3 ) ≈ f(3π/4, (−2.7011, −2.7745 T ) (3.139)<br />

≈ (−2.7745, 5.4022) T (3.140)<br />

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

≈ (−2.7011, −2.7745) T + π 4 (−2.7745, 5.4022)T (3.142)<br />

≈ (−4.8802, 1.4684) T (3.143)<br />

t 4 = t 3 + π/4 = π (3.144)<br />

<strong>The</strong> Mathematica implementation discussed in section 1.8 does not even need to<br />

be modified. For a scalar problem one would define a function f[t,y] that returns<br />

a scalar value, and then call ForwardEuler[f, {t 0 , y 0 }, h, t max ]. <strong>The</strong> return<br />

value is a list of the form<br />

{{t 0 ,y 0 }, {t 1 , y 1 }, . . . }<br />

c○2007, B.E.<strong>Shapiro</strong><br />

Last revised: May 23, 2007<br />

Math 582B, Spring 2007<br />

California State University Northridge

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

Saved successfully!

Ooh no, something went wrong!