$\int_{-\infty}^\infty \frac{e^{pz}}{e^z-1}dz$ Cauchy principal value

cauchy-principal-valuecomplex-analysiscontour-integrationdefinite integralsimproper-integrals

$$\int_{-\infty}^\infty \frac{e^{pz}}{e^z-1}dz$$

I started by defining the following contour:
rectangular contour

It is easy to show that the integrals along the 2 vertical sides of the rectangle go to $0$ as $R\Rightarrow\infty$ by applying the triangle inequality for integrals.
Note that we must have $0<p<1$ for this to work.

For the integral along the top side of the rectangle we define $z=x+\pi i$ so the integral becomes:
$$\int_{R}^{-R} \frac{e^{p(x+\pi i)}}{e^{x+\pi i}-1}dx$$
Using some basic algebra and taking the limit as $R\Rightarrow\infty$ this simplifies to:
$${e^{p \pi i}}\int_{-\infty}^{\infty} \frac{e^{px}}{e^{x}+1}dx$$
This integral has a known solution and plugging this solution in yields:
$${e^{p \pi i}} {\frac{\pi}{\sin{p \pi}}}$$
Now we need to tackle the integral over the semi-circle and to do so we define: $z=\epsilon e^{i \theta}$ so $dz=i \epsilon e^{i \theta} d\theta$ and $-\pi \leq \theta \leq 0$

The integral becomes:

$$\int_{- \pi}^{0} \frac{e^{p \epsilon e^{i \theta}}}{e^{\epsilon e^{i \theta}}-1} i \epsilon e^{i \theta}d\theta$$
Taking the limit as $\epsilon \Rightarrow 0$ using l'Hopital's rule we get:
$$\int_{- \pi}^{0} \frac{e^{p \epsilon e^{i \theta}}}{e^{\epsilon e^{i \theta}}-1} i \epsilon e^{i \theta}d\theta = i \pi$$
Putting everything together and using the fact that the closed contour integral is zero since there are no singularities inside the contour yields. I let WolframAlpha do the simplification:

$$\int_{-\infty}^\infty \frac{e^{pz}}{e^z-1}dz = -\pi \cot{(p \pi)} -2 \pi i$$
In my opinion this seems weird because the integrand is real for all inputs of z except $0$. I expected the cauchy principal value, which this integral actually is because it blows up at $0$, to be real valued as well. Unfortunately my calculations show that this integral is complex valued.

Could someone please tell me if I did something wrong or not.
I found an article which also has this integral covered but I believe there is a mistake in their calculation of the integral along the semi-circle (they forgot a minus sign), which if corrected results in the same answer I got. link: article covering the integral.

Any help is greatly appreciated!

PS: I am 17 years old so this is my first post on this forum, if there are any (informal) rules which I am not aware of please let me know as well!

Best Answer

Your values of $\theta$ should be $0 \le \theta \le \pi$ traveled backwards. Interchanging limits and integration, we thus have $$\begin{align} \lim_{\epsilon \to 0}\int_{\pi}^{0} \frac{e^{p \epsilon e^{i \theta}}}{e^{\epsilon e^{i \theta}}-1} i \epsilon e^{i \theta}d\theta &= \int_{\pi}^{0} \lim_{\epsilon \to 0}\frac{e^{p \epsilon e^{i \theta}}}{e^{\epsilon e^{i \theta}}-1} i \epsilon e^{i \theta}d\theta \\&=i\int_{\pi}^{0}e^{i \theta}\lim_{\epsilon \to 0}\frac{e^{p \epsilon e^{i \theta}} \epsilon }{e^{\epsilon e^{i \theta}}-1}d\theta \\&=i\int_{\pi}^{0}e^{i \theta}e^{-i\theta}d\theta \\&=-i\pi \end{align} $$ Which yields the answer you would expect, canceling the imaginary part. We thus only get the real part.