New in Wolfram Mathematica 7: Delay Differential Equations  previous | next 
Solve a traffic flow model
This solves a system of delay differential equations for the GHR traffic flow model and shows a plot of the velocity.
In[1]:=

Click for copyable input
Subscript[\[CapitalDelta]x, k_][t_] := 

  Subscript[x, k + 1][t] - Subscript[x, k][t];

Subscript[x, 4][t_] = 29 t ;
In[2]:=

Click for copyable input
sol = First[

   NDSolve[Table[{Subscript[x, k]''[

        t] == .1 (Subscript[x, k]'[t]) Subscript[\[CapitalDelta]x, 

          k]'[t - 1/4]/(Subscript[\[CapitalDelta]x, k][t - 1/4]), 

      Subscript[x, k][t /; t <= 0] == 30 t + k - 4}, {k, 1, 

      3}], {Subscript[x, 1], Subscript[x, 2], Subscript[x, 3]}, {t, 0,

      8}]];
In[3]:=

Click for copyable input
Plot[Evaluate[{Subscript[x, 1]'[t], Subscript[x, 2]'[t], 

    Subscript[x, 3]'[t], Subscript[x, 4]'[t]} /. sol], {t, 0, 8}, 

 PlotRange -> All, AspectRatio -> 1, Filling -> 29]

Out[3]=