Solution (source code)

= Solution

Let $h=r^2\dot f$ be the <specific angular momentum>. The radial <Kepler orbit> equation has semi-latus rectum $p=h^2/\mu$, so comparison with
$$
r=\frac{\pm a(1-e^2)}{1+e\cos f}
$$
gives $h^2=\mu a(1-e^2)$ for an <elliptic orbit> and $h^2=\mu a(e^2-1)$ for a <hyperbolic Kepler orbit>. At either apsis, $\dot r=0$ and $v=h/r$. Substituting the apsidal radius and angular momentum into part (i), or equivalently using the <vis-viva equation>, gives
$$
\boxed{C=-\frac{\mu}{2a}\quad\hbox{for a bound orbit},
\qquad
C=+\frac{\mu}{2a}\quad\hbox{for a hyperbolic orbit}}.
$$
Thus the signs are $C=\mp\mu/(2a)$ in the convention of the question.