How to simplify the result I obtain for the following integral: $\int_0^\infty \frac{\cos(a x)}{x^4+b^4}\,dx$ I have been trying to calculate the following integral using the Residue Theorem but end up with an answer that seems to contain an imaginary part while the integral should be purely real:
$$I_1=\int_0^\infty \frac{\cos(a x)}{x^4+b^4}\,dx$$
In order to calculate this integral, I consider the contour integral
$$I_2=\int_C \frac{e^{iaz}}{z^4+b^4}\,dz$$
Where $C$ is the semi-circle of radius $R$ in the upper half plane parameterized counter-clockwise. As $R\to\infty$, the semi-circular integral vanishes, and a symmetry argument shows that $I_1=I_2/2$. 
Now, we can use the Residue Theorem to compute $I_2$, which has poles at $z=be^{i\pi/4}$ and $z=be^{3i\pi/4}$. After some computations, I obtain 
\begin{align}I_1&=\frac{\pi i}{4b^3} \left( e^{-3\pi ab /4}e^{-i\pi/4}+e^{-\pi ab /4}e^{-3i\pi/4}  \right)\\
&=\frac{\pi i}{4b^3} \left( e^{-3\pi ab /4}e^{-i\pi/4}-ie^{-\pi ab /4}e^{-i\pi/4}  \right) \\
&=\frac{\pi i}{4b^3} e^{-i\pi/4}\left( e^{-3\pi ab /4}-ie^{-\pi ab /4}  \right) \\
&=\frac{\pi}{4b^3} e^{i\pi/4}\left( e^{-3\pi ab /4}-ie^{-\pi ab /4}  \right) \\
\end{align}
Now, it seems that unless $a=0$ ( and $b=0$, but at that point the integral is undefined), there will always be a non-zero imaginary part, which shouldn't occur because, as I said earlier, the integrand is purely real and is being integral on a real interval. I noted that there was an interesting symmetry in the exponentials, but haven't found a way to use that.
I thought that it was possible that a mistake related to phase occurred, but I wouldn't be sure where.
Any ideas?  
 A: Alright, I found an entirely real answer which agrees with Winther's comment. I originally made a mistake when calculating my residues. Here we go:
\begin{align}
I_2&= 2\pi i \sum \text{Res}_{\text{Im(}z)\ge 0 } \,f(z) \\
&= \frac{2\pi i}{4b^3}\left(\frac{e^{iabe^{3\pi i/4}}}{e^{i\pi /4}} + \frac{e^{iabe^{\pi i/4}}}{e^{3i\pi /4}} \right) \\
&= \frac{2\pi i}{4b^3}\left(e^{iab\left(-\frac{\sqrt{2}}{2}+i\frac{\sqrt{2}}{2}\right)-\frac{i\pi}{4}} + e^{iab\left(\frac{\sqrt{2}}{2}+i\frac{\sqrt{2}}{2}\right)-\frac{3i\pi}{4}} \right) \\
&=\frac{2\pi i}{4b^3}e^{-\frac{ab}{\sqrt{2}}} \left( e^{-i\left[\frac{ab}{\sqrt{2}} +\frac{\pi}{4}\right]}+ e^{i\left[\frac{ab}{\sqrt{2}} -\frac{3\pi}{4}\right]} \right) \\
&=\frac{2\pi i}{4b^3}e^{-\frac{ab}{\sqrt{2}}} \left( e^{-i\left[\frac{ab}{\sqrt{2}} +\frac{\pi}{4}\right]}- e^{i\left[\frac{ab}{\sqrt{2}} +\frac{\pi}{4}\right]} \right) \\
&=\frac{2\pi i}{4b^3}e^{-\frac{ab}{\sqrt{2}}} \left( -2 i\sin \left(\frac{ab}{\sqrt{2}} +\frac{\pi}{4}\right) \right) \\
&= \frac{\pi}{b^3} e^{-\frac{ab}{\sqrt{2}}}\sin \left(\frac{ab}{\sqrt{2}} +\frac{\pi}{4}\right)
\end{align}
using $I_1=I_2/2$ and demanding that $I(a)=I(-a)$ and $I(b)=I(-b)$, we finally obtain
$$I_1=\frac{\pi}{2b^3} e^{-\frac{|ab|}{\sqrt{2}}}\sin \left(\frac{|ab|}{\sqrt{2}} +\frac{\pi}{4}\right)$$
A: Not really an answer, just making things as compact as possible
First of all note that $$e^{i\pi/4}=\frac{1+i}{\sqrt2}$$
Hence
$$I_1=\frac{\pi(1+i)}{4b^3\sqrt2}\bigg(\frac1{e^{3ab\pi/4}}-\frac{i}{e^{ab\pi/4}}\bigg)$$
Multiplying the RHS by $\frac{\exp(ab\pi/4)}{\exp(ab\pi/4)}$,
$$I_1=\frac{\pi(1+i)}{4b^3e^{ab\pi/4}\sqrt2}\bigg(e^{\frac{ab\pi}4(1-3)}-ie^{\frac{ab\pi}4(1-1)}\bigg)$$
$$I_1=\frac{\pi(1+i)}{b^3e^{ab\pi/4}2^{5/2}}(e^{-ab\pi/2}-i)$$
Now let $$p=\frac\pi{b^3e^{ab\pi/4}2^{5/2}}\\ q=e^{-ab\pi/2}$$
So 
$$I_1=p(1+i)(q-i)$$
Thus
$$I_1=p(1+q)+ip(1-q)$$
So now you have a distinct real and imaginary part. I guess you have to make more assumptions about the restrictions on $a$ and $b$ if you want $\text{Im}I_1=0$. Either that or you made a mistake.
