From: "A.Appleyard" To: djgpp AT sun DOT soe DOT clarkson DOT edu Date: Tue, 7 Nov 1995 09:12:03 GMT Subject: Re: how to work out complex functions? Bourriot Nicolas 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 (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 */