0
$\begingroup$

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;
$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – MarcoB Mar 29 at 3:16
  • $\begingroup$ No, I want to write the equation of motion in matrix form using Mathematica. $\endgroup$ – Hamza Mar 29 at 3:21
  • 1
    $\begingroup$ Maybe if you told us what the equations are in non-matrix notation, we could translate? $\endgroup$ – bill s Mar 29 at 3:29
  • $\begingroup$ (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 $\endgroup$ – Hamza Mar 29 at 3:38
  • 1
    $\begingroup$ @Hamza, Could you edit you initial post, adding the equations there instead of comment? $\endgroup$ – Rom38 Mar 29 at 5:32
0
$\begingroup$
x[t_] = {x1[t], x2[t], x3[t], x4[t]};
A = {{-K, K, 0, 0}, {K, -k - K, k, 0}, {0, k, -k - K, K}, {0, 0, K, -K}};
Thread[m*x''[t] == A.x[t]]

{m x1"[t] == -K x1[t] + K x2[t], m x2"[t] == K x1[t] + (-k - K) x2[t] + k x3[t], m x3"[t] == k x2[t] + (-k - K) x3[t] + K x4[t], m x4"[t] == K x3[t] - K x4[t]}

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.