# phpman > man > COMPLEX(7)

[COMPLEX(7)](https://www.chedong.com/phpMan.php/man/COMPLEX/7/markdown)                            Linux Programmer's Manual                           [COMPLEX(7)](https://www.chedong.com/phpMan.php/man/COMPLEX/7/markdown)



## NAME
       complex - basics of complex mathematics

## SYNOPSIS
### #include <complex.h>

## DESCRIPTION
       Complex  numbers  are  numbers  of the form z = a+b*i, where a and b are real numbers and i =
       sqrt(-1), so that i*i = -1.

       There are other ways to represent that number.  The pair (a,b) of real numbers may be  viewed
       as  a  point  in  the  plane, given by X- and Y-coordinates.  This same point may also be de‐
       scribed by giving the pair of real numbers (r,phi), where r is the distance to the origin  O,
       and   phi  the  angle  between  the  X-axis  and  the  line  Oz.   Now  z  =  r*exp(i*phi)  =
       r*(cos(phi)+i*sin(phi)).

       The basic operations are defined on z = a+b*i and w = c+d*i as:

       **addition:** **z+w** **=** **(a+c)** **+** **(b+d)*i**

       **multiplication:** **z*w** **=** **(a*c** **-** **b*d)** **+** **(a*d** **+** **b*c)*i**

       **division:** **z/w** **=** **((a*c** **+** **b*d)/(c*c** **+** **d*d))** **+** **((b*c** **-** **a*d)/(c*c** **+** **d*d))*i**

       Nearly all math function have a complex counterpart but there  are  some  complex-only  func‐
       tions.

## EXAMPLES
       Your  C-compiler  can  work  with complex numbers if it supports the C99 standard.  Link with
       _-lm_.  The imaginary unit is represented by I.

       /* check that exp(i * pi) == -1 */
       #include <math.h>        /* for atan */
       #include <stdio.h>
       #include <complex.h>

       int
       main(void)
       {
           double pi = 4 * atan(1.0);
           double complex z = cexp(I * pi);
           printf("%f + %f * i\n", creal(z), cimag(z));
       }

## SEE ALSO
       [**cabs**(3)](https://www.chedong.com/phpMan.php/man/cabs/3/markdown), [**cacos**(3)](https://www.chedong.com/phpMan.php/man/cacos/3/markdown), [**cacosh**(3)](https://www.chedong.com/phpMan.php/man/cacosh/3/markdown), [**carg**(3)](https://www.chedong.com/phpMan.php/man/carg/3/markdown), [**casin**(3)](https://www.chedong.com/phpMan.php/man/casin/3/markdown),  [**casinh**(3)](https://www.chedong.com/phpMan.php/man/casinh/3/markdown),  [**catan**(3)](https://www.chedong.com/phpMan.php/man/catan/3/markdown),  [**catanh**(3)](https://www.chedong.com/phpMan.php/man/catanh/3/markdown),  [**ccos**(3)](https://www.chedong.com/phpMan.php/man/ccos/3/markdown),
       [**ccosh**(3)](https://www.chedong.com/phpMan.php/man/ccosh/3/markdown),  [**cerf**(3)](https://www.chedong.com/phpMan.php/man/cerf/3/markdown),  [**cexp**(3)](https://www.chedong.com/phpMan.php/man/cexp/3/markdown),  [**cexp2**(3)](https://www.chedong.com/phpMan.php/man/cexp2/3/markdown),  [**cimag**(3)](https://www.chedong.com/phpMan.php/man/cimag/3/markdown),  [**clog**(3)](https://www.chedong.com/phpMan.php/man/clog/3/markdown),  [**clog10**(3)](https://www.chedong.com/phpMan.php/man/clog10/3/markdown),  [**clog2**(3)](https://www.chedong.com/phpMan.php/man/clog2/3/markdown), [**conj**(3)](https://www.chedong.com/phpMan.php/man/conj/3/markdown),
       [**cpow**(3)](https://www.chedong.com/phpMan.php/man/cpow/3/markdown), [**cproj**(3)](https://www.chedong.com/phpMan.php/man/cproj/3/markdown), [**creal**(3)](https://www.chedong.com/phpMan.php/man/creal/3/markdown), [**csin**(3)](https://www.chedong.com/phpMan.php/man/csin/3/markdown), [**csinh**(3)](https://www.chedong.com/phpMan.php/man/csinh/3/markdown), [**csqrt**(3)](https://www.chedong.com/phpMan.php/man/csqrt/3/markdown), [**ctan**(3)](https://www.chedong.com/phpMan.php/man/ctan/3/markdown), [**ctanh**(3)](https://www.chedong.com/phpMan.php/man/ctanh/3/markdown)

## COLOPHON
       This page is part of release 5.10 of the Linux  _man-pages_  project.   A  description  of  the
       project,  information about reporting bugs, and the latest version of this page, can be found
       at <https://www.kernel.org/doc/man-pages/>.



                                             2020-06-09                                   [COMPLEX(7)](https://www.chedong.com/phpMan.php/man/COMPLEX/7/markdown)
