I'm studying classical mechanics by myself (becore returning university) and I couldn't find a solution for that problem on internet (to see if my analysis was good), and after watch this video I confirmed my answer! Greetings from Colombia 🇨🇴
could you show us how it would be without the Lagrange method, only using sum of forces and moments? how it would be if one wall moves with an harmonic function u(t) ?
Thanks for your question. Hmmmmmm. You use Lagrange here in order to facilitate the solution. If you do not want to use this, the solution becomes more tedious, but you will find all the forces enforcing the constraints. So you need to include (i) the spring forces, (ii) a force which keeps the suspension point horizontal (iii) the moment of the forces (gravity, spring forces) w.r.t. either the center of mass or the suspension point of the pendulum. Seems doable but why would you like to do that? If the walls move, you can still use Lagrange, but the potential now involves u(t) and is therefore time-dependent. As in the Lagrange equations you take the full (not partial) derivative with respect to time, the potential yields a contribution there. Would be nice to try and then solve the Lagrange equation on your computer and make an animation.
Why is sign in front of term Mlgcos(phi) - and not +, isn't y coordinate faced downwards,and also is gravitational force,if you could explain it would be helpful
The term Mgl cos (phi) is maximal for phi=0. Therefore, the potential energy is minimal when phi=0. Therefore we should have a minus sign. Note that l is positive. For phi=0 the potential must be -Mgl (up to a possible additive constant). The convention for the positive/negative y direction should not affect the final formula for V. If your calculation is consistent, V should always have the same form, independent of axis conventions.