Solution (source code)

= Solution

The azimuthal coordinate is cyclic, so its <canonical momentum> is conserved. Time independence of the <Lagrangian> also conserves the <energy>. The two constants are
$$
\boxed{h=m\ell^2\sin^2\theta\,\dot\phi,\qquad E=\tfrac12m\ell^2(\dot\theta^2+\sin^2\theta\,\dot\phi^2)-mg\ell\cos\theta.}
$$
For a horizontal launch from depth $D$, take $0<D<\ell$, so $\cos\theta_0=D/\ell$, $\dot\theta_0=0$, and $v=\ell\sin\theta_0\dot\phi_0$. Thus $h=mv\sqrt{\ell^2-D^2}$ and $E=\frac12mv^2-mgD$. The meridional motion has <effective potential> $U(\theta)=h^2/(2m\ell^2\sin^2\theta)-mg\ell\cos\theta$.