# vectorial ODE in mathematica with matrix exponentials

I want to solve the following equation in mathematica :

DSolve[{X'[t] == A.X[t], X[0] == ( {{0},{0}} )}, X[t], t] It is a system of 2 ODEs coupled by the matrix A, that I don't want to put in the form {{a,b},{c,d}} in order to have the output as a function of matrix exponential.

Mathematica understands that but gives a solution strangely expressed as:

 {{X[t] ->
InverseFunction[Dot, 2, 2][A,
E^(t A.1)
InverseFunction[InverseFunction[Dot, 2, 2], 2, 2][A, 0]]}}


Where it indeed uses a matrix exponential, but also relies on a strange notation InverseFunction [...]

My question is how to get rid of this InverseFunction notation to have a more readable expression. Do I for example have a manner to postulate that A is a (2,2) matrix, invertible, with inverse B?

Or more generally, how to solve vectorial ODE's and make Mathematica write the solution by relying on exponential matrix notation?

If I can hope a better result with maxima, please advise. Thanks a lot for help

-
Mathematica does not yet support symbolic, non-explicit matrices, so if you don't want to replace your A with something like {{a11, a12}, {a21, a22}}, there's not much you can do... still, look into MatrixExp[]. – J. M. Aug 3 '12 at 13:06
@J.M. And that is a real pity :) – Dr. belisarius Aug 3 '12 at 13:08
Thanks a lot JM. I tried that for this equation : Y'=(A-B)Y+B*L, and wrote it as : DSolve[{{{Derivative[1][Y1][t]}, {Derivative[1][Y2][ t]}} == ({{a11, a12}, {a21, a22}} - {{b11, b12}, {b21, b22}}).{{Y1[t]}, {Y2[t]}} + {{b11, b12}, {b21, b22}}.{{L1}, {L2}}, {{Y1[0]}, {Y2[ 0]}} == {{L01}, {L02}}}, {{Y1[t]}, {Y2[t]}}, t] But I got an error message : DSolve::dsfun: "{Y1[t]} cannot be used as a function. " , any idea? – volatile Aug 3 '12 at 13:19
Use Thread on your equations to get the == working on component level. You might need to throw in a Flatten. – Sjoerd C. de Vries Aug 3 '12 at 13:44
I used Thread, DSolve[{Thread[{{Derivative[1][Y1][t]}, {Derivative[1][Y2][ t]}} == {{b11 L1 + b12 L2 + (a11 - b11) Y1[t] + (a12 - b12) Y2[t]}, {b21 L1 + b22 L2 + (a21 - b21) Y1[t] + (a22 - b22) Y2[t]}}], Thread[{{Y1[0]}, {Y2[0]}} == {{L01}, {L02}}]}, {{Y1[t]}, {Y2[t]}}, t]but still have the same error message DSolve::dsfun: "{Y1[t]} cannot be used as a function." – volatile Aug 3 '12 at 14:15

Module[{X, A, InitialCondition},
X[t_] = {X1[t], X2[t]};
InitialCondition = {0, 0};
A = {{a, b}, {c, d}};
X[t], t]]


Was what was meant by correct usage of Thread and Level I think. {0,0} is a trivial initial condition but with {1,1} you get:

Module[{X, A, InitialCondition},
X[t_] := {X1[t], X2[t]};
InitialCondition = {1, 1};
A = {{a, b}, {c, d}};
Thread[X[0] == InitialCondition]}, X[t], t] // FullSimplify]

{X1[t] -> (
E^(1/2 (a + d) t) (Sqrt[4 b c + (a - d)^2]
Cosh[1/2 Sqrt[4 b c + (a - d)^2] t] + (a + 2 b - d) Sinh[
1/2 Sqrt[4 b c + (a - d)^2] t]))/Sqrt[4 b c + (a - d)^2],
X2[t] -> (
E^(1/2 (a + d) t) (Sqrt[4 b c + (a - d)^2]
Cosh[1/2 Sqrt[4 b c + (a - d)^2] t] + (-a + 2 c + d) Sinh[
1/2 Sqrt[4 b c + (a - d)^2] t]))/Sqrt[4 b c + (a - d)^2]}


which is (as expected) the same as

MatrixExp[{{a, b}, {c, d}} t].{1, 1} // FullSimplify

-