Evaluating $\int^\infty_0 \frac{x^2 \cos x}{(x^2+1)(x^2+9)}dx$ I pick the contour to be, for a fixed $R>3$, $\gamma =[-R,R] \cup \{|z| = R : Imz > 0\}$
I have already evaluated the integral over $\gamma$, but I am stuck evaluating the integral over {|z| = R : Imz > 0}. I tried parameterizing but I get a messy integral I can't find a way to compute or even bound. I end up with
$$iR^3\int^\pi_0 \frac{e^{3i\theta}\cos(e^{i\theta})}{(e^{2i\theta}+1)(e^{2i\theta}+9)}d\theta $$
Again I don't see a way to bound either from above or below or how to compute. Pointers would be appreciated.
UPDATE: I meant to write $cosx$ in the original problem, not $sinx$! Whoops.
 A: The integral that you have to bound is $\int_{\Gamma_R}\frac{z^2 e^{iz}}{(z^2+1)(z^2+9)}dz=iR^3\int_{0}^{\pi}\frac{e^{2i\theta}e^{Rie^{i\theta}}}{(R^2e^{2i\theta}+1)(R^2e^{2i\theta}+9)}d\theta$
Now We use the estimation lemma so
$$|iR^3\frac{e^{2i\theta}e^{Rie^{i\theta}}}{(R^2e^{2i\theta}+1)(R^2e^{2i\theta}+9)}|\leq\frac{R^3e^{-R\sin\theta}}{(R^2-1)(R^2-9)}$$ so
$$|iR^3\int_{0}^{\pi}\frac{e^{2i\theta}e^{Rie^{i\theta}}}{(e^{2i\theta}+1)(e^{2i\theta}+9)}d\theta|\leq\frac{\pi R^3}{(R^2-1)(R^2-9)}\to 0$$ as $R\to \infty$
I have used the fact that
$$0\leq R^2-1=|R^2e^{2i\theta}|-|-1|\leq|R^2e^{2i\theta}+1|$$
A: Since the title of the question is to evaluate a particular integral, let me discuss how to find the value of that particular integral. I cannot see how the contour presented above can aid in the solution of said integral, since the integrand is odd and hence it's integral over the real line vanishes identically. That being said, the solution I am sharing below mostly requires real analysis (although some complex analysis is involved).
First note that the integral can be decomposed into two simpler integrals by virtue of the partial fraction decomposition
$$\frac{x^2}{(x^2+r^2)(x^2+s^2)}=\frac{r^2}{r^2-s^2}\frac{1}{x^2+r^2}-\frac{s^2}{r^2-s^2}\frac{1}{x^2+s^2}$$
so we will consider the simpler integral
$$\int_0^\infty\frac{e^{iax}}{x^2+b^2}dx:=C(a,b)+iS(a,b)~~,~~ a>0$$
and we seek to evaluate the imaginary part. Considering a contour in the shape of a quartercircle in the 1st quadrant of radius $R>b$ and making sure to indent the positive imaginary axis part of the contour to avoid the pole at $x=ib$, we obtain after some basic residue calculus that
$$C(a,b)+iS(a,b)=\frac{\pi e^{-ab}}{2b}+iPV\int_0^\infty dt\frac{e^{-at}}{b^2-t^2}$$
We see that $C(a,b)$ has a very simple analytic form and indeed this integral is the one that is more amenable to complex analytic arguments, whilst $S(a,b)$ is it's more stubborn cousin that requires more advanced techniques. The advantage of this representation of $S$ is it's exponential converge at infinity, which makes it more amenable to various expansion techniques. Here, one can take the Laplace transform in the $a$ variable as follows
$$\mathcal{L}_a(S(a,b)):=\hat{S}(s,b)=PV\int_0^\infty\frac{dt}{(b^2-t^2)(t+s)}$$
Using the antiderivative of the integrand
$$\int \frac{dt}{(b^2-t^2)(t+s)}=\frac{1}{2(s-1)}\ln|1+t|-\frac{1}{2(s+1)}\ln|1-t|-\frac{1}{s^2-1}\ln|t+s|$$
we can carefully evaluate the principal value to obtain
$$\hat{S}(s,b)=\frac{\ln(s/b)}{s^2-b^2}$$
(Note: The Laplace transform could have been applied to the original form of the integral for the same result)
To invert the Laplace transform note that it can be written in the form
$$\hat{S}(s,b)=\frac{1}{b^2}\frac{\ln(s/b)}{(s/b)}\frac{s/b}{(s/b)^2-1}$$
Now using the easily derived formulas
$$\mathcal{L}(\cosh x)=\frac{s}{s^2-1}\\\mathcal{L}(-\gamma-\ln x)=\frac{\ln s}{s}$$
and the scaling properties of LT we find that
$$\hat{S}(s,b)=\mathcal{L}(\cosh bx)\mathcal{L}(-\gamma-\ln bx)$$
and finally, applying the convolution theorem we find
$$S(a,b)=-\int_0^a d\tau(\gamma+\ln b\tau)\cosh(b(a-\tau))=-\gamma\frac{\sinh ab}{b}-\frac{1}{b} \int_0^{ab}dx \ln x\cosh(ab-x)$$
The last integral can be expressed in terms of certain special functions since:
$$\int_0^t\ln x~ e^{-x} dx=-\gamma-e^{-t}\ln t-E_1(t)$$
$$\int_0^t\ln x~ e^{x} dx=\gamma+e^t\ln t-\text{Chi}(t)-\text{Shi}(t)$$
$$E_1(t)=\int_t^\infty \frac{e^{-x}}{x}dx~~,~~\text{Shi}(t)=\int_0^t\frac{\sinh x}{x}dx~~,~~\text{Chi}(t)=\gamma+\ln t+\int_0^t\frac{\cosh x-1}{x}dx$$
Hence we get
$$\int_0^{t}dx \ln x\cosh(t-x)=-\gamma \sinh t+\frac{1}{2}(-e^t E_1(t)-e^{-t}\text{Chi}(t)-e^{-t}\text{Shi}(t))$$
and finally
$$S(a,b)=\frac{1}{2b}(e^{ab} E_1(ab)+e^{-ab}\text{Chi}(ab)+e^{-ab}\text{Shi}(ab))=\frac{e^{ab}\text{Ei}(-ab)-e^{-ab}\text{Ei}(ab)}{2b}$$
With all this in place, the expression for the original integral posed in the question is
$$\int_0^\infty\frac{x^2\sin x}{(x^2+1)(x^2+9)}dx=\frac{1}{8} S(1,1)-\frac{9}{8}S(1,3)\\=\frac{1}{16}\left(e\text{Ei}(-1)-\frac{1}{e}\text{Ei}(1)\right)-\frac{3}{16}\left(e^3 \text{Ei}(-3)-\frac{1}{e^3}\text{Ei}(3)\right)$$
confirming the CAS result in the other answer.
A: Without contour integration
$$\frac{x^2 }{(x^2+1)(x^2+9)}=\frac{i}{16
   (x-i)}-\frac{i}{16 (x+i)}-\frac{3 i}{16 (x-3 i)}+\frac{3 i}{16 (x+3 i)}$$ We then face four integrals
$$I_k=\int \frac {\sin(x)}{x+i~k } \,dx=\int \frac {\sin(t-i~k)}{t} \,dt=\cosh (k) \int\frac{\sin (t)}{t}dt-i \sinh (k)\int\frac{ \cos (t)}{t}dt$$
$$I_k=\cosh (k)\, \text{Si}(t)-i\,\sinh (k)\, \text{Chi}(i t) $$
$$J_k=\int_0^\infty \frac {\sin(x)}{x+i~k } \,dx=i \text{Ci}(i k) \sinh (k)+\frac{1}{2} (\pi -2 i \text{Shi}(k)) \cosh (k)$$ Using exponential integrals functions
$$\int^\infty_0 \frac{x^2 \sin x}{(x^2+1)(x^2+9)}dx=\frac{3 \text{Ei}(3)-3 e^6 \text{Ei}(-3)+e^4 \text{Ei}(-1)-e^2 \text{Ei}(1)}{16
   e^3}$$
