Solution (source code)

= Solution

Choose the <gravitational potential energy> to vanish at infinity. The total <mechanical energy> is
$$
E=\frac m2\bigl(\dot r^2+r^2\dot\theta^2\bigr)-\frac{GMm}{r}=\frac{mh^2}2\bigl((u')^2+u^2\bigr)-GMm\,u.
$$
Put $\gamma=GM/h^2$ and $\varphi=\theta-\theta_0$. From part (i), $u=\gamma(1+e\cos\varphi)$ and $u'=-\gamma e\sin\varphi$. Consequently
$$
(u')^2+u^2=\gamma^2\bigl(1+2e\cos\varphi+e^2\bigr),
$$
and the angular terms cancel against the <gravitational potential energy>:
$$
\boxed{E=\frac{mG^2M^2}{2h^2}(e^2-1).}
$$
For a nonradial <Kepler orbit>, negative, zero and positive <mechanical energy> correspond respectively to $e<1$, $e=1$ and $e>1$.