# Evaluating $\int_0^\infty dx /{(x^2-a^2)^2+b^4}$ returns a negative number

I am trying to evaluate $\int_0^\infty dx /((x^2-a^2)^2+b^4)$. And I seem to have an error that I cannot detect. Using

 Simplify[Integrate[1/((x^2 - a^2)^2 + b^4), {x, 0, Infinity}], a > 0 && b > 0]


I get

 ConditionalExpression[-((I \[Pi])/(2 Sqrt[a^4 + b^4] (Sqrt[a^2 - I b^2] + Sqrt[a^2 + I b^2]))), Im[Sqrt[a^2 + I b^2]] > 0 && Im[Sqrt[a^2 - I b^2]] > 0]


I assume this to mean: Take the roots with positive imaginary parts of $\sqrt{a^2+ib^2}$ and $\sqrt{a^2-ib^2}$. In other words, the value of $$-i\pi \over {2\sqrt{a^4+b^4} (\sqrt{a^2+ib^2} +\sqrt{a^2-ib^2})}$$ with a positive pure imaginary in the denominator.

But this implies the integral becomes negative, which it is not. Where is my error?!

To get a simpler form

f[a_, b_] =Assuming[a > 0 && b > 0, Integrate[
1/((x^2 - a^2)^2 + b^4), {x, 0, Infinity}] //
ComplexExpand[#, TargetFunctions -> {Re, Im}] & //
Simplify]


Plot3D[f[a, b], {a, -5, 5}, {b, -6, 6},
ClippingStyle -> None]


The problem appears to be that Mathematica assumes certain values for a and b so that it can use a particular expression to obtain the result. This is not (necessarily) consistent with the assumptions that you supply for Simplify.

The solution is to supply the assumptions around the integral, so that they can be accounted for there. I believe that the following gives a credible result:

Assuming[a > 0 && b > 0, FullSimplify[Integrate[1/((x^2 - a^2)^2 + b^4), {x, 0, Infinity}]]] // InputForm


returning

((-I/4)*(1/Sqrt[-a^2 - I*b^2] - 1/Sqrt[-a^2 + I*b^2])*Pi)/b^2


Or

Integrate[1/((x^2 - a^2)^2 + b^4), {x, 0, Infinity}, Assumptions -> {a > 0, b > 0}]