How do I find $$\int e^{x \sin x +\cos x}\left(\frac{x^4 \cos^3 x - x \sin x + \cos x}{x^2 \cos ^2 x}\right) dx\quad?$$
I tried to put $e^{x \sin x +\cos x}$ as some t and write the expression in terms of t, but it didn't work. How do I solve this integral? The answer is $e^{x \sin x +\cos x}\left(x-\frac{1}{x \cos x}\right)$.
Let $$I=\int e^{x \sin x+ \cos x} \left( \frac{x^4 \cos^3 x-x \sin x+\cos x}{x^2 \cos^2 x} \right)~dx.$$ Let us re-write $I$ as $$I= \int x [e^{x \sin x + \cos x} x \cos x]~ dx- \int e^{x \sin x+ \cos x} \left ( \frac{x \sin x + \cos x}{(x \cos x)^2} \right)~dx.$$ In the first integral above, the integral of the term in square brackets is doable. So, in integration by parts we take it as second function. In the second integral we take $e^{x\sin x+ \cos x}$ as the second function. Then $$I=\left( x e^{x\sin x+\cos x}- \int e^{x\sin x+\cos x}~ dx \right) - \left( e^{x\sin x+\cos x} (x \cos x)^{-1} - \int e^{x\sin x+\cos x}~dx \right). $$ Finally $$ I= e^{x\sin x + \cos x} \left(x-\frac{1}{x \cos x}\right)+C.$$