Re: Q: NDSolve

*To*: mathgroup at smc.vnet.net*Subject*: [mg21785] Re: Q: NDSolve*From*: Paul Abbott <paul at physics.uwa.edu.au>*Date*: Thu, 27 Jan 2000 22:57:08 -0500 (EST)*Organization*: University of Western Australia*References*: <85mmgb$268@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Christoph Handel wrote: > is there a nice way to solve an equation like this: > > x'[t] == aMatrix[t] . x[t] > > where x ist a Vector. > > I tried something like this: > > NDSolve[{x'[t]== aMatrix[t] . x[t], x[0]=={1,2,3...}},x,{t,0,42}] Here is a "reasonably" nice way which makes use of Through and Thread: For the vector x = {a, b, c}; and the matrix A[t_] = {{1, 2 t, 7}, {4, 3, 9 - t^2}, {0, 0, 1}}; the set of differential equations can be written as eqn = Thread[D[Through[x[t]], t] == A[t] . Through[x[t]]] Specifying the initial conditions, ics = Thread[Through[x[0]] == {1, 0, 2}] we can now use NDSolve directly: NDSolve[Join[eqn, ics], x, {t, 0, 1}] Cheers, Paul