Re: Solving Simultaneous Differential Equations
- To: mathgroup at smc.vnet.net
 - Subject: [mg78976] Re: Solving Simultaneous Differential Equations
 - From: chuck009 <dmilioto at comcast.com>
 - Date: Sat, 14 Jul 2007 02:42:22 -0400 (EDT)
 
Here's how I do it.  NDSolve returns a nested list of rules for the set of variables.  I then just define a function for each using a transformation rule.  Probably a better way though.
In[82]:=
Clear[x, y, z, t]
solutions = NDSolve[{Derivative[1][x][t] == -3*(x[t] - y[t]), 
    Derivative[1][y][t] == (-x[t])*z[t] + 26.5*x[t] - y[t], 
    Derivative[1][z][t] == x[t]*y[t] - z[t], x[0] == z[0] == 0, 
    y[0] == 1}, {x, y, z}, {t, 0, 20}]
Out[83]=
{{x -> InterpolatingFunction[], y -> InterpolatingFunction[], 
   z -> InterpolatingFunction[]}}
In[126]:=
f1[t_] := (x /. Flatten[solutions])[t]
Plot[f1[t], {t, 0, 5}]
> 
> How do I store the interpolating function data for
> each function so I can plot each by itself?
>