Re: matrix differential equations with NDSolve

*To*: mathgroup at smc.vnet.net*Subject*: [mg40264] Re: matrix differential equations with NDSolve*From*: guillerm at aida.usal.es (Guillermo Sanchez)*Date*: Fri, 28 Mar 2003 04:32:13 -0500 (EST)*References*: <b5up59$lmf$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

You can download (http://web.usal.es/~guillerm/biokmod.htm) my package Biokmod for Solving SODE using Matrix Notation Guillermo Selwyn Hollis <selwynh at earthlink.net> wrote in message news:<b5up59$lmf$1 at smc.vnet.net>... > 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 > >