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!
 A: Firstly, recognize that you integral $I$ equals
$$2I=\int^\infty_{-\infty}\frac{z^3\sin z}{(z^2+4)(z^2+16)}dz=\text{Im} \int^\infty_{-\infty}\frac{z^3e^{iz}}{(z+2i)(z-2i)(z+4i)(z-4i)}dz $$
Taking a semi-circle on the upper half plane as contour, by residue theorem:
$$\int^\infty_{-\infty}+\int_{arc}=2\pi i(Res_{2i}+Res_{4i})$$
$$Res_{2i}=\frac{-8i e^{-2}}{4i\cdot6i\cdot-2i}=\frac{-1}{6e^2}$$
$$Res_{4i}=\frac{-i64 e^{-4}}{6i\cdot2i\cdot8i}=\frac2{3e^4}$$
Obviously, the arc integral vanishes.
I think you can obtain $I$ easily.
EDIT:
For the arc integral, it is
$$\int_0^\pi e^{iR\cos t}e^{-R\sin t}\frac{iR^4e^{4it}}{R^4e^{4it}+o(R^3)}dt$$
The first term’s magnitude is always $1$.
The third term’s magnitude approaches $1$ as $R\to\infty$.
Note that for $0< t<\pi$, $$\sin t>0\implies e^{-R\sin t}\to 0$$
Therefore we can conclude the integral vanishes in the limit.
A: *

*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})}$$

A: Since you seem to have trouble with calculating the residue part, here's a brief outline on how they're calculated. Obviously, you need to consider when $z=2i$ and when $z=4i$ because they lie inside the contour.
Therefore$$\operatorname*{Res}_{z\, =\, 2i}\frac {z^3e^{iz}}{(z^2+4)(z^2+16)}=\lim\limits_{z\,\to\, 2i}\frac {z^3e^{iz}}{(z+2i)(z^2+16)}=-\frac 1{6e^2}$$$$\operatorname*{Res}_{z\, =\, 4i}\frac {z^3e^{iz}}{(z^2+4)(z^2+16)}=\lim\limits_{z\,\to\,4i}\frac {z^3e^{iz}}{(z^2+4)(z+4i)}=\frac 2{3e^4}$$The contour integral then evaluates to$$\oint\limits_{\mathrm C}dz\,\frac {z^3e^{iz}}{(z^2+4)(z^2+16)}=2\pi i\left(\frac 2{3e^4}-\frac 1{6e^2}\right)=\frac {\pi i(4-e^2)}{3e^4}$$
