Help with complex contour integral involving a logarithm and a square root I've been trying to do the following integral using the 'keyhole' contour: $\int_0^{\infty} \frac{\ln(x)}{\sqrt{x}(1+x^3)}d x.$ I know the result is $-\frac{2\pi^2}{3\sqrt{3}},$ yet when I use the Residue Theorem the result amounts to something else. I chose the branch cut on the real positive axis. I calculated the residues: $\frac{\pi}{9} e^{i5\pi/3}, \frac{\pi}{3}, - \frac{5\pi}{9} e^{i\pi/3}$. Then I applied the theorem: the integral over the contour is the sum of the residues times $2\pi i$. It is pretty clear that the integrals over the arcs of the keyhole approach zero as their radii approach infinity and zero, so all that's left are the integrals over the segments. The integrals over the segments, as the keyhole 'closes' converge to $\int_{r}^{R} \frac{\ln(x)}{\sqrt{x}(1+x^3)}d x$ and $\int_{r}^{R} \frac{\ln(x)+2\pi i}{\sqrt{x}(1+x^3)}d x.$ So we should have $2\pi i \big[ \frac{\pi}{9} e^{i5\pi/3}+ \frac{\pi}{3} - \frac{5\pi}{9} e^{i\pi/3}] = 2\int_{0}^{\infty} \frac{\ln(x)}{\sqrt{x}(1+x^3)}dx + 2\pi i\int_{r}^{R} \frac{dx}{\sqrt{x}(1+x^3)}.$ However when I solve for the integrals on the right I don't get the right value. Where have I made mistakes? Please help!
 A: We seek to compute using contour integration the integral
$$J = \int_0^\infty \frac{\log{x}}{\sqrt{x}(x^3+1)} \; dx$$
We work with
$$f(z) = \frac{\mathrm{Log}(z)}
{\exp(\mathrm{Log}(z)/2) (z^3+1)}$$
where $\mathrm{Log}(z)$ is the branch  with argument in $[0,2\pi).$ We
use a keyhole contour wih radius $R$ and the slot on the positive real
axis.  Let $\Gamma_0$  be the  segment  on the  real axis  up to  $R$,
$\Gamma_1$ the big circle of  radius $R$, $\Gamma_2$ the segment below
the real  axis coming  in from  $R$ and  finally $\Gamma_3$  the small
circle of radius $\epsilon$ enclosing the origin. We then have with
$$\rho_k =  \exp(\pi i/3+ 2\pi i k/3)$$
that
$$\left(\int_{\Gamma_0}
+ \int_{\Gamma_1}+ \int_{\Gamma_2}+ \int_{\Gamma_3}\right) f(z) \; dz
= 2\pi i \times 
\sum_{k=0}^2 \mathrm{Res}_{z=\rho_k} f(z).$$
The poles are all simple and we get for the residues
$$\frac{\pi i/3 + 2\pi i k/3}
{\exp(\pi i/6 + \pi i k/3) 3\rho_k^2}
= - \frac{1}{3} \frac{(\pi i/3 + 2\pi i k/3)\rho_k}
{\exp(\pi i/6 + \pi i k/3)}
\\ = - \frac{1}{3} (\pi i/3 + 2\pi i k/3)
\exp(\pi i/6 + \pi i k/3)
\\ = - \frac{1}{9} (\pi i + 2\pi i k)
\exp(\pi i/6 + \pi i k/3)
.$$
Evaluating these we obtain
$$\begin{array}{rll}
\alpha_0 & = & \mathrm{Res}_{z=\rho_0} f(z)
= -\frac{1}{9} \pi i \exp(\pi i/6) \\
\alpha_1 & = & \mathrm{Res}_{z=\rho_1} f(z)
= -\frac{1}{3} \pi i \exp(\pi i/2)
= \frac{\pi}{3} \\
\alpha_2 & = & \mathrm{Res}_{z=\rho_2} f(z)
= -\frac{5}{9} \pi i \exp(5 \pi i/6).
\end{array}$$
Now observe that in the limit for $\Gamma_0$ and $\Gamma_2$
$$\int_{\Gamma_0} f(z) \; dz = J$$
and 
$$\int_{\Gamma_2} f(z) \; dz =
\int_{\infty}^0 \exp(-\pi i) 
\frac{\log x + 2\pi i}{\sqrt{x}(x^3+1)} \; dx
\\ = \int_0^\infty 
\frac{\log x + 2\pi i}{\sqrt{x}(x^3+1)} \; dx
\\ = J + 2\pi i \int_0^\infty \frac{1}{\sqrt{x}(x^3+1)} \; dx
= J + 2\pi i K,$$
where $K$ is a real number, as is of course, $J.$ 
For  the large  circle of  radius $R$  we have  by the  ML-estimate on
$\Gamma_1$   the   bound   $\lim_{R\rightarrow\infty}   2\pi   R\times
\frac{\log R + 2\pi}{\sqrt{R}(R^3-1)} =  0,$ so this vanishes. For the
small    circle   $\Gamma_3$    of   radius    $\epsilon$   we    find
$\lim_{\epsilon\rightarrow      0}      2\pi      \epsilon      \times
\frac{|\log\epsilon|+2\pi}{\sqrt{\epsilon}(1-\epsilon^3)}  =  0,$  and
this too vanishes. 
The conclusion is that
$$2J + 2\pi i K 
= 2\pi i\times (\alpha_0+\alpha_1+\alpha_2).$$
or 
$$J = \frac{1}{2} 
\Re\left(2\pi i\times 
(\alpha_0+\alpha_1+\alpha_2)\right)
= - \pi 
\Im\left(\alpha_0+\alpha_1+\alpha_2\right)
\\ = \frac{\pi^2}{9} (\cos(\pi/6) + 5 \cos(5 \pi/6))
= \frac{\pi^2}{9} 
\left(\frac{\sqrt{3}}{2}-5\frac{\sqrt{3}}{2}\right)
= - \frac{\pi^2}{9} 2\sqrt{3}.$$
This at last yields the closed form
$$\bbox[5px,border:2px solid #00A000]{
J = - \frac{2\pi^2}{3\sqrt{3}}.}$$
We also get $K$ as a bonus integral as in
$$K= \frac{1}{2\pi} \Im(2\pi i \times (\alpha_0+\alpha_1+\alpha_2))
= \Re(\alpha_0+\alpha_1+\alpha_2)
\\ = \frac{\pi}{3}
+ \frac{1}{9} \pi \sin(\pi / 6)
+ \frac{5}{9} \pi \sin(5\pi / 6)
= \frac{\pi}{3}
+ \frac{1}{9} \pi \frac{1}{2}
+ \frac{5}{9} \pi \frac{1}{2}.$$
We get the closed form
$$\bbox[5px,border:2px solid #00A000]{
K = \frac{2}{3} \pi.}$$
