Lagrangian mechanics happens to be taught as part of the mechanics course – this can form part of my revision!

The first step is to identify the generalised coordinates of the system. They are, by definition, the least number of coordinates with which you can fully describe the system. We will denote the $k^{th}$ generalised coordinate by $q_k$.

In the case of Alan’s cradle car, it would be very sensible to choose the linear displacement of the car and the angle made by the metal balls with the vertical. We will call these $x$ and $\vartheta$ respectively. That is,

$q_1=x$

$q_2=\vartheta$

For each general coordinates there exists a generalised velocity $\dot{q}$, defined by

$\displaystyle\dot{q_k}=\frac{dq_k}{dt}$

It is important that the least number of coordinates possible is used. The number needed is equal to the number of degrees of freedom the system has. If, for example, we forced the car to move at a constant velocity, $x$ would no longer be considered a generalised coordinate.

The Lagrangian of a system is defined by the equation

$L=T-V$

where $T$ and $V$ are the system’s kinetic and potential energy respectively. It is hard to see an application for such a quantity – it doesn’t seem to have any kind of intuitive physical meaning.  It turns out that if we substitute $L$ into the Euler-Lagrange equation, defined by

$\displaystyle \frac{\partial L}{\partial q_k}-\frac{d}{dt}\bigg(\frac{\partial L}{\partial \dot{q_k}}\bigg)=0$

we can derive equations of motion for the system. Note that we need not consider forces or indeed vectors of any sort. This is the merit of using Lagrangian dynamics – we only need to deal with scalar quantities.

We’ll consolidate this new information by using the cradle car as an example. Let the combined mass of the metal balls be $m$ and that of the car be $M$. Let $l$ be the length of the string connecting the balls to the frame.

It can be shown that the kinetic and potential energies $T$ and $V$ are given by

$T=\frac{1}{2}M\dot{x}^2+\frac{1}{2}m\dot{x}^2+\frac{1}{2}ml^2\cos^2\vartheta\dot{\vartheta}^2+m\dot{x}l\cos\vartheta\dot{\vartheta}$

$V=mgl(1-\cos\vartheta)$

Hence the Lagrangian is given by

$L=\frac{1}{2}M\dot{x}^2+\frac{1}{2}m\dot{x}^2+\frac{1}{2}ml^2\cos^2\vartheta\dot{\vartheta}^2+m\dot{x}l\cos\vartheta\dot{\vartheta}+mgl\cos\vartheta-mgl$

in its most expanded form.

Upon substituting these into the Euler-Lagrange equations, we get the two equations

$(M+m)\ddot{x}+ml(\cos\vartheta\ddot{\vartheta}-\sin\vartheta\dot{\vartheta}^2)=0$

$\ddot{x}\cos\vartheta+g\sin\vartheta+l\cos\vartheta(\cos\vartheta\ddot{\vartheta}-\sin\vartheta\dot{\vartheta}^2)=0$

The first comes from differentiation with respect to $x$ and the second with the respect to $\vartheta$. Careful use of the product and chain rules must be made to arrive at these results – it is surprisingly easy to make mistakes. In this case, we need to solve for $\vartheta$ first. Eliminating $x$, we arrive at the differential equation

$\ddot{\vartheta}+(\Omega^2-\dot{\vartheta}^2)\vartheta=0$

where

$\displaystyle\Omega^2=\bigg(\frac{M+m}{M}\bigg)\bigg(\frac{g}{l}\bigg)$

Here, we have made the small-angle approximation that $\sin\vartheta=\vartheta$ and $\cos\vartheta=1$. Such an assumption is almost always needed to obtain a closed-form solution for pendular motion.

The differential equation above has an elegance to it, and it would be lovely if it had an exact solution. Unfortunately, no such solution seems to exist. The next best approximation is to assume that the motion of the metal balls is fairly slow, in which case the equation

$\ddot{\vartheta}+(\Omega^2-\dot{\vartheta}^2)\vartheta=0$

reduces to

$\ddot{\vartheta}+\Omega^2\vartheta=0$

This is the familiar equation for simple harmonic motion, which has solutions of the form

$\vartheta=A\cos(\Omega t)+B\sin(\Omega t)$

We will arbitrarily choose the initial conditions

$\vartheta(0)=\vartheta _0$

$\dot{\vartheta}(0)=0$

That is to say, the metal balls are initially at rest and displaced by a small angle $\vartheta_0$. Our solution to $\vartheta(t)$ is therefore

$\vartheta=\vartheta_0\cos(\Omega t)$

We can substitute this expression into either of the equations of motion above to solve for $x$. We will assume that the car starts at the origin and is launched at velocity $V$, so

$x(0)=0$

$\dot{x}(0)=V$

in which case the expression for $x$ is given by

$x=\displaystyle Vt+\bigg(\frac{m}{M+m}\bigg)(1-\cos(\Omega t))l\vartheta_0$

Hence we have derived the motion of the system in the small angle approximation:

$\vartheta=\vartheta_0\cos(\Omega t)$

$x=\displaystyle Vt+\bigg(\frac{m}{M+m}\bigg)(1-\cos(\Omega t))l\vartheta_0$

The most interesting parameters to vary are $m$ and $M$. The following animations show the responses for $m = 0,$ $m=M,$ $m=2M$ and $m=3M$ respectively:

If the animations have stopped, simply click on them and a refreshed link will appear in a new window.

The perturbation effect of the swinging metal balls becomes increasingly noticeable as their mass increases. In the last case, we see the ‘rowing’ motion, where the velocity of the car changes sign periodically. It is likely that the last animation is inaccurate, as we are beginning to push the assumption that $\dot{\vartheta}$ is small.