Solution (source code)

= Solution

Separate the interior <Helmholtz equation> in the same angular basis. Each radial coefficient $F_\ell(r)$ satisfies
$$
\boxed{r^2F_\ell''+2rF_\ell'+[sr^2-\ell(\ell+1)]F_\ell=0.}
$$
For $s>0$, set $x=\sqrt{s}\,r$. The equation becomes $x^2f_\ell''+2xf_\ell'+[x^2-\ell(\ell+1)]f_\ell=0$. Its regular solution is a <Spherical Bessel function> $j_\ell(x)$, up to a multiplicative constant. The second independent solution is singular as $r^{-\ell-1}$ at the origin and is excluded. Hence
$$
\boxed{B_{\rm in}(r,\theta)=\sum_{\ell=0}^\infty B_\ell j_\ell(\sqrt{s}\,r)P_\ell(\cos\theta).}
$$
One may denote $j_\ell$ by $f_\ell$ as in the source. Its leading behaviour $j_\ell(x)\sim x^\ell/(2\ell+1)!!$ ensures regularity. Primes on $j_\ell$ below refer to its dimensionless argument; differentiating with respect to $r$ introduces the factor $\sqrt{s}$.