The solid angle spanned by a disc of unit radius, as observed from a point $(r,z)$ at a distance $z>0$ above a point in the disc plane with at distance $r>0$ to the center, can be expressed as $\Omega_1+\Omega_2$ where
$\Omega_1 =2\pi\Theta[-(r+1)(r-1)] +\frac{2 z}{\sqrt{(r+1)^2 + z^2}}\frac{r-1}{r+1}\Pi\left[\alpha^2,k\right]$
$\Omega_2 = \frac{2z}{\sqrt{(r+1)^2 + z^2}} K(k).$ Here $\alpha^2 = n = \frac{(r+1)^2-(r-1)^2}{(r+1)^2}, k^2=m=\frac{(r+1)^2-(r-1)^2}{(r+1)^2+z^2},$ and $K$ and $\Pi$ are complete elliptic integrals (see DLMF Sec. 19.2) and $\Theta$ is Heaviside's theta function. Note that Mathematica defines the elliptic integrals in terms of $n$ and $m$. The formula is adapted from S. Tryka, see (Rev. Sci. Instrum., 70, 3915 (1999)). The paper quotes a special case for $r=1$ which is not included in the expression above, but the expression does have the correct limiting value from both sides.
This all well and fine, except that both terms of $\Omega_1$ are discontinuous at $r=1$ -- which is incidentally the region of interest to me. Is there any way to reformulate the expression to avoid explicit discontinuities?
Update: I suddenly realize that in the formula I quote, I have already made some transformations of the elliptic integrals compared to Tryka's paper. I'll try to dig out my notes to document these.
Note added by J.M.: the formulae in Tryka's paper referred to above were derived in a previous paper of the author.