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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

142 CHAPTER 7. DELAY DIFFERENTIAL EQUATIONS<br />

which prints the following output:<br />

To automatically plot the results instead of printing them out, we modify our code<br />

block as follows.<br />

methodOfSteps2p[g , t , tau , n ] :=<br />

Module[{y0, y, s, i, p = {}},<br />

y0 = g[0];<br />

y = y0 - Integrate[g[s - tau], {s, 0, t} ];<br />

AppendTo[p, Plot[y, t, 0, tau, DisplayFunction -> Identity]];<br />

For[i = 1, i n - 1, i++,<br />

a = i*tau;<br />

b = a + tau;<br />

y0 = y /. {t -> a};<br />

y = y0 - Integrate[y /. {t -> s - 1}, {s, a, t} ];<br />

y = Expand[y];<br />

AppendTo[p, Plot[y, {t, a, b}, DisplayFunction -> Identity]];<br />

];<br />

Return[Show[p, DisplayFunction -> $DisplayFunction]];<br />

]<br />

Math 582B, Spring 2007<br />

California State University Northridge<br />

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

Last revised: May 23, 2007

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

Saved successfully!

Ooh no, something went wrong!