I am trying to compute the integral of $\int_0^\pi e^{ix} dx$ but get the wrong answer. My calculations are $$ \begin{eqnarray} \int_0^\pi e^{ix} dx &=& (1/i) \int_0^\pi e^{ix} \cdot i \cdot dx = (1/i) \Bigl[ e^{ix} \Bigr]_0^{\pi} \\ &=& (1/i) \Bigl[ e^{i\cdot \pi} - e^{i\cdot 0} \Bigr] = (1/i) \Bigl[ -1 - 1 \Bigr] \\ &=& -2 / i \end{eqnarray} $$
But WolframAlpha says the answer is $2i$. What am I missing?
You have taken all the right steps so far $$ \begin{eqnarray} \int_0^\pi e^{ix} dx &=& (1/i) \int_0^\pi e^{ix} \cdot i \cdot dx \\ &=& (1/i) \Bigl[ e^{ix} \Bigr]_0^{\pi} \\ &=& (1/i) \Bigl[ e^{i\cdot \pi} - e^{i\cdot 0} \Bigr] \\ &=& (1/i) \Bigl[ -1 - 1 \Bigr] \\ &=& -2 / i = 2i \end{eqnarray}$$ Note that $i$ is the pure imaginary number satisfying $i^2 =-1$.
Thus $1/i = -i$ which implies $-2/i =2i$