Solution (source code)

= Solution

Use the <test-particle approximation>, neglecting the planet's recoil. The conserved specific <angular momentum> is $j=bv$ and the specific <energy> at infinity is $v^2/2$. At closest approach the radial <velocity> vanishes, so the <effective potential> gives
$$
\frac{v^2}{2}=\frac{b^2v^2}{2r_0^2}-\frac{GM}{r_0}.
$$
The positive root and the tangential speed are
$$
\boxed{r_0=\frac{\sqrt{G^2M^2+b^2v^4}-GM}{v^2}=\frac{b^2v^2}{GM+\sqrt{G^2M^2+b^2v^4}},\quad v_{\max}=\frac{bv}{r_0}=\sqrt{v^2+\frac{2GM}{r_0}}.}
$$
The second form for $r_0$ avoids subtracting two nearly equal numbers for a small impact parameter. These formulas describe a nonradial orbit; $b=0$ gives a collision rather than a finite nonzero <pericentre> in the point-planet model.