www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/11/07/04:31:47

From: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
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 <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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019