MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Vector of functions in ordinary differential equations


You need to break out each of the equations in the vector relationship. 
Try using Thread on the de and any initial conditions, e.g.

eq = Thread[D[rv[t], t] == M.rv[t]]

Kevin

Dr. Wolfgang Hintze wrote:
> Considering ordinary differential equations for more than one function 
> I'd like to have one differential equation for n functions in terms a 
> vector rnv[t] = {x[1,t], x[2,t], ... , x[n,t]} but I did not succeed in 
> expressing it in Mathematica.
> 
> Any hints are greatly appreciated.
> 
> Regards,
> Wolfgang
> 
> Here are the details:
> 
> 1) There are no problems if I define the independent functions 
> explicitly like x[t], y[t], ... and write down a differential eqaution 
> for each component.
> 
> 2) There are also no problems if the explicit components are collected 
> into a vector, e.g. rv[t] := {x[t], y[t]}. Then one differential 
> equation for the vector works fine. This is a example for a linear diffeq:
> 
> In[103]:=
> rv[t_] := {x[t], y[t]}
> 
> In[104]:= rv[t]
> 
> Out[104]= {x[t], y[t]}
> 
> In[105]:= M = {{a, b}, {c, d}}
> 
> Out[105]= {{a, b}, {c, d}}
> 
> In[108]:= eq = D[rv[t], t] == M . rv[t]
> 
> Out[108]= {Derivative[1][x][t], Derivative[1][y][t]} == {a*x[t] + 
> b*y[t], c*x[t] + d*y[t]}
> 
> In[110]:= sm = DSolve[eq, rv[t], t];
> 
> In[74]:= x[t] /. sm
> 
> Out[74]= {1/(2*Sqrt[a^2 + 4*b*c ... [snip]
> 
> 3) Now, in the general case, I'd like to have n functions x[1,t], 
> x[2,t], ... , x[n,t]: there is the problem
> 
> In[91]:= Clear[rv, M, n, x, k, eqm]
> 
> In[92]:= n = 2;
> 
> In[93]:= rv[t_, n_] := Table[x[k, t], {k, 1, n}]
> 
> In[94]:= rv[t, n]
> 
> Out[94]= {x[1, t], x[2, t]}
> 
> In[95]:= M[n_] := Table[Table[Random[], {n}], {n}]
> 
> In[96]:= MatrixForm[M[n]]
> 
> Out[96]//MatrixForm=
> MatrixForm[{{0.4129438091150023, 0.19074665264305043}, 
> {0.31296972444474486, 0.31543944991928186}}]
> 
> In[99]:= eqm = D[rv[t, n], t] == M[n] . rv[t, n]
> 
> Out[99]=
> {Derivative[0, 1][x][1, t], Derivative[0, 1][x][2, t]} == 
> {0.8654946712834201*x[1, t] + 0.6944612611502227*x[2, t],
>     0.7720429142604556*x[1, t] + 0.016353185110213362*x[2, t]}
> 
> In[100]:= DSolve[eqm, rv[t,n], t]
> 
>  From In[100]:= DSolve::"nvld" : "The description of the equations 
> appears to be ambiguous or \
> invalid."
> 
>  From In[100]:= DSolve::"deqx" : "Supplied equations are not 
> differential equations of the \
> given functions."
> 
>  From In[100]:= DSolve::"deqx" : "Supplied equations are not 
> differential equations of the \
> given functions."
> 
> Out[100]= DSolve[{Derivative[0, 1][x][1, t], Derivative[0, 1][x][2, t]} 
> == {0.8654946712834201*x[1, t] + 0.6944612611502227*x[2, t],
>      0.7720429142604556*x[1, t] + 0.016353185110213362*x[2, t]}, {x[1, 
> t], x[2, t]}, t]
> 
>  From In[111]:= DSolve::"nvld" : "The description of the equations 
> appears to be ambiguous or \
> invalid."
> 
>  From In[111]:= DSolve::"deqx" : "Supplied equations are not 
> differential equations of the \
> given functions."
> 
>  From In[111]:= DSolve::"deqx" : "Supplied equations are not 
> differential equations of the \
> given functions."
> 


  • Prev by Date: How can one define variables to be local by default ?
  • Next by Date: Re: Mathematica Notebook Organiztion
  • Previous by thread: Vector of functions in ordinary differential equations
  • Next by thread: Re: Vector of functions in ordinary differential equations