Search code examples
ccomplex-numbersexponential

Computing e^(-j) in C


I need to compute imaginary exponential in C.

As far as I know, there is no complex number library in C. It is possible to get e^x with exp(x) of math.h, but how can I compute the value of e^(-i), where i = sqrt(-1)?


Solution

  • Note that exponent of complex number equals:

    e^(ix) = cos(x)+i*sin(x)
    

    Then:

    e^(-i) = cos(-1)+i*sin(-1)