The Computable Differential Equation Lecture ... - Bruce E. Shapiro
The Computable Differential Equation Lecture ... - Bruce E. Shapiro
The Computable Differential Equation Lecture ... - Bruce E. Shapiro
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
CHAPTER 7. DELAY DIFFERENTIAL EQUATIONS 141<br />
While the solution in the first example behaves in a manner that is similar (albeit<br />
numerically different) from the IVP with y(0) = g(0) the following slightly different<br />
example behaves quite differently.<br />
Example 7.2. Use Mathematica to solve the DDE<br />
on the interval [0, 10] and plot the results.<br />
y ′ (t) = −y(1 − t) (7.62)<br />
y(t) = 1, −τ < t < 0 (7.63)<br />
Solution. We can (almost) trivially modify our previous code to solve the new differential<br />
equation, which has a minus sign on the right hand side.<br />
methodOfSteps2[g , t , tau , n ] :=<br />
Module[{y0, y, s, i},<br />
y0 = g[0];<br />
y = y0 - Integrate[g[s - tau], {s, 0, t} ];<br />
Print["y(t)=", y, " on [0, ", tau, "]"];<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 />
Print["y(t)=", y, " on [", a, ", ", b, "]"];<br />
]<br />
]<br />
<strong>The</strong> calling sequence is<br />
g[t ]:= 1; methodOfSteps2[g, t, 1, 10];<br />
c○2007, B.E.<strong>Shapiro</strong><br />
Last revised: May 23, 2007<br />
Math 582B, Spring 2007<br />
California State University Northridge