Re: Delay Differential Equations

• To: mathgroup at smc.vnet.net
• Subject: [mg8823] Re: Delay Differential Equations
• From: Paul Abbott <paul at physics.uwa.edu.au>
• Date: Mon, 29 Sep 1997 02:39:48 -0400
• Organization: University of Western Australia
• Sender: owner-wri-mathgroup at wolfram.com

```Matthias Weiss wrote:

> Can I solve DDE of the form
>
> x'(t) = F(t, x(t), x(t-a))
>
> with NDSolve? It appears it is not able to refer back to its own
> solution while it is still in progress.

See The Mathematica Journal 5(3): 25 and 6(1): 25-26.   I have appended
a Notebook below.

Cheers,
Paul

____________________________________________________________________
Paul Abbott                                   Phone: +61-8-9380-2734
Department of Physics                           Fax: +61-8-9380-1014
The University of Western Australia
Nedlands WA  6907                     mailto:paul at physics.uwa.edu.au
AUSTRALIA                             http://www.pd.uwa.edu.au/~paul

God IS a weakly left-handed dice player
____________________________________________________________________

Notebook[{

Cell[CellGroupData[{
Cell["Delay Differential Equation", "Section"],

Cell[TextData[{
"Differential equations involving delay such as ",
Cell[BoxData[
\`\(q\^\[Prime]\)[t] \[Equal] \(-q[t]\) + q[t - 2]\)]],
", with the initial conditions ",
Cell[BoxData[
" and ",
Cell[BoxData[
\(TraditionalForm\`q[t_\  /; \ t\  < \ 0] = 0\)]],
", can be solved iteratively in an elegant way using ",
Cell[BoxData[
FormBox[
StyleBox["FixedPoint",
". After entering"
}], "Text",
CellTags->{"FixedPoint", "delay differential equation"}],

Cell[BoxData[
\`Off(NDSolve::"\<ndnum\>", InterpolatingFunction::"\<dmval\>")\)],
"Input",
CellTags->"Off"],

Cell[TextData[{
"to suppress the warning messages that arising during intermediate \
computations prior to reaching the fixed point, we use ",
StyleBox["FixedPoint", "Input"],
" to solve the equation iteratively:"
}], "Text"],

Cell[CellGroupData[{

Cell[BoxData[
FormBox[
RowBox[{"\[ScriptQ]", "=",
RowBox[{"FixedPoint", "(",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{"NDSolve", "(",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{
RowBox[{
SuperscriptBox["q", "\[Prime]",
MultilineFunction->None], "(", "t",
")"}],
"==", \(If(t < 2, 0, #1 (\(t - 2\))) -
q(t)\)}],
",", \(q(0) == 1\)}], "}"}], ",", "q", ",",
\({t, 0, 7}\)}], ")"}], ")"}],
"\[LeftDoubleBracket]",
\(1, 1, 2\), "\[RightDoubleBracket]"}], "&"}], ",",
"0"}],

Cell[BoxData[
FormBox[
TagBox[
RowBox[{"InterpolatingFunction", "(",
RowBox[{
RowBox[{"(", GridBox[{
{"0.`", "7.`"}
},
ColumnAlignments->{Decimal}], ")"}], ",",
"\<\"<>\"\>"}],
")"}],
False,
}, Open  ]],

Cell[BoxData[
\`\(Plot(\[ScriptQ](t), {t, 0, 7}, PlotRange \[Rule] {All, {0, 1}});
\)\)], "Input"],

Cell[TextData[{
"Here we use ",
Cell[BoxData[
FormBox[
StyleBox[\(PlotRange \[Rule] {All, {0, 1}}\),
" to control the plot range in the ",
StyleBox["x",
FontSlant->"Italic"],
" and ",
StyleBox["y",
FontSlant->"Italic"],
" directions separately."
}], "Text",
CellTags->"PlotRange"],

Cell["It is easy to check how well the equation is satisfied:", "Text"],

Cell[BoxData[
FormBox[
RowBox[{
RowBox[{"Plot", "(",
RowBox[{
RowBox[{"Evaluate", "(",
RowBox[{
\(-\(If(t < 2, 0, \[ScriptQ](t - 2))\)\), "+",
\(\[ScriptQ](t)\), "+",
RowBox[{
SuperscriptBox["\[ScriptQ]", "\[Prime]",
MultilineFunction->None], "(", "t", ")"}]}], ")"}],
",",
\({t, 0, 7}\), ",", \(PlotRange \[Rule] {\(-0.001\),
0.001}\)}],

Cell[TextData[{
"We can use ",
Cell[BoxData[
FormBox[
StyleBox["Nest",
Cell[BoxData[
FormBox[
StyleBox["FixedPoint",