Anti-derivative of $\cos (\ln x)$ I'm asked to find the anti-derivative of $\cos (\ln x)$.
Here is my approach :
$$\int \cos (\ln x) \, \mathrm dx$$
$$=\int \dfrac{e^{i\ln x}+e^{-i\ln x}}{2} \, \mathrm dx$$
$$=\int \dfrac{x^i+x^{-i}}{2} \, \mathrm dx$$
Then I get stuck. $\cos (\ln x)$ has an elementary, real-valued anti-derivative. So, how do I get to that now?
Any help would be appreciated.
 A: By parts,
$$\int\cos(\log x)\,dx=x\cos(\log x)+\int \frac xx\sin(\log x)\,dx$$
and 
$$\int\sin(\log x)\,dx=x\sin(\log x)-\int \frac xx\cos(\log x)\,dx.$$
So
$$\int\cos(\log x)\,dx={x \over 2}(\cos(\log x)+\sin(\log x)).$$

Or
$$\int\cos(\log x)\,dx=\int e^t\cos t\,dt=\Re\int e^{(1+i)t}dt=\Re\frac{e^{(1+i)t}}{1+i}=\frac{e^t}2(\cos t+\sin t)
\\=\frac{x}2(\cos (\log x)+\sin  (\log x))$$ 
A: Let $u = \ln x$. Then
$$
du = \frac{1}{x}\ dx
$$
and
$$
dx = x\ du = e^udu.
$$
Now your integral becomes
$$
I = \int \cos(u)\cdot e^u\ du,
$$
which is a very standard example in calculus textbooks and can be evaluated by a common trick: perform integration by parts twice and "solve" for $I$:
$$
\begin{align}
I &= \cos(u)\cdot e^u+\int \sin(u) \cdot e^u\ du\\
  &= \cos(u)\cdot e^u+\sin(u)\cdot e^u-\int \cos(u)\cdot e^u\ du\\
  &=\cos(u)\cdot e^u+\sin(u)\cdot e^u-I,
\end{align}
$$
which implies that
$$
I = \frac12 \left(\cos(u)\cdot e^u+\sin(u)\cdot e^u\right)
 =\frac12 \left(x\cos(\ln x)+x\sin(\ln x)\right).
$$
So you have the answer
$$
\frac12 \left(x\cos(\ln x)+x\sin(\ln x)\right)+C.
$$
A: Substitute $u=\ln\left(x\right)$ thus $\mathrm{d}x=x\,\mathrm{d}u$
$$I={\displaystyle\int}\mathrm{e}^u\cos\left(u\right)\,\mathrm{d}u$$
$$I=e^ucos(u)+\int e^u\sin u \mathrm{d}u$$
$$I=e^ucos(u)+e^u\sin u -\int e^u \cos u \mathrm{d}u$$
$$2I=e^ucos(u)+e^u\sin u$$
$$I=\frac{e^u}{2}(\cos u+\sin u)+C$$
$$I=\frac{x}{2}(\cos \ln x+\sin \ln x)+C$$
A: Ok, because of your calculations we have $$\frac{x^{i+1}}{2(i+1)} - \frac{x^{1-i}}{2(i-1)} = \frac{x^{i+1}(i-1) -x^{1-i}(i+1)}{-4}$$
Now $x^i = \cos(\log(x))+i \sin(\log(x))$ and $x^{-i} = \cos(\log(x))-i \sin(\log(x))$
. Therefore we have $$ \frac{x^{i+1}(i-1) -x^{1-i}(i+1)}{-4} = \frac{x(i-1)(\cos(\log(x))+i \sin(\log(x))) - x(i+1)(\cos(\log(x))-i \sin(\log(x)))}{-4} = -\frac{x}{4} \cdot 2 \cdot (-\cos(\log(x)) - \sin(\log(x))) = \frac{x}{2} \cdot (\cos(\log(x)) + \sin(\log(x)))$$
Of course this is not very rigorous (I think), and it should be justified by proving that $$(\frac{x}{2} \cdot (\cos(\log(x)) + \sin(\log(x))))' = \cos(\log(x)) $$ which is easy.
