2

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.

Arnaud D.
  • 20,884
TimSch
  • 309
  • 2
  • 10
  • Use the formula mentioned in https://math.stackexchange.com/questions/439851/evaluate-the-integral-int-frac-pi2-0-frac-sin3x-sin3x-cos3x/439856#439856 and then http://mathworld.wolfram.com/WernerFormulas.html – lab bhattacharjee Sep 11 '18 at 15:01
  • 1
    The formula antiderivative works for $a,b\in \mathbb R$. When encounter complex numbers, you should be careful. A safe way is to write $\mathrm {e}^{\mathrm i x} = \cos(x) + \mathrm i \sin(x)$. – xbh Sep 11 '18 at 15:02
  • $\cos{x} = \frac{e^{jx}+e^{-jx}}{2}$ – saulspatz Sep 11 '18 at 15:04
  • @xbh I already integrated functions with complex variables and never had problems. More precisely this is a follow up question of this one: https://math.stackexchange.com/questions/2912547/complex-fourier-series-of-cosx I successfully integrated the function with $n$ but I fail for $n=1$. How do I know if it's a good idea to use my default tables for antiderivatives and when not? – TimSch Sep 11 '18 at 15:45

1 Answers1

1

$$I=\frac{1}{2\pi} \cdot \int_{-\pi/2}^{\pi/2} e^{-jx} \cdot cos(x) dx$$

Substitute $x=-t$ $$I=\frac{1}{2\pi} \cdot \int_{\pi/2}^{-\pi/2} -e^{jt} \cdot cos(-t) dt$$ $$I=\frac{1}{2\pi} \cdot \int_{-\pi/2}^{\pi/2} e^{jt} \cdot cos(t) dt$$

$$2I=\frac{1}{2\pi} \cdot \int_{-\pi/2}^{\pi/2} (e^{-jx}+e^{jx}) \cdot cos(x) dx$$ $$I=\frac{1}{2\pi} \cdot \int_{-\pi/2}^{\pi/2} \frac{e^{jx}+e^{-jx}}{2} \cdot cos(x) dx$$

Use $$\cos{x} = \frac{e^{jx}+e^{-jx}}{2}$$