complex 中文man页面

系统
complex - 基础复数数学,复数是一种形如 z = a + b*i,这里的 a 和 b 都是实数且 i = sqrt(-1),因此 i*i = -1。

名字

complex - 基础复数数学

概要

#include <complex.h>

描述

复数是一种形如 z = a + b*i,这里的 a 和 b 都是实数且 i = sqrt(-1),因此 i*i = -1。
还存在其它表达这种数的方式。一个实数对(a, b) 被看作是水平面的一个点,此时给定了 X 和 Y 轴值。相同的点也可以通过给定一个实数对 (r, phi) 来确定,此时 r 是点到原点 O 的距离,而 phi 是线 Oz 与 X 轴的夹角。如此 z = r*exp(i*phi) = r*(cos(phi)+i*sin(phi))。

对 z = a+b*i 和 w= c+d*i 的基本操作定义如下:

加法: z+w = (a+c) + (b+d)*i
乘法: z*w = (a*c - b*d) + (a*d + b*c)*i
除法: z/w = ((a*c + b*d)/(c*c + d*d)) + ((b*c - a*d)/(c*c + d*d))*i

几乎所有的数学函数都有复数的对应版本但却有复数特有的函数。

示例

如果的你的 C 编译器支持 C99 标准则它就可以与复数一些工作,此时需要链接 -lm 选项。虚单位使用 I 表示。

/* 检测 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));
}

参看

cabs(3)、carg(3)、cexp(3)、cimag(3)、creal(3)

#p#

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 described 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 functions.  

EXAMPLE

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 <complex.h>
main() {
        double pi = 4*atan(1);
        complex z = cexp(I*pi);
        printf("%f+%f*i\n", creal(z), cimag(z));
}

SEE ALSO

cabs(3), carg(3), cexp(3), cimag(3), creal(3)

责任编辑:韩亚珊 来源: 互联网
相关推荐

2011-08-24 16:48:36

man中文man

2011-08-15 10:21:09

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-08-12 14:58:05

killall中文man

2011-07-15 16:58:36

ac中文man

2011-08-15 11:10:48

more中文man

2011-08-25 17:03:51

pclose中文man

2011-08-15 14:10:37

tar中文man

2011-08-16 10:42:30

rmmod中文man

2011-08-18 13:57:38

acct中文man

2011-08-23 17:49:36

zdump中文man

2011-08-15 15:10:49

wall中文man

2011-08-23 15:06:03

quotastats中文man

2011-08-15 17:35:50

ar中文man

2011-08-25 09:07:16

suffixes中文man

2011-08-18 15:21:37

autofs中文man

2011-08-25 15:19:39

dirname中文man

2011-08-25 17:34:50

setlinebuf中文man

2011-08-15 15:17:14

ac中文man
点赞
收藏

51CTO技术栈公众号