<s>[INST] Evaluate $\int e^x \sin^2 x \mathrm{d}x$ Is the following evaluation of correct?
\begin{align*} \int e^x \sin^2 x \mathrm{d}x &= e^x \sin^2 x -2\int e^x \sin x \cos x \mathrm{d}x \\ &= e^x \sin^2 x -2e^x \sin x \cos x + 2 \int e^x (\cos^2 x - \sin^2x) \mathrm{d}x \\ &= e^x \sin^2 x -2e^x \sin x \cos x + 2 \int e^x (1 - 2\sin^2x) \mathrm{d}x \\ &= e^x \sin^2 x -2e^x \sin x \cos x + 2 \int -2 e^x  \sin^2x \mathrm{d}x + 2 e^x \\ &= e^x \sin^2 x -2e^x \sin x \cos x  + 2 e^x -4 \int e^x  \sin^2x \mathrm{d}x \end{align*}
First two steps use integration by parts. In the first step we differentiate $\sin^2 x$. In the second step we differentiate  $\sin x \cos x$.
Using this, we reach $$5\int e^x \sin^2 x \mathrm{d}x = e^x \sin^2 x -2e^x \sin x \cos x  + 2 e^x$$
$$\int e^x \sin^2 x \mathrm{d}x = \frac{e^x \sin^2 x -2e^x \sin x \cos x  + 2 e^x}{5}+C$$
I can't reach the form that most integral calculators give, which has terms $\cos(2x)$ and $\sin(2x)$ by just using trig identities, so I wonder whether the result is correct. I would also be interested in a method that immediately gives the form $$-\frac{e^x[2 \sin(2x)+ \cos(2x)-5]}{10}+C$$
 [/INST] Your solution is correct. To reach to required form See here,You allready Got this
$$\int e^x \sin^2 x \mathrm{d}x = \frac{e^x \sin^2 x -2e^x \sin x \cos x  + 2 e^x}{5}+C$$
Now multiply and divide your result by $2$, you will get
$$\frac{2e^x \sin^2 x -4e^x \sin x \cos x  +4e^x}{10}+C\\
=\frac{2e^x \sin^2 x -4e^x \sin x \cos x  +4e^x+e^x-e^x}{10}+C\\
=\frac{2e^x \sin^2 x-e^x -4e^x \sin x \cos x  +5e^x}{10}+C\\
=\frac{e^x(2 \sin^2 x-1) -4e^x \sin x \cos x  +5e^x}{10}+C\\
=-\frac{e^x[2 \sin(2x)+ \cos(2x)-5]}{10}+C$$
Where we used the identities 
1) $2 \sin^2 x-1=-\cos 2x$
2)$2\sin x\cos x= \sin 2x $
</s>