Solution (source code)

= Solution

Use a <reference frame> moving with Jupiter, neglect the spacecraft's effect on the planet and neglect the Sun during the short encounter. The Newtonian <central force> makes the <orbit> planar and conserves the <angular momentum> $J=mr^2\dot\vartheta$. In plane <polar coordinates>, the <kinetic energy> is $m(\dot r^2+r^2\dot\vartheta^2)/2$. Choosing zero <gravitational potential energy> at infinity gives
$$
\boxed{E=\frac12m\dot r^2+\frac{J^2}{2mr^2}-\frac{GmM_J}{r}.}
$$
The terms are respectively radial <kinetic energy>, transverse <kinetic energy>, and attractive <gravitational potential energy>. The second term is often combined with the third into the radial <effective potential>. Far from Jupiter,
$$
\boxed{E=\frac12mv_0^2,\qquad J=mbv_0.}
$$
Here $b$ is the perpendicular <impact parameter> of the incoming asymptote, not the eventual <periapsis distance>.