My teacher showed in class that starting with $\int_{-\infty}^{\infty} e^{inx}g(x)dx$ for an even function $g(x)$ we have $$\int_{0}^{\infty} \cos(nx)g(x)dx=\pi i\sum \operatorname{Res}\left( f(z)\right)$$
and for an odd function $g(x)$: $$\int_{0}^{\infty} \sin(nx)g(x)dx=\pi \sum \operatorname{Res} \left(f(z)\right)$$
with $n>0$, $f(z)=e^{inz}g(z)$ and $\lim\limits_{z\to\infty}g(z)=0$
However, when he tried to do an example, by mistake he forgot to add an $x$ in the numerator and left it as $$\int_{0}^{\infty} \frac{\sin(4x)}{x^2+4}dx$$
and added the $x$ later. While
$$\int_{0}^{\infty} \frac{x\sin(4x)}{x^2+4}dx$$
is not that hard to evaluate, many solutions are found here
I tried to do the first one when I got home, but the methods that I learned until now were unsuccessful. Can I get some help on how to evaluate $I=\int_{0}^{\infty} \frac{\sin(4x)}{x^2+4}dx$ please?
If we set $F(a)=\int_{0}^{+\infty}\frac{\sin(ax)}{x^2+1}\,dx$ we have $$ (\mathcal{L} F)(b) = \int_{0}^{+\infty}\int_{0}^{+\infty}\frac{\sin(ax) e^{-ab}}{x^2+1}\,dx \,da =\int_{0}^{+\infty}\frac{x\,dx}{(x^2+b^2)(x^2+1)}=\frac{\log b}{b^2-1}$$ hence $F(a)$ is given by the inverse Laplace transform of $\frac{\log b}{b^2}+\frac{\log b}{b^4}+\frac{\log b}{b^6}+\ldots$, i.e. by $$ \sum_{n\geq 0} \frac{a^{2n+1}}{(2n+1)!}\left(H_{2n+1}-\gamma-\log(a)\right) $$ and $$ \int_{0}^{+\infty}\frac{\sin x}{x^2+1}\,dx = \sum_{n\geq 0}\frac{H_{2n+1}-\gamma}{(2n+1)!} $$ is rather non-elementary (related to the exponential integral) but pretty simple to approximate numerically.