<s>[INST] Evaluate $\int_0^\infty \frac{x^2}{x^4 + 6x^2 + 13}dx$ In the context of the residue theorem, I have this integral to evaluate. The function is even, and $|\int_0^\pi\frac{R^2e^{2i\theta}iRe^{i\theta}}{R^4e^{4i\theta}+6R^2e^{2i\theta} + 13}d\theta| \leq \int_0^\pi2\frac{R^3}{R^4}d\theta \to 0$, so the problem is to find the residues in the upper halfplane.
$\int_0^\infty\frac{x^2}{x^4 + 6x^2 + 13}dx = \frac12\int_{-\infty}^\infty\frac{x^2}{x^4 + 6x^2 + 13}dx = \pi i\sum_{\{\Im z > 0\}}$res$(\frac{x^2}{x^4 + 6x^2 + 13})$
There are two residues to calculate:


*

*$z = \sqrt{-3 + 2i}$: $\frac{\sqrt{-3 + 2i}}{4(-3+ 2i) + 12} = -\frac i8\sqrt{-3 + 2i}$

*$z = \sqrt{-3 - 2i}: \frac i8\sqrt{-3 - 2i}$
(Wolfram Alpha if you don't want to trust me)
Giving me overall for the integral:
$\frac\pi8 (\sqrt{-3 + 2i} - \sqrt{-3 - 2i}) =  $1.427346... i
But the answer is clearly not meant to be imaginary.
 [/INST] You need both square-roots in the upper half-plane.  The difference between those two square-roots is real.
</s>