# Evaluating real integral using residue calculus: why different results?

I have to evaluate the real integral $$I = \int_0^{\infty} \frac{\log^2 x}{x^2+1}.$$ using residue calculus. Its value is $\frac{\pi^3}{8}$, as you can verify (for example) introducing the function $$\frac{(\log z-i(\pi/2))^2}{z^2+1}.$$ and considering the branch cut for the logarithm function on the negative semiaxis of the immaginary numbers and an upper half-circle indented at 0 as integration contour. I tried a different method, but unfortunately I obtained a different result and I don't know why. I consider the branching axis of the logarithm function as the positive real semiaxis. I tried as integration contour this closed curve. I used the complex function $$f(z)=\frac{\log^3z}{z^2+1}$$ obtaining $$\int_r^{R} \frac{\log^3 x}{x^2+1}\;dx + \int_\Gamma \frac{\log^3 z}{z^2+1}\;dz - \int_r^{R} \frac{(\log x+2\pi i)^3}{x^2+1}\;dx - \int_\gamma \frac{\log^3 z}{z^2+1}\;dz.$$ It is easy to see that integrals over circular paths $\gamma$ and $\Gamma$ tend to zero when $R\to \infty,r\to 0$. So we have to evaluate $$\int_r^{R} \frac{\log^3 x}{x^2+1}\;dx - \int_r^{R} \frac{(\log x+2\pi i)^3}{x^2+1}\;dx,$$ which immaginary part is (EDIT: changed $8\pi i$ to $8\pi^3 i$ ) $$-6\pi i \int_r^{R} \frac{\log^2 x}{x^2+1}\;dx + 8\pi^3 i \int_r^{R} \frac{1}{x^2+1}\;dx,$$ that has to be equal to the immaginary part of $$2\pi i\;\left( \mathrm{Res} \left[f,i \right] + \mathrm{Res}\left[f,-i \right]\right) = -i \frac{\pi^4}{4}.$$ So, doing the rest of the work, finally I found that the result is $\frac{17\pi^3}{24}$, that is clearly different from $\frac{\pi^3}{8}$... but where is the flaw in my argument? Please help

-
isn't the value of this integral 0 ? –  Santosh Linkha Jan 19 '13 at 16:05
@experimentX: of course, you are right. I changed the function to integrate at the top of the page, now logarithm is squared. Sorry for the enormous typo. –  Flast9 Jan 19 '13 at 16:28
still, i can't solve it, here is an example of it. I would like to see it's solution, and the reason why the multiple of $\log x$ is taken. –  Santosh Linkha Jan 19 '13 at 16:29
It should be $12\pi^2 i\int_r^R$, not $8\pi i\int_r^R$. –  mrf Jan 19 '13 at 17:11
@mrf: why? However, I turned the value $8\pi i$ into the correct $8\pi^3 i$ –  Flast9 Jan 19 '13 at 17:34
show 1 more comment

The error is where you get $$2\pi i\;\left( \mathrm{Res} \left[f,i \right] + \mathrm{Res}\left[f,-i \right]\right) = -i \frac{\pi^4}{4}.$$ If you use $\arg{i}=\frac{\pi}{2}$ then you must have $\arg(-i)=\frac{3\pi}{2}$ instead of $\arg(-i)=-\frac{\pi}{2}$, since you must use the same branch of the logarithm all through.
Taking this into account, we instead get $$2\pi i\;\left( \mathrm{Res} \left[f,i \right] + \mathrm{Res}\left[f,-i \right]\right) = \frac{13i\pi^4}{4}.$$