Evaluating $ \int {e^x \sin (k \pi x) } dx $ I'm trying to integrate $$ I = \int {e^x \sin (k \pi x)} dx. $$ I've used Matlab and Wolfram Alpha, which have both given me the result $$ I = \frac{e^x(\sin (k \pi x) - \cos (k \pi x))}{k^2 \pi^2 +1 }.$$
How did these programs get this result? 

Consider $e^{ik\pi x} = \cos k\pi x + i \sin k\pi x$.
The integrand becomes $e^{(ik\pi + 1)x}$, then take the imaginary part after integrating.
We get:
$$
\int e^{(ik\pi + 1) x} dx=\frac{e^{(ik\pi+1)x}}{ik\pi + 1}+C = \frac{(1-ik\pi)e^{(ik\pi+1)x}}{1+k^2\pi^2}+C=\frac{(1-ik\pi)e^x (\cos k\pi x+ i \sin k\pi x)}{1+k^2\pi^2}+C
$$
Take the imaginary parts of both sides, should yield same result as integration by parts.
$$
\therefore \int e^x \sin k\pi x \,dx =\frac{e^x (\sin k\pi x - k\pi \cos k\pi x)}{1+k^2\pi^2}+C
$$
