Solution (source code)

= Solution

For a real short-range <spherically symmetric potential>, the stationary <wavefunction> must solve the <Schrödinger equation>, be regular at the origin whenever the potential is finite there, and satisfy the scattering boundary condition
$$
\psi(\mathbf r)\sim e^{ikz}+f(\theta)\frac{e^{ikr}}r
\qquad(r\to\infty).
$$
Here $e^{ikz}$ is the incident <plane wave>, the second term is an outgoing spherical wave, and its coefficient $f(\theta)$ is the <scattering amplitude>.

Comparing the stated asymptotic expression with the <partial-wave expansion of a scattering amplitude> gives
$$
f(\theta)=\frac1k\sum_{l=0}^{\infty}(2l+1)f_lP_l(\cos\theta),
$$
where $P_l$ is a <Legendre polynomial>. The outgoing-to-incoming coefficient in channel $l$ is
$$
S_l=1+2if_l.
$$
<Partial-wave unitarity> requires
$$
|S_l|=1,
$$
or equivalently
$$
\operatorname{Im}f_l=|f_l|^2.
$$
The real <scattering phase shift> $\delta_l$ is defined modulo $\pi$ by
$$
\boxed{S_l=e^{2i\delta_l},
\qquad
f_l=\frac{e^{2i\delta_l}-1}{2i}
=e^{i\delta_l}\sin\delta_l.}
$$