Solution (source code)

= Solution

The sudden potential change leaves the star's position and velocity unchanged. Its new energy is therefore
$$
E_1=E_0+\frac{G(M_0-M_1)}r
=-\frac{GM_0}{2a}+\frac{GM_0}{2r}
=\frac{GM_0}{2}\left(\frac1r-\frac1a\right).
$$
Thus $E_1>0$ precisely when $r<a$. Parametrize the orbit by <eccentric anomaly> $\eta$:
$$
r=a(1-e\cos\eta),
\qquad
\theta_r=\eta-e\sin\eta.
$$
A <phase-mixed orbit> is uniform in the <mean anomaly> $\theta_r$. For $e>0$, the condition $r<a$ is $-\pi/2<\eta<\pi/2$ modulo one period. The corresponding mean-anomaly interval has length
$$
\Delta\theta_r
=\left[\eta-e\sin\eta\right]_{-\pi/2}^{\pi/2}
=\pi-2e.
$$
Hence
$$
\boxed{P_{\rm unbound}(e)=\frac12-\frac e\pi}.
$$
The energy increase $G(M_0-M_1)/r$ is largest near <periapsis>, so stars are more readily unbound there than near <apoapsis>. A perfectly circular orbit is the measure-zero marginal case $E_1=0$ at every phase.