Solution (source code)

= Solution

The <Euler-Lagrange equations> are
$$
\ddot\theta-\sin\theta\cos\theta\,\dot\phi^2=0,
\qquad
\frac d{dt}(\sin^2\theta\,\dot\phi)=0.
$$
The coordinate $\phi$ is a <cyclic coordinate>, so its <conjugate momentum>
$$
l=\sin^2\theta\,\dot\phi
$$
is conserved. Substitution into the first equation gives
$$
\ddot\theta=\frac{l^2\cos\theta}{\sin^3\theta}.
$$
Multiplying by $2\dot\theta$ shows that
$$
\frac d{dt}\left(\dot\theta^2+\frac{l^2}{\sin^2\theta}\right)=0.
$$
Thus $h$ is conserved. Since $l^2/\sin^2\theta=\sin^2\theta\,\dot\phi^2$, \b[$h$ is the squared speed on the unit sphere, equivalently twice the kinetic energy].