Integrate $\int x e^{x} \sin x dx$ Evaluate:
$$\int x e^{x} \sin x dx$$

Have you ever come across such an integral? I have no idea how to start with the calculation.
Solution without complex numbers:

Let $I=\int e^x x\sin xdx$ Integrating by parts:

$$I=e^x x\sin x-\int e^x x\cos xdx-\int e^x\sin xdx$$

Then one more time by parts:

$$\int e^x x\cos xdx=e^x x\cos x + I-\int e^x\cos xdx$$

So:

$$2I=e^x x\sin x-e^x x\cos x+\int e^x(\cos x-\sin x)dx$$

Now (by parts again or by direct observation):

$$\int e^x(\cos x-\sin x)dx=e^x \cos x$$

So:

$$I=\frac{e^x x\sin x-e^x x\cos x+e^x \cos x}{2}$$
By parts,

$$\int te^tdt=(t-1)e^t.$$

Then by the change of variable $t=(1+i)x$,

$$\int xe^x\sin x\,dx=\Im\left(\frac1{(1+i)^2}((1+i)x-1)e^{(1+i)x}\right)=\Im\left(\left(\frac{1-i}2x+\frac  i2\right)e^{(1+i)x}\right).$$