Re: Matrix differential equation

*To*: mathgroup at smc.vnet.net*Subject*: [mg50857] Re: Matrix differential equation*From*: p-valko at tamu.edu (Peter Valko)*Date*: Fri, 24 Sep 2004 04:41:31 -0400 (EDT)*References*: <ciua6v$90v$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

I tried to reproduce the error message, but surprisingly, there was no error and the sample problem worked. The result is an InterpolatingFunction[{{0., 10.}}, <>] and I can calculate it at time zero or at time = 1. For instance matrixExpA[1] gives {{166.52, -16.4872, 0.}, {-16.4872, 1.64872, 0.}, {0., 0., 1.64872}} Therefore, I have to conclude, that you do not input exactly what you wish to input, or that something is not Cleared before you use it. I would suggest to print out k A K KT before using the command > matrixExpA = > X /. First[ > NDSolve[X'[t] == 0.5*IdentityMatrix[3] +(X[t]) + K.X[t] + X[t].KT && > X[0] == IdentityMatrix[3], X, {t, 0, 10}]] to make sure that they really have the value I think they have. Regards Peter "Marco Malvaldi" <M.Malvaldi at chem.rug.nl> wrote in message news:<ciua6v$90v$1 at smc.vnet.net>... > It is possible to numerically solve a general matrix differential equation > with Mathematica? From the example in Mathematica 5 tutorial, I found that > this problem can be solved: > > k = 10 > A = -{{1, 2, 3}, {4, 5 , 6}, {7, 8 , 9}}; > K = -{{0, k, 0}, {0, 0 , 0}, {0, 0 , 0}}; > X0 = {{1, 0, 0}, {0, 1 , 0}, {0, 0 , 1}}; > KT = Transpose[K] > > matrixExpA = > X /. First[ > NDSolve[X'[t] == 0.5*IdentityMatrix[3] .(X[t]) + K.X[t] + X[t].KT && > X[0] == IdentityMatrix[3], X, {t, 0, 10}]] > > Anyway, when I try to submit this problem: > > matrixExpA = > X /. First[ > NDSolve[X'[t] == 0.5*IdentityMatrix[3] +(X[t]) + K.X[t] + X[t].KT && > X[0] == IdentityMatrix[3], X, {t, 0, 10}]] > > the answer is: > > NDSolve::ndfdmc: Computed derivatives do not have dimensionality consistent > with the initial conditions. > > even if what I'm doing is to sum a 3x3 matrix to a system of 3X3 matrix. > > Regards > Marco Malvaldi