I am trying to evaluate the integral
$\displaystyle \int_0^{\infty}\frac{\log x}{x^3+1}dx$
and I was trying the keyhole contour with $\displaystyle f(z)=\frac{(\log z)^2}{z^3+1}$
The large circular contour $\gamma_R:t\mapsto Re^{it}$ and the small circular contour $\gamma_{\epsilon}:t\to \epsilon e^{it}$ around $0$ both have integrals which tend to $0$ as we let $R\to \infty$ and $\epsilon \to 0$.
The three residues at $z=-1, e^{i\pi/3}, e^{-i\pi/3}$ are
$\displaystyle \frac{(\log i)^2}{3i^2}=-\frac{\pi^2}{3}, \frac{(\log e^{i\pi/3})^2}{3(e^{i\pi/3})^2}=-\frac{\pi^2}{27}e^{-2i\pi/3}$ and $\displaystyle -\frac{\pi^2}{27}e^{2i\pi/3}$
The path above the branch (i.e. the positive real axes) converges to $\displaystyle \int_0^{\infty}\frac{(\log x)^2}{x^3+1}dx$ and the path below the branch $\displaystyle -\int_0^{\infty}\frac{(\log x+2i\pi)^2}{x^3+1}dx$
So when we add everything up we get
$\displaystyle -\int_0^{\infty}\frac{4i\pi\log x-4\pi^2}{x^3+1}dx=2i\pi[-\pi^2/3-\pi^2/27(e^{-2\pi i/3}+e^{2\pi i/3})]=2i\pi\left(-\frac{\pi^2}{3}+\frac{\pi^2}{27}\right)$
By taking the imaginary part, this would (incorrectly) seem to imply that
$\displaystyle 4\pi\int_0^{\infty}\frac{\log x}{x^3+1}dx=-2\pi\frac{8\pi^2}{27}$
$\displaystyle \int_0^{\infty}\frac{\log x}{x^3+1}dx=\frac{4\pi^2}{27}$
(The real answer is $\frac{2\pi^2}{27}$)
This also (again incorrectly) implies that
$\displaystyle \int_0^{\infty}\frac{1}{x^3+1}dx=0$
(The real answer is $\frac{2\pi}{3\sqrt{3}}$)
as the real part is $0$ on the right hand side.
I have verified that these answers are in fact wrong.
I appreciate that there are alternative contours to evaluate this integral but I would like to know what I missed in this particular computation.
Best Answer
Your problem is that the pole at $z=e^{-i \pi/3}$ should be $z=e^{i 5 \pi/3}$, because you chose your branch cut such that $\arg{z} \in [0,2 \pi)$.