# Calculate $\int_{-\infty}^\infty\frac{x\cos(x)}{i+x^3} \,\mathrm{d}x$

I have to calculate the integral

$$I = \int_{-\infty}^\infty\frac{x\cos(x)}{i+x^3} \,\mathrm{d}x.$$

My first thought was to use semicircular contour in the upper half-plane (calculated residue and multiplied by $2i\pi$); prove that integral over semicircle is zero when R->$\infty$; then take the limit

$$\lim_{R \to \infty}\int_{-R}^R\frac{ze^{iz}}{i+z^3} \,\mathrm{d}z = \int_{-\infty}^\infty\frac{ze^{iz}}{i+z^3} \,\mathrm{d}z;$$

and finally take the imaginary part of the integral. But then I figured I can't do that because I have i in the denominator.

I also tried writing cosx using e and then split the integral, calculated over two semicircles (positive direction in upper half-plane and negative in lower), added the two results and got something that looked kinda similar to the correct result.

What's the right way to solve this? Can I even use a semicircle or should I use a rectangle?

$\large\mathbf{Hint}$:
Roots of $\displaystyle z^{3} + \mathrm{i} = 0$ are given by $\displaystyle z^{3} = -\mathrm{i} = \mathrm{e}^{-\mathrm{i}\pi/2 + 2n\pi\mathrm{i}}\,,\quad n \in \mathbb{Z} \implies z_{n} = \mathrm{e}^{\left(-\mathrm{i}\pi/2 + 2n\pi\mathrm{i}\right)/3}$. So, you have three roots: $$z_{-1} = \mathrm{e}^{-5\pi\mathrm{i}/6}\,,\quad z_{0} = \mathrm{e}^{-\pi\mathrm{i}/6}\,,\quad z_{1} = \mathrm{e}^{\pi\mathrm{i}/2} = {\large\color{red}{\mathrm{i}}}$$