Solution (source code)

= Solution

The assumed orbital <energy> is $E=-\mu m/(2a)$. At a point a distance $r$ from the planet,
$$
\frac12mv_e^2-\frac{\mu m}r=-\frac{\mu m}{2a},\qquad\boxed{v_e^2=\mu\left(\frac2r-\frac1a\right).}
$$
This is the <vis-viva equation>. The <semi-major axis> and radius are measured from the gravitational focus where the planet lies.