Mail Archives: djgpp/1995/11/07/04:31:47
Bourriot Nicolas <bourriot AT lpmo DOT univ-fcomte DOT fr> wrote:-
> I want to calculate with complex numbers, so I declare with the __complexe__
> float type, but I don't know how to calculate complex functions as :
> exp(x+jy), sin(jx),... Is there a special library and (or) special
> functions?
#include <complex.h> (in C++ only). The #included matter is in
c:\djgpp\cplusinc\complex.h and c:\djgpp\cplusinc\_complex.h .
exp(x+i*y) = exp(x)*(cos(y)+i*sin(y)) = exp(x)*cis(y) (Argand's Theorem).
exp(i*pi) = -1
cis(y) = cos(y)+i*sin(y)
cos(x) = (exp(i*x)+exp(-i*x))/2
sin(x) = (exp(i*x)-exp(-i*x))/(2*i)
log(x+i*y) = log(sqrt(x*x+y*y)) + i * atan2(y,x)
/* complex log has infinity values at intervals of 2*i*pi */
- Raw text -