# Solving Matrix Differential equations with Mathematica

I can't solve (analytically or numerically) the following matrix differential equation by hand.

I want to solve it using Mathematica or similar. I know that I must write my effort about code.

M V''[t] + C V'[t] +K V(t)== P(t)?


But I am a beginner in such a programs.

I have a code for Matrices in Maple.

Can we transform the Maple code to Mathematica code?

    M:= Matrix
( n,
n,
shape=identity
)
+
alpha*Matrix
( n,
n,
(i,j)->sin(i*Pi*nu*t/l)*sin(j*Pi*nu*t/l)
):
C:= 2*alpha*Matrix
( n,
n,
(i,j)->(j*Pi*nu/l)*sin(i*Pi*nu*t/l)*cos(j*Pi*nu*t/l)
):
K:= Matrix
( n,
n,
(i,j)-> if( i=j,
(j*Pi/l)^4*E*J/(rho*A)+(j*Pi/l)^2*N/(rho*A),
0
)
)
-
alpha*Matrix
( n,
n,
(i,j)->(j*Pi*nu/l)^2*sin(i*Pi*nu*t/l)*sin(j*Pi*nu*t/l)
):
VV:= Vector[column]
( n,
j->V[j](t)
):
FF:=Vector[column]
( n,
j->F[j](t)
):
PP:= P/(rho*A)
*
Vector[column]
( n,
j->sin(j*Pi*nu*t/l)
)+FF:

params:=( indets(sys1, name)
minus
{Pi,t}
)=~1:
ics:= [ Equate
( eval(VV,t=0),
Vector[column]
( n,
fill=0
)
)[],
Equate
( convert(eval(diff~(VV,t),t=0),D),
Vector[column]
( n,
fill=0
)
)[]
]:


Here's an example:

a = {{a11, a12}, {a21, a22}};
x[t_] = {x1[t], x2[t]};
sol = DSolve[x''[t] == a.x[t] + b , x[t], t]


If you have specific numbers then you can use NDSolve. You can find lots of examples in the help files.

• Thank you. But I think I'm misunderstood. Please find the following link? math.stackexchange.com/questions/2680397/… Commented Mar 9, 2018 at 7:01
• I did not misunderstand. You need to make some effort. Put your matrices M, C, K, etc into Mathematica form. Then use DSolve (or perhaps NDSolve) as in my toy problem above. If you run into trouble, let us know where you have problems. Commented Mar 9, 2018 at 12:48
• Thanks for interest. I edited post. Could you look again? Commented Mar 9, 2018 at 13:05
• When trying to solve a large problem, it often helps to solve a simple one first, to get the hang of how things go. Why not find a simple version of the problem and see where you get stuck? Commented Mar 9, 2018 at 23:00