Evaluate $\int_{0}^{\pi} x\sin\big(\frac{1}{x}\big)\cos x \,dx$ I wonder if an integral of the form $$\int_{0}^{\pi} x\sin\Bigl(\frac{1}{x}\Bigr)\cos x \,dx$$ which can be further simplified to
$$\int_{0}^{\pi} \frac{\sin (x^{-1})}{(x^{-1})}\,\cos x\, dx=\cos x\biggl(\int_{0}^{\pi} \frac{\sin (x^{-1})}{(x^{-1})}\,dx\biggr)\Bigg|_{0}^{\pi}+\int_{0}^{\pi}\sin x \bigg(\int \frac{\sin (x^{-1})}{(x^{-1})}dx\bigg)dx$$ 
will have an explicit form. One simplifies the integral
$$\int_{0}^{\pi} \frac{\sin (x^{-1})}{(x^{-1})}dx=\int_{0}^{\pi} \int_{0}^{\infty}e^{-(x^{-1}t)}\sin (x^{-1})\,dx\,dt$$
where we know that $\int_{0}^{\infty}e^{-xt}dt=\frac{1}{x}$.
We also know that $$\int_{0}^{\infty}e^{-(xt)}\sin (x)\,dx=\frac{1}{t^2+1}.$$
Any idea on how to compute 
$$\int_{0}^{\infty}e^{-(x^{-1}t)}\sin (x^{-1})\,dx?$$
 A: With regard to the last definite integral, I do not think that we can compute it because of the singularities.
However, what is "amazing" is that the antiderivative does exist (given by a CAS)
$$\int e^{-\frac{t}{x}} \sin \left(\frac{1}{x}\right)\,dx=-\frac{1}{2} i e^{-\frac{t+i}{x}} \left(e^{\frac{t+i}{x}} \left((t-i)
   \text{Ei}\left(-\frac{t-i}{x}\right)-(t+i)
   \text{Ei}\left(-\frac{t+i}{x}\right)\right)+\left(-1+e^{\frac{2 i}{x}}\right)
   x\right)$$
A: NOT THE SOLUTION:
DAMN, I just got to the of the solution as below and realised I had the bounds wrong the whole time - Thought I would leave in case you're interested! 
Here we are addressing the integral:
\begin{equation}
 I = \int_0^\infty x \sin\left(\frac{1}{x}\right)\cos(x)\:dx
\end{equation}
Here we will employ Feynman's Trick and introduce a new function with two variables:
\begin{equation}
 J(a,b) = \int_0^\infty x \sin\left(\frac{a}{x}\right)\cos(bx)\:dx
\end{equation}
We see that $J(1,1) = I$. Now $\frac{\partial}{\partial b}\sin(bx) = x\cos(bx)$ and so, 
\begin{equation}
 J(a,b) = \int_0^\infty x \sin\left(\frac{a}{x}\right)\cos(bx)\:dx = \int_0^\infty \sin\left(\frac{a}{x}\right)\cdot x\cos(bx)\:dx = \int_0^\infty \sin\left(\frac{a}{x}\right)\cdot\frac{\partial}{\partial b}\sin(bx)\:dx
\end{equation}
By using Leibniz's Integral Rule we find:
\begin{equation}
 J(a,b) = \int_0^\infty \sin\left(\frac{a}{x}\right)\cdot\frac{\partial}{\partial b}\sin(bx)\:dx = \frac{\partial}{\partial b}  \underbrace{\int_0^\infty \sin\left(\frac{a}{x}\right)\sin(bx)\:dx}_{H(a,b)}
\end{equation}
We now will address $H(a,b)$. To proceed we employ Fubini's Theorem and take the Laplace Transform with respect to $a$:
\begin{align}
 \mathscr{L}_{a \rightarrow s} \left[H(a,b)\right] &= \int_0^\infty  \mathscr{L}_{a \rightarrow s} \left[\sin\left(\frac{a}{x}\right)\right]\sin(bx)\:dx = \int_0^\infty \frac{\frac{1}{x}}{s^2 + \left(\frac{1}{x}\right)^2}\cdot \sin(bx)\:dx \\
&= \int_0^\infty \frac{x}{s^2x^2 + 1}\cdot \sin(bx)\:dx
\end{align}
We now use the same trick from before: $ \frac{\partial}{\partial b}  -\cos(bx) = x\sin(bx) $. Thus, 
\begin{align}
 \mathscr{L}_{a \rightarrow s} \left[H(a,b)\right] &= -\frac{\partial}{\partial b} \int_0^\infty \frac{\cos(bx)}{s^2x^2 + 1}\:dx
\end{align}
Or 
\begin{align}
 H(a,b)  &= -\frac{\partial}{\partial b}\left( \mathscr{L}_{s \rightarrow a}^{-1} \left[\int_0^\infty \frac{\cos(bx)}{s^2x^2 + 1}\:dx\right]\right)
\end{align}
Or, in terms of $J(a,b)$
\begin{align}
 J(a,b)  &= \frac{\partial}{\partial b} H(a,b) = -\frac{\partial^2}{\partial b^2}\left( \mathscr{L}_{s \rightarrow a}^{-1} \left[\int_0^\infty \frac{\cos(bx)}{s^2x^2 + 1}\:dx\right]\right)
\end{align}
We now need only address the much simpler integral (below) and then taken it's inverse Laplace Transform: 
\begin{equation}
K(a,b) = \int_0^\infty \frac{\cos(bx)}{s^2x^2 + 1}
\end{equation}
Here we again use Fibini's Theorem and take the Laplace Transform with respect to $b$:
\begin{align}
\mathscr{L}_{b \rightarrow w} \left[ K(a,b) \right] &= \int_0^\infty \frac{\mathscr{L}_{b \rightarrow w} \left[ \cos(bx) \right]}{s^2x^2 + 1} = \int_0^\infty \frac{1}{s^2x^2 + 1} \cdot \frac{w}{w^2 + x^2}\:dx \\
&= \frac{w}{s^2w^2 - 1} \int_0^\infty \left[\frac{s^2}{s^2 x^2 + 1} - \frac{1}{w^2 + x^2 } \right]\:dx =  \frac{w}{s^2w^2 - 1} \left[s\arctan(sx) - \frac{1}{w}\arctan\left(\frac{x}{w}\right)\right]_0^\infty \\
&= \frac{w}{s^2w^2 - 1}\left[ s\cdot\frac{\pi}{2} - \frac{1}{w} \cdot \frac{\pi}{2}  \right] = \frac{sw - 1}{s^2w^2 - 1} \cdot \frac{\pi}{2} = \frac{\pi}{2\left(sw + 1\right)}
\end{align}
We now take the Inverse Laplace Transform with respect to $w$ to resolve $K(s,b)$:
\begin{align}
K(s,b) &= \mathscr{L}_{w \rightarrow b}^{-1} \left[ \frac{\pi}{2\left(sw + 1\right)} \right] = \frac{\pi}{2s}e^{-\frac{b}{s}}
\end{align}
From here we can now address J(a,b) 
\begin{align}
 J(a,b)  &= \frac{\partial}{\partial b} H(a,b) = -\frac{\partial^2}{\partial b^2}\left( \mathscr{L}_{s \rightarrow a}^{-1} \left[ K(s,b) \right] \right)  = -\frac{\partial^2}{\partial b^2}\left( \mathscr{L}_{s \rightarrow a}^{-1} \left[\frac{\pi}{2s}e^{-\frac{b}{s}} \right] \right) = -\frac{\partial^2}{\partial b^2} J_{0}\left(2\sqrt{ab} \right) \\
&= -\frac{\pi}{4b}\left[t\left( J_{0}\left(2\sqrt{ab} \right) +  J_{2}\left(2\sqrt{ab} \right) \right) - \frac{ J_{1}\left(2\sqrt{ab} \right)}{\sqrt{b}}  \right]
\end{align}
Where $J_{\alpha}(x)$ is the Modified Bessel Function. From here we now need only let $a,b = 1$ to solve $I$
\begin{equation}
I = J(1,1) = -\frac{\pi}{4\cdot 1}\left[t\left( J_{0}\left(2\sqrt{1\cdot 1} \right) +  J_{2}\left(2\sqrt{1\cdot 1} \right) \right) - \frac{ J_{1}\left(2\sqrt{1\cdot 1} \right)}{\sqrt{b}}  \right] = -\frac{\pi}{4}\big[J_0(2) + J_2(2) - J_1(2)\big]
\end{equation}
Thus, 
\begin{equation}
  \int_0^\infty x \sin\left(\frac{1}{x}\right)\cos(x)\:dx = -\frac{\pi}{4}\big[J_0(2) + J_2(2) - J_1(2)\big]
\end{equation}

In fact, we we can go further using this method and have:
\begin{align}
 J_p(a,b)  =  \int_0^\infty x^{2p + 1} \sin\left(\frac{a}{x}\right)\cos(bx)\:dx = (-1)^{p + 1} \frac{\partial^{2p + 2}}{\partial b^{2p + 2}} J_{0}\left(2\sqrt{ab} \right) \\
\end{align}
