MathGroup Archive 2003

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

Search the Archive

Re: matrix differential equations with NDSolve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40241] Re: [mg40220] matrix differential equations with NDSolve
  • From: Selwyn Hollis <selwynh at earthlink.net>
  • Date: Thu, 27 Mar 2003 06:50:26 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

You do need to provide DSolve and NDSolve with a list containing the 
individual equations, but that can be obtained fairly easily. Here's a 
simple 2x2 example.

          a:= {{1, -2}, {-2, -1}};  initialvals := {1,2};

          Y[t_] = Table[y[i][t], {i, Length[a]}]

                          {y[1][t], y[2][t]}

          deqns = Thread[Y'[t] == a.Y[t]]

                           {y[1]'[t] == y[1][t] - 2*y[2][t],  y[2]'[t] 
== -2*y[1][t] - y[2][t]}

          ics = Thread[Y[0] == initialvals]

                          {y[1][0] == 1, y[2][0] == 2}

          ivp = Flatten[{eqns, ics}]

                          {y[1]'[t] == y[1][t] - 2*y[2][t],  y[2]'[t] == 
-2*y[1][t] - y[2][t], y[1][0] == 1, y[2][0] == 2}

Now you can either

           DSolve[ivp, Y[t], t]

or

          NDSolve[ivp, Y[t], {t, 0, 1}]


-----
Selwyn Hollis
http://www.math.armstrong.edu/faculty/hollis


On Wednesday, March 26, 2003, at 02:42  AM, Richard Easther wrote:

> Is there an easy way to solve matrix (ordinary) differential equations
> numerically inside of Mathematica? (The hard way is to spell them out
> term by term, of course)
>
> It may be I am missing something obvious, but a quick set of
> experiments with NDSolve did not bring any joy....
>
> Richard Easther
>



  • Prev by Date: RE: List Operation ?
  • Next by Date: Re: Re: DSolve and N do not commute
  • Previous by thread: Re: matrix differential equations with NDSolve
  • Next by thread: Re: matrix differential equations with NDSolve