1COMPLEX(7)                       complex math                       COMPLEX(7)
2
3
4

NAME

6       complex - basics of complex mathematics
7

SYNOPSIS

9       #include <complex.h>
10

DESCRIPTION

12       Complex  numbers  are  numbers of the form z = a+b*i, where a and b are
13       real numbers and i = sqrt(-1), so that i*i = -1.
14       There are other ways to represent that number. The pair (a,b)  of  real
15       numbers  may be viewed as a point in the plane, given by X- and Y-coor‐
16       dinates. This same point may also be described by giving  the  pair  of
17       real  numbers (r,phi), where r is the distance to the origin O, and phi
18       the angle between the X-axis and the line Oz. Now z  =  r*exp(i*phi)  =
19       r*(cos(phi)+i*sin(phi)).
20
21       The basic operations are defined on z = a+b*i and w = c+d*i as:
22
23       addition: z+w = (a+c) + (b+d)*i
24
25       multiplication: z*w = (a*c - b*d) + (a*d + b*c)*i
26
27       division: z/w = ((a*c + b*d)/(c*c + d*d)) + ((b*c - a*d)/(c*c + d*d))*i
28
29       Nearly  all math function have a complex counterpart but there are some
30       complex only functions.
31

EXAMPLE

33       Your C-compiler can work with complex numbers if it  supports  the  C99
34       standard.  Link with -lm. The imaginary unit is represented by I.
35
36       /* check that exp(i*pi) == -1 */
37       #include <math.h>   /* for atan */
38       #include <complex.h>
39       main() {
40            double pi = 4*atan(1);
41            complex z = cexp(I*pi);
42            printf("%f+%f*i\n", creal(z), cimag(z));
43       }
44

SEE ALSO

46       cabs(3), carg(3), cexp(3), cimag(3), creal(3)
47
48
49
50                                  2002-07-28                        COMPLEX(7)
Impressum