# Numeric integration of Greens Function over singularity

I'm currently using python to numerically evaluate the follow expression at various values of $r$ and $\theta$.

\begin{equation*} f(r,\theta) = \int_{-\pi}^{\pi}\int_{0}^{R}\frac{\exp(ikS)}{2 \pi S}W_k(r^*,\theta^*)r^*dr^*d\theta^* \end{equation*}

where:

\begin{equation*} S = \sqrt{r^2 + r^{*2} - 2rr^*\cos(\theta-\theta^*)} \end{equation*}

I'm looking for advice on how to deal with the singularity at $(r,\theta) = (r^*,\theta^*)$.

I know that I need to remove these singular points from the numeric integration, evaluate them analytically, and add their contribution back. In doing this, however, I am not sure what value to use for $S$.

Since the size of a differential element is approximately $(dr)$ by $(r d\theta)$, it seems appropriate to choose one of the following options:

1. $S = \min\bigg(\frac{dr}{2}, \frac{rd\theta}{2} \bigg)$
2. $S = \sqrt{\bigg(\frac{dr}{2} \bigg)^2+\bigg(\frac{rd\theta}{2} \bigg)^2}$

However when I try any of these values, I cannot accurately recover the reported result. Where am I going wrong?

• What are you using this $S$ value for? How big is $k$ value? – uranix May 7 '15 at 21:33
• I've tried using both the the options listed above for $S$. $k$ is equal to $\frac{\omega}{c}$ where $c$ is the speed of sound in air (343 m/s). I need to evaluate this expression at various frequencies (given by $\omega$ in rad/sec). – Bill Edwards May 7 '15 at 21:40

Regularizing the integral may be handy in your case $$\int\limits_{-\pi}^{\pi}\int\limits_{0}^R \frac{\exp(ikS)}{2\pi S} W(r^*,\theta^*)r^* dr^*d\theta^* = \\ = \int\limits_{-\pi}^{\pi}\int\limits_{0}^R \frac{\exp(ikS) - 1}{2\pi S}W(r^*,\theta^*)r^* dr^*d\theta^* + \int\limits_{-\pi}^{\pi}\int\limits_{0}^R \frac{W(r^*,\theta^*)-W(r,\theta)}{2\pi S}r^* dr^*d\theta^* + \\ +W(r,\theta)\int\limits_{-\pi}^{\pi}\int\limits_{0}^R \frac{1}{2\pi S}r^* dr^*d\theta^*.$$ Assuming the last integral is computed analytically. We can rotate the coordinatte system to get rid of $\theta$: $$\int\limits_{-\pi}^{\pi}\int\limits_{0}^R \frac{1}{2\pi \sqrt{r^2 + r^{*2}-2rr^*\cos(\theta - \theta^*)}}r^* dr^*d\theta^* = \Big|\psi = \theta^* - \theta\Big| = \\ = \int\limits_{-\pi}^{\pi}\int\limits_{0}^R \frac{1}{2\pi \sqrt{r^2 + r^{*2}-2rr^*\cos\psi}}r^* dr^*d\psi = \int\limits_0^R \frac{K\left(-\frac{4\pi rr^*}{(r-r^*)^2}\right)}{\pi|r-r^*|}r^*dr^* + \int\limits_0^R\frac{K\left(-\frac{4\pi rr^*}{(r+r^*)^2}\right)}{\pi|r+r^*|} r^*dr^*$$ The last was obtained with Wolfram Mathematica, but seems to be correct. The last step is removing singularity from $\frac{K\left(-\frac{4\pi rr^*}{(r-r^*)^2}\right)}{\pi|r-r^*|}$. I've asked about asymptotics in Complete elliptic integral of the first kind $K(m)$ asymptotc expansion at $m = -\infty$ .
• Additionally, it appears to me that $\frac{1}{2\pi S}$ is not harmonic and therefore the computation for the last integral provided above may not hold. – Bill Edwards May 8 '15 at 2:01
• Sorry, confused $-\pi,\pi$ with $-\pi/2,\pi/2$. So D is just a circle. $\frac{1}{2\pi S}$ indeed is not harmonic, confused with $\mathbb{R}^3$ case. – uranix May 8 '15 at 5:26