# Integral of the Poisson Kernel

I am trying to solve the following integral:

$$I (r,\theta) = \frac{1}{2\pi}\int_0^{2\pi}\frac{f(\phi)(1-r^2)}{1+r^2-2r \cos(\theta-\phi)}d\phi$$

where $$0\le r<1$$ and,

$$f(0\le\phi<\pi/2) = +\frac{1}{\sqrt 2}$$ $$f(\pi/2\le\phi<\pi) = -\frac{1}{\sqrt 2}$$ $$f(\pi\le\phi<3\pi/2) = -\frac{1}{\sqrt 2}$$ $$f(3\pi/2\le\phi<2\pi) = +\frac{1}{\sqrt 2}$$

This is the solution to the Laplace equation in polar coordinates for a unit circle, with Dirichlet conditions $$f(\theta)$$ (as defined above) along the boundary of the domain at $$r=1$$ (reference). I tried to obtain the solution by numerical integration as well as by analytical solution. Each approach gave me a different answer. I obtained the analytical solution to the integral by using Mathematica and other online tools. Since $$f$$ is a piecewise function, it suffices to find the integral of the integrand without $$f(\phi)$$:

$$\psi|^{l2}_{l1} = \int_{l1}^{l2}\frac{(1-r^2)}{1+r^2-2r \cos(\theta-\phi)}d\phi = 2 \tan^{-1}\Bigg(\left(\frac{1+r}{1-r}\right)\tan\left(\frac{\phi - \theta}{2}\right)\Bigg)\Bigg|^{l2}_{l1}$$

Therefore, the complete solution should be:

$$I_\mathrm{analytical}(r,\theta) = \frac{1}{2\pi}\Big( \frac{1}{\sqrt2} \psi \Big|_{0}^{\pi/2} - \frac{1}{\sqrt2} \psi \Big|_{\pi/2}^{\pi} - \frac{1}{\sqrt2} \psi \Big|_{\pi}^{3\pi/2} + \frac{1}{\sqrt2} \psi \Big|_{3\pi/2}^{2\pi}\Big)$$

Plotting $$I(r,\theta)$$ gave me the following result:

I also performed a numerical integration using the trapezoidal rule, which upon plotting gave:

Upon closer analysis of the data, I realise that there is a difference between the two solutions given by:

$$I_\mathrm{numerical}(r,\theta) = I_\mathrm{analytical}(r,\theta) + 2\pi f(\theta)$$

Since this is a physics problem, I deduced from physical conditions that indeed the numerical solution is correct and the analytical solution is incorrect (this is because the solution must be continuous for $$r<1$$ but in the analytical solution plot, we can see that at $$\theta = \pi/2, 3\pi/2$$, the solution is clearly discontinuous).

Therefore I have 3 questions:

1. Why is there a difference between the numerical solution and the analytical solution?
2. Is my analytical solution indeed incorrect?
3. If yes, what is the correct approach to solve the integral analytically?

The tangent has periodic singularities, poles where it jumps from $$+\infty$$ to $$-\infty$$. At these points the inverse tangent will jump from $$+\frac\pi2$$ to $$-\frac\pi2$$. This is of course not acceptable for an integral function, as that has to be continuous. Thus you need to add integration constants for each interval between the singularities so that no jumps occur. So correct $$\tan^{-1}(a\tan(x))$$ to $$\tan^{-1}(a\tan(x))+\left\lfloor\frac{x}{\pi}+\frac12\right\rfloor·\pi.$$