Numeric Delay Differential Equations - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Differential Equations : Example Worksheets : Numeric Delay Differential Equations

Numeric Delay Differential Equation Examples

Numeric solutions for initial value problems with ODE/DAE using dsolve[numeric] can accommodate delay terms for the three main variable step integrators: rkf45, ck45, and rosenbrock. Detailed information on delay differential equations, such as setting of initial values, controlling the storage used to retain the delay data, and use with events can be found on the dsolve[numeric][delay] help page.

Index of Examples

Harmonic Oscillator

Variable Delay

Predator-Prey Model

Wille and Baker Example

Multiple Delays and History

 

Harmonic Oscillator

restart;

ddesys := {diff(x__1(t), t, t)+x__1(t-tau__1) = 0, diff(x__2(t), t, t)+x__2(t-tau__2) = 0, x__1(0) = 0, x__2(0) = 0, (D(x__1))(0) = 1, (D(x__2))(0) = 1};

(1)

dsn := dsolve(eval(ddesys, {tau__1 = 0., tau__2 = .1}), numeric):

plots[odeplot](dsn, [[t, x__1(t), color = blue], [t, x__2(t), color = red]], 0 .. 20, labels = [t, ""]);

Compare to growth:

ddesys := {diff(x__2(t), t, t)+x__2(t-tau__2) = 0, diff(x__1(t), t, t)-tau__1*(diff(x__1(t), t))+x__1(t) = 0, x__1(0) = 0, x__2(0) = 0, (D(x__1))(0) = 1, (D(x__2))(0) = 1};

(2)

dsn := dsolve(eval(ddesys, {tau__1 = .1, tau__2 = .1}), numeric):

plots[odeplot](dsn, [[t, x__1(t), color = blue], [t, x__2(t), color = red]], 0 .. 20, labels = [t, ""]);

Variable Delay

For variable delay, the maximum delay time, which is not always trivial to compute, needs to be provided in the call to dsolve:

restart;

dsys_var := {diff(x(t), t) = -x(t-1/2-(1/2)*exp(-t)), x(0) = 1};

(3)

max_delay := fsolve(t = 1/2+(1/2)*exp(-t), t);

(4)

dsn_var := dsolve(dsys_var, numeric, delaymax = .74):

plots:-odeplot(dsn_var, 0 .. 5, size = [600, "golden"]);

Predator-Prey Model

The following example is adapted from the Hutchinson model, where the delay accommodates differences in resource consumption between young and adult members of a population. The delay parameter tau represents the delay from birth to adulthood of a member of the population.

restart;

ddesys := {diff(pred(t), t) = 10*pred(t-tau)*prey(t-tau)-(1/2)*pred(t)-(1/10)*pred(t)^2,
          diff(prey(t), t) = prey(t)*(1-prey(t))-pred(t)*prey(t), pred(0) = 1,
          prey(0) = 1};

(5)

dsn := dsolve(eval(ddesys, tau = 0), numeric):

plots[odeplot](dsn, [[t, prey(t), color = green], [t, pred(t), color = red]], 0 .. 300, legend = [ prey, pred ], labels = [t,""] );

dsn := dsolve(eval(ddesys, tau = .25), numeric):

plots[odeplot](dsn, [[t, prey(t), color = green], [t, pred(t), color = red]], 0 .. 300, legend = [ prey, pred ], labels = [t,""] );

dsn := dsolve(eval(ddesys, tau = 5), numeric, maxfun = 0):

plots[odeplot](dsn, [[t, prey(t), color = green], [t, pred(t), color = red]], 0 .. 300, legend = [ prey, pred ], labels = [t,""] );

dsn := dsolve(eval(ddesys, tau = 25), numeric):

plots[odeplot](dsn, [[t, prey(t), color = green], [t, pred(t), color = red]], 0 .. 300, legend = [ prey, pred ], labels = [t,""] );

Wille and Baker Example

The following example demonstrates chaotic behavior for a simple first order ODE with delay.

restart;

dsn := dsolve({diff(y(t), t) = 2*y(t-2)/(1+y(t-2)^9.65)-y(t), y(0) = .5, z(t) = y(t-2)}, numeric):

plots[odeplot](dsn, [y(t), z(t)], 2 .. 100, numpoints = 15000);

Multiple Delays and History

The following example solves  =  with initial condition  =  for .

For delays in Maple, the initial conditions are assumed to be held constant for any times prior to the initial time t0. To handle problems where the history prior to t0 is known, piecewise can be used as follows:

restart;

ddesys := {diff(y(t), t) = -y(t)-5*piecewise(t-1 < 0, sin(t-1), y(t-1))-2*piecewise(t-2 < 0, sin(t-2), y(t-2)), y(0) = sin(0), z(t) = diff(y(t), t)};

(6)

dsn := dsolve(ddesys, numeric):

plots[odeplot](dsn, [[t, y(t), color = red], [t, z(t), color = blue]], 0 .. 5, legend = [y, z], labels = [t,""] );

See Also

dsolve,numeric, dsolve,numeric,delay


Download Help Document