TITLE: Help with integrating $\int_0^{\infty} \frac{(\log x)^2}{x^2 + 1} \operatorname d\!x$ - contour integration?
QUESTION [11 upvotes]: George Arfken's book: Mathematical Methods for Physicists has the following problem in a chapter on contour integration:
$\displaystyle \int_0^{\infty} \dfrac{(\log x)^2}{x^2 + 1} dx$. 
Their suggestion is to make the substitution $x \rightarrow z=e^t$. I'm not sure what they meant by this, but I tried making the substitution $x = e^t$, which turns the integral into:
$\displaystyle\int_{-\infty}^{\infty} \dfrac{t^2 e^t}{1+e^{2t}} dt$. 
The hint is then to take the contour from -R to R, to R+$\pi i$, to -R + $\pi i$, to -R. Since this has a pole at $t = \pi i/2$, a Laurent series expansion about this point gives the residue as $i \pi^2/8$, so the contour integral equals $-\pi^3/4$.
I've been able to show that the integral along R to R + $\pi i$ and along -R + $\pi i$ to -R goes to zero by the ML inequality - the denominator grows exponentially but the numerator quadratically.
But at this point, I'm a bit lost as to what to do with the integral over Im $t = \pi$. Any help? The book gives the answer as $\pi^3 /8$.

REPLY [2 votes]: Using a semi-circular contour

and noting that
$$
\int_0^\infty\frac{\log(x)}{1+x^2}\,\mathrm{d}x=0
$$
we get
$$
\begin{align}
-\frac{\pi^3}4
&=\oint_\gamma\frac{\log(x)^2}{1+x^2}\,\mathrm{d}x\\
&=\int_0^\infty\frac{(\log(x)+\pi i)^2}{1+x^2}\,\mathrm{d}x+\int_0^\infty\frac{\log(x)^2}{1+x^2}\,\mathrm{d}x\\
&=\int_0^\infty\frac{\log(x)^2-\pi^2}{1+x^2}\,\mathrm{d}x+\int_0^\infty\frac{\log(x)^2}{1+x^2}\,\mathrm{d}x\\
&=2\int_0^\infty\frac{\log(x)^2}{1+x^2}\,\mathrm{d}x-\frac{\pi^3}2\\
\end{align}
$$
Therefore,
$$
\int_0^\infty\frac{\log(x)^2}{1+x^2}\,\mathrm{d}x=\frac{\pi^3}8
$$