<s>[INST] Use residues to evaluate the improper integral $\int_0^\infty\frac{x^3\sin(x)}{(x^2+4)(x^2+16)}dx$ I am trying to solve the below problem using residues, 
$$\int_0^\infty\frac{x^3\sin(x)}{(x^2+4)(x^2+16)}dx$$
This is what I have so far:
Firstly, Change the equation to $z$ as follows
$$f(z)=\frac{z^3}{(z^2+4)(z^2+16)}dz$$
Then, Identify the singularities in the upper half plane - these being $2i$ and $4i$ where $R>4$.
This brings us to the 2 equations:
$$\operatorname*{Res}_{z=2i} [f(z)e^{iz}]=\frac{z^3e^{iz}}{(z+2i)(z^2+16)}\biggr]_{z=2i}$$
and 
$$\operatorname*{Res}_{z=4i} [f(z)e^{iz}]=\frac{z^3e^{iz}}{(z^2+4)(z+4i)}\biggr]_{z=4i}$$
Now when I try to solve each of these equations I am going wrong somewhere and ending up with some ridiculous answer... any help with this would be greatly appreciated!
 [/INST] *

*Note that the residue method refers to the improper integral $\int_{\color{blue}{-\infty}}^\infty\frac{x^3sin(x)}{(x^2+4)(x^2+16)}dx = 2\int_0^\infty\frac{x^3sin(x)}{(x^2+4)(x^2+16)}dx$.

*You then calculate $I =Im(\int_{-\infty}^\infty\frac{z^3}{(z^2+4)(z^2+16)}e^{iz}dz)$.
$$I = 2\pi i (Res_{2i} \frac{z^3}{(z^2+4)(z^2+16)}e^{iz}  + Res_{4i} \frac{z^3}{(z^2+4)(z^2+16)}e^{iz})$$

*Note, that the poles at $z=2i$ and $z=4i$ have order 1.
$$Res_{2i} \frac{z^3}{(z^2+4)(z^2+16)}e^{iz} = \lim_{z\rightarrow 2i} \frac{(z-2i)z^3}{(z-2i)(z+2i)(z^2+16)}e^{iz}= \frac{(2i)^3}{4i((2i)^2+16)}e^{-2} =-\frac{1}{6e^2}$$
$$Res_{4i} \frac{z^3}{(z^2+4)(z^2+16)}e^{iz} = \lim_{z\rightarrow 4i} \frac{(z-4i)z^3}{(z^2+4)(z-4i)(z+4i)}e^{iz}= \frac{(4i)^3}{((4i)^2+4)(8i)}e^{-4} =\frac{2}{3e^4}$$
So, 
$$\int_0^\infty\frac{x^3sin(x)}{(x^2+4)(x^2+16)}dx = Im(\frac{1}{2}2\pi i (-\frac{1}{6e^2} + \frac{2}{3e^4})) =  \boxed{\frac{\pi}{3e^2}(\frac{2}{e^2}-\frac{1}{2})}$$

</s>