I'm failing at calculating this (pretty simple) integral:
$$\frac{1}{2\pi} \cdot \int_{-\pi/2}^{\pi/2} e^{-jx} \cdot \cos(x) dx $$
As
$$ \int e^{ax} \cdot \cos(bx) dx = \frac{e^{ax}}{a^2+b^2}\cdot[a\cdot \cos(x) + b\cdot \sin(bx)]$$
and $a=-j;b=1$ the antiderivative should be the following:
$$ \frac{1}{2\pi}\cdot\int_{-\pi/2}^{\pi/2} e^{-jx} \cdot \cos(x) dx = \frac{1}{2\pi}\cdot \Bigg[\frac{e^{-jx}}{(-j)^2+1}\cdot[(-j)\cdot \cos(x) + \sin(x)]\Bigg]^{\pi/2}_{-\pi/2}$$
But because $(-j)^2 = -j\cdot-j=j^2=-1$ this leads to an undefined expression.
I know that this has to be wrong because using a calculator I get $\frac{1}{4}$. But I can't find my mistake.