Is integrating over complex numbers like this valid? I had to evaluate the integral $$I=\int_{0}^{\pi} x^4 \sin{x} \ \mathrm{d}x$$ I thought that integrating by parts would be to long, and so, planning to use the property $\displaystyle\int e^{x} (f(x)+f'(x)) \ \mathrm{d}x=e^{x}f(x)+C$,  I wrote the required integral this way - $$I=\Im \int_{0}^{\pi} x^4 e^{ix} \ \mathrm{d}x$$ Then I substituted $ix=t$. So, I got $$I=\Im \left\{i \int_{0}^{i\pi} x^4 e^x \ \mathrm{d}x\right\}$$ I used the property stated earlier, and got the answer. But, is integrating over complex numbers just like reals okay? If so, what does it mean? I mean, integrating over the reals signifies the area under a curve. What does integrating over complex numbers this way mean, if it is valid?
 A: 
What does integrating over complex numbers this way mean, if it is valid?

Imagine that the graph of the function is plotted along a third dimension, perpendicular on the horizontal plane $XOY$. Since the line segment $(0,i\pi)\subset OY$, imagine that the graph is drawn in $YOZ$, with both the real part and the imaginary part forming each a curve in this new plane.
A: Hint :
It is easy to show that
\begin{equation}
\int_0^\pi\sin(\alpha x)\,dx=\frac{1-\cos(\pi \alpha)}{\alpha}
\end{equation}
Hence our considered integral is fourth derivative of the LHS w.r.t. $\alpha$ at $\alpha=1$.
\begin{equation}
\partial_\alpha^4\int_0^\pi\sin(\alpha x)\,dx=\int_0^\pi x^4\sin x\,dx=\frac{\partial^4}{\partial\alpha^4}\left[\frac{1-\cos(\pi \alpha)}{\alpha}\right]_{\alpha=1}
\end{equation}
A: The answer is yes, as is established by the theory of functions of a complex variable.
Anyway you don't need that machinery, you can consider that you use a shorthand notation that conveys two terms at a time, $e^{ix}\equiv(\cos x,\sin x$). Then the rule that leads to integration by parts with exponentials still holds:
$$\begin{align}(f(x)e^{ix})'\\&
\equiv(f(x)\cos x,f(x)\sin x)'\\
&=(f'(x)\cos x-f(x)\sin x,f'(x)\sin x+f(x)\cos x)\\
&=f'(x)(\cos x,\sin x)+f(x)(-\sin x,\cos(x))\\
&\equiv f'(x)e^{ix}+f(x)e^{i(x+\pi/2)}\end{align}.$$
Doing this, you rediscover, among others, that $(e^{ix})'=e^{i(x+\pi/2)}$, but this is just a matter of notation, no properties of complex numbers involved!
For the same "price", you computed the integral of $x^4\cos x$ as well.
Direct integration by parts is also possible:
$$\int x^4\sin x\ dx=-x^4\cos x+\int 4x^3\cos x\ dx$$
$$\int x^3\cos x\ dx=x^3\sin x-\int 3x^2\sin x\ dx$$
$$\int x^2\sin x\ dx=-x^2\cos x+\int 2x\cos x\ dx$$
$$\int x\cos x\ dx=x\sin x-\int\sin x\ dx.$$
