Solve $\int_{-\infty}^{\infty}\frac{x^3\sin(x)}{x^4+16}dx$ using contour integration I have $$\int_{-\infty}^{\infty}\frac{x^3\sin(x)}{x^4+16}dx = \pi e^{-\sqrt{2}}\cos(\sqrt{2})$$ and have been asked to show this using contour integration.
I have chosen the semicircular contour along the real axis from -R to R with the semicircle above the real axis. I have also made $$f(z)=\frac{z^3e^{iz}}{z^4+16}$$
I have found there to be poles at $$z=2e^{\frac{i\pi}{4}(1+2k)},\qquad k=0,1,2,3$$
And have tried showing that the integral across my contour is equal to $$2\pi i (res(f,2e^{\frac{\pi i}{4}})+res(f,2e^{\frac{3\pi i}{4}}))$$
Is this the correct choice of contour as I am having a lot of difficulty calculating the value of the residues? If it is the correct choice, how can we calculate the residues' values?
 A: Suppose we seek to evaluate
$$\int_{-\infty}^\infty \frac{x^3\sin x}{x^4+16} dx$$
which is
$$\Im \int_{-\infty}^\infty \frac{x^3 \exp(ix)}{x^4+16} dx$$
using
$$f(z) = \frac{z^3 \exp(iz)}{z^4+16}$$
and integrating along  a semicircular contour in the  upper half plane
consisting  of a  semicircle $\Gamma_1$  of radius  $R$ and  a segment
$\Gamma_2$ on the real axis.

Following  standard  procedure  we  parameterize  the  integral  along
$\Gamma_1$ as $R\exp(i\theta)$ with $0\le\theta\le\pi$ to get
$$\left|\int_{\Gamma_1} \frac{z^3 \exp(iz)}{z^4+16} \; dz\right|
\le \frac{R^3}{R^4-16} \int_0^{\pi} |\exp(iR\exp(i\theta))|
\times |Ri \exp(i\theta)|\; d\theta
\\ = \frac{R^4}{R^4-16} \int_0^{\pi} |\exp(iR\exp(i\theta))|
\; d\theta .$$
Now using the symmetry of the sine and the bound for $0\le x\le \pi/2$
$$\sin x \ge \frac{2}{\pi} x$$
and
$$|\exp(i R \exp(i\theta))| = 
|\exp(i R\cos\theta - R\sin\theta)| = \exp(-R\sin\theta).$$
we get for the remaining integral
$$\int_0^{\pi} \exp(-R\sin\theta)\; d\theta 
\lt 2\int_0^{\pi/2} \exp(-R\theta 2/\pi) \; d\theta
= -2\left[\frac{\pi}{2R} \exp(-R\theta 2/\pi)\right]_0^{\pi/2}
\\ = \frac{\pi}{R} (1-\exp(-R)).$$
This yields for the integral along $\Gamma_1$ the bound
$$\frac{\pi R^3}{R^4-16} (1-\exp(-R))
\rightarrow 0
\quad\text{as}\quad R\rightarrow \infty.$$
This vanishes as $R$ goes to infinity.
It remains to sum the residues.
The poles are at $\rho_k$ with $0\le k\lt 4$
$$\rho_k = 2 \exp(i\pi /4 + \pi i k/2).$$
and we see that only $\rho_{0,1}$ are in the upper half plane.
 We get
$$\mathrm{Res}_{z=\rho_{0,1}} f(z)
= \left. \frac{z^3 \exp(iz)}{4z^3}\right|_{z=\rho_{0,1}}
= \left. \frac{1}{4} \exp(iz)\right|_{z=\rho_{0,1}}.$$
This yields for the complex integral the value
$$2\pi i \times \frac{1}{4} 
(\exp(2i\exp(i\pi/4))+\exp(2i\exp(3i\pi/4))
\\ = 2\pi i \times \frac{1}{4} 
(\exp(\sqrt{2}i(1+i))+\exp(\sqrt{2}i(-1+i)))
\\ = 2\pi i \times \frac{1}{4} 
(\exp(-\sqrt{2} + \sqrt{2}i)+\exp(-\sqrt{2} - \sqrt{2}i))
\\ = \pi i \times \frac{1}{2} \exp(-\sqrt{2}) 
(\exp(\sqrt{2}i)+\exp(- \sqrt{2}i))
\\ = \pi i \times \exp(-\sqrt{2}) \cos(\sqrt{2}).$$
Extracting the imaginary part we finally obtain
$$\pi \exp(-\sqrt{2}) \cos(\sqrt{2}).$$
This computation was essentially the same as this 
MSE link.
