I'm trying to find Euler Lagrange equation of motion. then DSolve the equation for list of variable x1,x2,x3,x4
Here is my code:
Clear["Global`*"]
Needs["VariationalMethods`"]
n = 3;
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];
Expand[EulerEquations[lg[x, t, k, n], Subscript[x, j][t], t]]
DSolve[%, Subscript[x, j][t], x]
Here is picture of my code