# Writing equation of motion in matrix form

How can I write the equation of motion of a system of N variables: x1, x2, ..., xN, (these are all functions of time) in matrix form?

For example,

m*x1'' = -K * x1 + K * x2;
m * x2'' = K * x1 - (k + K) * x2 + k * x3;
m * x3'' = k * x2 - (k + K) * x3 + K * x4;
m * x4'' = K * x3 - K * x4;

• This question may belong to the math or physics forum, but this one is about the Mathematica software package, and you may be in the wrong place. – MarcoB Mar 29 at 3:16
• No, I want to write the equation of motion in matrix form using Mathematica. – Hamza Mar 29 at 3:21
• Maybe if you told us what the equations are in non-matrix notation, we could translate? – bill s Mar 29 at 3:29
• (1) m*x1''=-K * x1 +K * x2; (2) m * x2'' = K * x1 - (k+K) * x2 + k * x3, (3) m * x3'' = k * x2 - (k+K) * x3 + K * x4, (4) m * x4'' = K * x3 - K * x4 – Hamza Mar 29 at 3:38
• @Hamza, Could you edit you initial post, adding the equations there instead of comment? – Rom38 Mar 29 at 5:32

x[t_] = {x1[t], x2[t], x3[t], x4[t]};

Note that the symbol K is already in use in Mathematica; you should use something else instead.