-2
$\begingroup$

How do i put last equation, eqm[x, t, k, n] into matrix form? I want every row to end with == 0

Clear["Global`*"]

n = 3; 
Subscript[k, (j_)?EvenQ] = κ; 
Subscript[k, (j_)?OddQ] = k; 
Subscript[k, (j_)?0] = ko; 
Subscript[k, (j_)?n + 1] = ko; 

ue[x_, t_, k_, n_] := 
  (1/2) *
    Sum[
      Subscript[k, j]*(Subscript[x, j - 1][t] - Subscript[x, j][t])^2,
      {j, 1, n + 1}]; 

te[x_, t_, n_] := 
  (1/2)*m*Sum[Derivative[1][Subscript[x, j]][t]^2, {j, 1, n}]; 

lg[x_, t_, k_, n_] := te[x, t, n] - ue[x, t, k, n]; 

eqm[x_, t_, k_, n_] := 
   Sum[D[lg[x, t, k, n], {Subscript[x, j][t], 1}], {j, 1, n}] - 
   Sum[D[D[lg[x, t, k, n], {Derivative[1][Subscript[x, j]][t], 1}], 
     {t, 1}], {j, 1, n}];

MatrixForm[eqm[x, t, k, n]] == MatrixForm[0]

I want it to look like this but with zero on the other side

enter image description here

For n = 3 It should look like this:

enter image description here

I tried array, but I'm bad at such stuff! I was able to do it correctly some time ago. It was short. Unfortunately, I deleted some files, so I lost the correct code.

$\endgroup$

closed as unclear what you're asking by Henrik Schumacher, MarcoB, m_goldberg, Alex Trounev, Carl Lange Apr 4 at 12:28

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ why you vote down !? This is regular question! $\endgroup$ – Alrubaie Apr 2 at 14:27
  • 1
    $\begingroup$ The output of eqm[x, t, k, n] is a single equation. What do you mean by "putting it in matrix form"? Also, avoid subscripts if you can; they tend to complicate expressions needlessly. You will also notice that MatrixForm[0] doesn't really make much sense. Show us an example of the output you seek. $\endgroup$ – MarcoB Apr 2 at 14:29
  • $\begingroup$ check now i edit added a pic $\endgroup$ – Alrubaie Apr 2 at 14:36
  • $\begingroup$ duplicate of mathematica.stackexchange.com/q/194153 ? $\endgroup$ – Roman Apr 2 at 14:37
  • $\begingroup$ every j in the sum in eqm generate a dimension and row for the matrix. how using array and tables can i sort them put them finally in matrix form. i did it sometime ago but deleted some old files so i got lost ! $\endgroup$ – Alrubaie Apr 2 at 14:38
2
$\begingroup$

this one way to do it !

q1 = Table[eq[x, t, k, n][[j]], {j, 1, n}] // Simplify
q2 = Table[eq[x, t, k, n][[j]], {j, n + 1, 2 n}]

MatrixForm[q1 + q2] == MatrixForm[Table[0, {j, 1, n}]]

enter image description here

$\endgroup$

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