{
    "mode": "man",
    "parameter": "COMPLEX",
    "section": "7",
    "url": "https://www.chedong.com/phpMan.php/man/COMPLEX/7/json",
    "generated": "2026-07-05T11:41:25Z",
    "synopsis": "",
    "sections": {
        "NAME": {
            "content": "complex - basics of complex mathematics\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "",
            "subsections": [
                {
                    "name": "#include <complex.h>",
                    "content": ""
                }
            ]
        },
        "DESCRIPTION": {
            "content": "Complex  numbers  are  numbers  of the form z = a+b*i, where a and b are real numbers and i =\nsqrt(-1), so that i*i = -1.\n\nThere are other ways to represent that number.  The pair (a,b) of real numbers may be  viewed\nas  a  point  in  the  plane, given by X- and Y-coordinates.  This same point may also be de‐\nscribed by giving the pair of real numbers (r,phi), where r is the distance to the origin  O,\nand   phi  the  angle  between  the  X-axis  and  the  line  Oz.   Now  z  =  r*exp(i*phi)  =\nr*(cos(phi)+i*sin(phi)).\n\nThe basic operations are defined on z = a+b*i and w = c+d*i as:\n\naddition: z+w = (a+c) + (b+d)*i\n\nmultiplication: z*w = (a*c - b*d) + (a*d + b*c)*i\n\ndivision: z/w = ((a*c + b*d)/(c*c + d*d)) + ((b*c - a*d)/(c*c + d*d))*i\n\nNearly all math function have a complex counterpart but there  are  some  complex-only  func‐\ntions.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "Your  C-compiler  can  work  with complex numbers if it supports the C99 standard.  Link with\n-lm.  The imaginary unit is represented by I.\n\n/* check that exp(i * pi) == -1 */\n#include <math.h>        /* for atan */\n#include <stdio.h>\n#include <complex.h>\n\nint\nmain(void)\n{\ndouble pi = 4 * atan(1.0);\ndouble complex z = cexp(I * pi);\nprintf(\"%f + %f * i\\n\", creal(z), cimag(z));\n}\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "cabs(3), cacos(3), cacosh(3), carg(3), casin(3),  casinh(3),  catan(3),  catanh(3),  ccos(3),\nccosh(3),  cerf(3),  cexp(3),  cexp2(3),  cimag(3),  clog(3),  clog10(3),  clog2(3), conj(3),\ncpow(3), cproj(3), creal(3), csin(3), csinh(3), csqrt(3), ctan(3), ctanh(3)\n",
            "subsections": []
        },
        "COLOPHON": {
            "content": "This page is part of release 5.10 of the Linux  man-pages  project.   A  description  of  the\nproject,  information about reporting bugs, and the latest version of this page, can be found\nat https://www.kernel.org/doc/man-pages/.\n\n\n\n2020-06-09                                   COMPLEX(7)",
            "subsections": []
        }
    },
    "summary": "complex - basics of complex mathematics",
    "flags": [],
    "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": [
        {
            "name": "cabs",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/cabs/3/json"
        },
        {
            "name": "cacos",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/cacos/3/json"
        },
        {
            "name": "cacosh",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/cacosh/3/json"
        },
        {
            "name": "carg",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/carg/3/json"
        },
        {
            "name": "casin",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/casin/3/json"
        },
        {
            "name": "casinh",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/casinh/3/json"
        },
        {
            "name": "catan",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/catan/3/json"
        },
        {
            "name": "catanh",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/catanh/3/json"
        },
        {
            "name": "ccos",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/ccos/3/json"
        },
        {
            "name": "ccosh",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/ccosh/3/json"
        },
        {
            "name": "cerf",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/cerf/3/json"
        },
        {
            "name": "cexp",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/cexp/3/json"
        },
        {
            "name": "cexp2",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/cexp2/3/json"
        },
        {
            "name": "cimag",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/cimag/3/json"
        },
        {
            "name": "clog",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/clog/3/json"
        },
        {
            "name": "clog10",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/clog10/3/json"
        },
        {
            "name": "clog2",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/clog2/3/json"
        },
        {
            "name": "conj",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/conj/3/json"
        },
        {
            "name": "cpow",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/cpow/3/json"
        },
        {
            "name": "cproj",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/cproj/3/json"
        },
        {
            "name": "creal",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/creal/3/json"
        },
        {
            "name": "csin",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/csin/3/json"
        },
        {
            "name": "csinh",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/csinh/3/json"
        },
        {
            "name": "csqrt",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/csqrt/3/json"
        },
        {
            "name": "ctan",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/ctan/3/json"
        },
        {
            "name": "ctanh",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/ctanh/3/json"
        }
    ]
}