# Is there a numerically stable way to take $\epsilon \rightarrow 0$ in integrals of the form $\int \frac{f(x)dx}{x+i\epsilon}$?

The Sokhotski-Plemelj theorem states, $$\lim_{\epsilon\rightarrow 0^+}\int_a^b\frac{f(x)dx}{x+i\epsilon} = \mathcal P \int_a^b \frac{f(x)dx}{x} - i\pi f(0).$$

Is there a numerically stable way to take this limit, without explicitly using the above theorem? I find that if I use $$f(x)=1$$, $$a=-b$$, I almost converge to $$-i\pi$$, but not before things become unstable.

• If you're trying to evaluate the limit, then can't you just take a finite non-zero value of $\epsilon$ and integrate over the rectangle $(a,b)\times(0,\epsilon)$ without its edge on the real line? You can choose $\epsilon$ here freely up to the lowest singularity in the upper half-plane, and if $a,b=\pm\infty$ then you don't even have the contributions from the vertical rectangle edges. – Kirill Dec 15 '18 at 1:11
• For a = -b, this is a great idea, and I cannot believe I did not think of it. However, it does not help for the case when a and/or b are finite. – Danny Dec 16 '18 at 0:44
• Why not? You'd have an integral over three line segments, $a\to a+i\epsilon\to b+i\epsilon\to b$. I'm not sure what you mean. – Kirill Dec 16 '18 at 1:00
• Yes, that's what I meant. Why doesn't it work when $a,b$ are finite? – Kirill Dec 16 '18 at 1:48
• Taking an arbitrary sequence that converges as $O(\epsilon)$ and computing its limit as $\epsilon\to0$ (especially if as you say you can't assume the function has a continuation) is a substantially harder problem than evaluating the Cauchy principal value directly using numerical quadrature on the real line. (I.e., explicitly evaluating the r.h.s. and ignoring the l.h.s. entirely.) Can you say anything about the actual $f(x)$ you're trying to integrate to make the question less open-ended? – Kirill Dec 16 '18 at 16:51