How to solve $\int \ln(x)\cos(x)\: \mathrm{d}x$? I'm a high school senior and I'm taking Calc II. Last week we went through integration by parts. I encountered this problem which is not on the textbook, and I couldn't solve it. I tried several different approaches but each of them led me to an dead end. Any help is appreciated.
Here it is:
$$\int \ln(x)\cos(x)\: \mathrm{d}x$$
 A: As pointed out in the comments, the integral is non-elementary i.e. the integrand doesn't possess a primitive. However, you can compute it to arbitrary accuracy using the expansion for $\cos(x)$. We have
$$\cos(x) = \sum_{k=0}^{\infty} \dfrac{(-1)^k x^{2k}}{(2k)!}$$
Hence,
\begin{align}
\int_0^t \log(x) \cos(x) dx & = \int_0^t \log(x) \left(\sum_{k=0}^{\infty} \dfrac{(-1)^k x^{2k}}{(2k)!} \right) dx\\
& = \sum_{k=0}^{\infty} \dfrac{(-1)^k}{(2k)!} \int_0^t x^{2k} \log(x) dx\\
& = \sum_{k=0}^{\infty} \dfrac{(-1)^k}{(2k)!}  \dfrac{t^{2k+1} \left((2k+1) \log t - 1\right)}{(2k+1)^2} \,\,\,\,\, (\spadesuit)
\end{align}
Note that, in general, you need to argue out why you can swap the integral and infinite sum. In this case, this is not hard since the integral is dominated by $\displaystyle \int_0^t \vert \log(x) \vert dx$.
Now truncating the infinite series $(\spadesuit)$ will give you arbitrarily accurate answer. Also note that, for a fixed $t$, the series converges exponentially. Hence, a good approximation is $$\sum_{k=0}^{n} \dfrac{(-1)^k}{(2k)!}  \dfrac{t^{2k+1} \left((2k+1) \log t - 1\right)}{(2k+1)^2}$$ for reasonably large $n \gg t$.
A: Let's combine $2$ simple facts
$1)$ Integrating by parts
$$\int_0^{u} \log(x) (\sin(x))' dx = \log(u) \sin(u)-Si(u)$$
$2)$ The series representation of $Si(u)$ is given by
$$Si(u)=\sum_{n=1}^{\infty}(-1)^{n-1}\frac{u^{2n-1}}{(2n-1)(2n-1)!}$$
Thus
$$\int_0^{u} \log(x) \cos(x) dx = \log(u) \sin(u)+\sum_{n=1}^{\infty}(-1)^{n}\frac{u^{2n-1}}{(2n-1)(2n-1)!}$$
Note:
$$\lim_{x\to0} \log(x) \sin(x)=\lim_{x\to0} x\log(x)\lim_{x\to0} \frac{\sin(x)}{x}= 0 \cdot 1=0$$
