An integration that wolfram cannot help me. $$\int e^{x\sin x+\cos x}\frac{x^4\cos^3 x-x\sin x+\cos x}{x^2\cos^2x}dx$$
I noted the fact that $\frac{d(x\cos x)}{dx}=-x\sin x+\cos x$ but I cannot apply the substitution on it.
 A: Here is the best solution I can do 
Compute the following:
\begin{align}
& \int e^{x\sin x+\cos x}\frac{x^4\cos^3 x-x\sin x+\cos x}{x^2\cos^2x}dx \\
& =\int e^{x\sin x+\cos x} \cdot x^2 \cos x dx+ \int e^{x\sin x+\cos x} \cdot \frac{-x\sin x+\cos x}{x^2\cos^2x}dx \\
\end{align}
Remark:
$$\frac{d(x\sin x+\cos x)}{dx}=x \cos x$$
$$\frac{d(x\cos x)}{dx}=-x\sin x+\cos x$$
Therefore, using integration by parts, the first term is 
\begin{align}
\int e^{x\sin x+\cos x} \cdot x^2 \cos x dx &= \int x d(e^{x\sin x+\cos x}) \\
&= x \cdot e^{x\sin x+\cos x} - \int e^{x\sin x+\cos x} dx   \qquad (1) 
\end{align}
Also, the second term is 
\begin{align}
\int e^{x\sin x+\cos x} \cdot \frac{-x\sin x+\cos x}{x^2\cos^2x}dx &= \int \frac{e^{x\sin x+\cos x}}{x^2\cos^2x}d(x \cos x) \\
&= \frac{e^{x\sin x+\cos x}}{x \cos x}-\int x \cos x d(\frac{e^{x\sin x+\cos x}}{x^2\cos^2x}) \qquad (2) 
\end{align}
And derive:
\begin{align}
\int x \cos x d(\frac{e^{x\sin x+\cos x}}{x^2\cos^2x}) &= \int \frac{e^{x\sin x+\cos x} \cdot (-2 \cos x+x^2 \cos^2 x+2x \sin x)}{x^2 \cos^2 x}dx \\
&= \int e^{x\sin x+\cos x} dx - 2 \cdot \int \frac{(-x\sin x+\cos x)e^{x\sin x+\cos x}}{x^2 \cos^2 x} dx
\end{align} 
Thus, the equation (2) becomes:
\begin{align}
\int e^{x\sin x+\cos x} \cdot \frac{-x\sin x+\cos x}{x^2\cos^2x}dx = \frac{e^{x\sin x+\cos x}}{x \cos x} - \int e^{x\sin x+\cos x} dx \\ + 2 \cdot \int \frac{(-x\sin x+\cos x)e^{x\sin x+\cos x}}{x^2 \cos^2 x} dx 
\end{align} 
By rearranging the terms in the equation above, we have:
\begin{align}
-\int e^{x\sin x+\cos x} \cdot \frac{-x\sin x+\cos x}{x^2\cos^2x}dx &= \frac{e^{x\sin x+\cos x}}{x \cos x} - \int e^{x\sin x+\cos x} dx \\
\int e^{x\sin x+\cos x} \cdot \frac{-x\sin x+\cos x}{x^2\cos^2x}dx &= -\frac{e^{x\sin x+\cos x}}{x \cos x} + \int e^{x\sin x+\cos x} dx  \qquad (3) 
\end{align}
Combine the equation (1) and (3):
\begin{align}
& \int e^{x\sin x+\cos x}\frac{x^4\cos^3 x-x\sin x+\cos x}{x^2\cos^2x}dx \\
& = x \cdot e^{x\sin x+\cos x} - \int e^{x\sin x+\cos x} dx -\frac{e^{x\sin x+\cos x}}{x \cos x} + \int e^{x\sin x+\cos x} dx \\
& = x \cdot e^{x\sin x+\cos x} -\frac{e^{x\sin x+\cos x}}{x \cos x}
\end{align}
as above
A: Let's write an antiderivative Ansatz $f(x)\exp (x\sin x+\cos x)$ so $$f^\prime(x) + f(x)x\cos x=x^2\cos x-\frac{1}{x}\sec x\tan x+\frac{1}{x^2}\sec x\\=x^2\cos x-\left(\frac{1}{x}\sec x\right)^\prime=1+x\cos^2 x-\left(\frac{1}{x}\sec x\right)^\prime-\frac{1}{x}\sec x\cdot x\cos x.$$But by inspection, this has solution $f(x)=x-\frac{1}{x}\sec x$.
