contour integration of $\int_0^\infty \frac{\ln(x)}{x^2-1}dx$ I asked for a problem for few days ago, regarding integration of 
$$I=\int_0^\infty \frac{\ln(x)}{x^2-1}dx$$
I know that I could do the substitution $x=it$ and do the integral where the denominater is $x^2+1$ and so on... But I tried anyway to create a contour and compute my integral. Down below my contour $C$ can be seen.

Let $f(z)=\ln(z)/(z^2+1)$. I compute my residue and obtain 0. I.e. $\oint_C f(z)dz=0$. The following are also giving me zero, i.e. $$\begin{align} 
\int_{\gamma_R}f(z)=0\\
\int_{\gamma_r}f(z)=0
\end{align}$$
by the estimation lemma. So now my integral is,
$$0=e^{\pi/3i}\int_r^R \frac{\ln|z|+\pi/3i}{z^2-1}dz+e^{2\pi/3i}\int_r^R \frac{\ln|z|+2\pi/3i}{z^2-1}dz$$
I rewrite the above to
$$0=(e^{\pi/3i}+e^{2\pi/3i})\int_r^R \frac{\ln(x)}{z^2-1}dz+(\frac{\pi}{3}ie^{\pi i/3}+\frac{2\pi}{3}ie^{2\pi i/3})\int_r^R \frac{1}{z^2+1}dz$$
And calculating the above gives me,
$$\int_r^R \frac{\ln(x)}{z^2-1}dz=\frac{\pi^2}{4}+\frac{i\sqrt{3}\pi^2}{36}$$
But if I compute the integral $I$ in Maple, I obtain $I=\frac{\pi^2}{4}$. My questions:


*

*Are my contour plot correct?

*Are my integrals correct, i.e. arc and residue?

*If yes to 1. and 2. Can I just drop the imaginary part and just use the real part?

 A: If I'm not mistaken, you've done your substitutions incorrectly.  For the straight-line segment of the integral in the upper half-plane (call it $\gamma_1$), for example, the integral is
$$
I_1 = \int_{\gamma_1} \frac{\ln(z) dz}{z^2 - 1} 
$$
To turn this into an integral over a single real parameter $x$, we let $z = x e^{i \pi/3}$, and integrate from $x = r$ to $R$:
$$
I_1 = \int_r^R \frac{\ln (x e^{i \pi/3}) (dx e^{i \pi/3})}{x^2 e^{2i \pi/3} - 1} = e^{i \pi/3} \int_r^R \frac{\ln |x| + i \pi/3}{x^2 e^{2i \pi/3} - 1} \, dx.
$$
But the factor of $e^{2i \pi/3}$ multiplying $x^2$ in the denominator means that $I_1$ is not related in a simple way to the integral $I$ you're trying to calculate.  So I believe this method is a dead end.
A: \begin{eqnarray*}
\int_0^\infty\int_0^\infty\frac{dxdy}{(1+y)(1+x^2y)}
&=&\int_0^\infty\frac{dy}{1+y}\int_0^\infty\frac{dx}{1+x^2y}\\
&=&\int_0^\infty\frac{dy}{1+y}\int_0^\infty\frac{1}{y}\frac{dx}{\frac{1}{y}+x^2}\\
&=&\int_0^\infty\frac{dy}{1+y}\int_0^\infty\frac{1}{y}\frac{1}{\frac{1}{\sqrt{y}}}arctan \frac{x}{\frac{1}{\sqrt{y}}}|_0^\infty\\
&=&\frac{\pi}{2}\int_0^\infty\frac{dy}{\sqrt{y}(1+y)}\\
&=&\frac{\pi}{2}2\int_0^\infty\frac{dt}{1+t^2}\\
&=&\frac{\pi^2}{2}
\end{eqnarray*}
\begin{eqnarray*}
\int_0^\infty\int_0^\infty\frac{dxdy}{(1+y)(1+x^2y)}
&=&\int_0^\infty\frac{dx}{1-x^2}\int_0^\infty\left(\frac{x^2}{1+x^2y}-\frac{1}{1+y}\right)dy\\
&=&\int_0^\infty\frac{1}{1-x^2}\left(\ln\frac{1+x^2y}{1+y}\big|_0^\infty\right)dx\\
&=&2\int_0^\infty\frac{\ln x dx}{1-x^2}
\end{eqnarray*}
Thus
\begin{eqnarray*}
\int_0^\infty\frac{\ln x dx}{1-x^2}=\frac{\pi^2}{4}.
\end{eqnarray*}
