The stability of the equilibrium of a pendulum of variable length