Hello, I am trying to derive the equations of motino for a simple pendulum using the Euler-Lagrange Equation. This works very well until I try to solve the equation numerically using “NDSolve”. The error code is: “Equation or list of equations expected instead of …”.
Does someone has an idea?
Remove[L, g, M, Lagrange, T, V, eq, sol]
x = L*Sin[\[Theta][t]];
y = -L*Cos[\[Theta][t]];
x' = D[x, t];
y' = D[y, t];
T = M/2*(x' + y')^2;
V = M*g*y;
Lagrange = T - V;
eq = D[D[Lagrange, \[Theta]'], t] - D[Lagrange, \[Theta]];
L = 1;
M = 1;
g = 9.81;
sol = NDSolve[{eq, \[Theta][0] == Pi, \[Theta]'[0] ==
0}, \[Theta], {t, 0, 10}]