1 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" Distributed under GPL
4 .\" Japanese Version Copyright (c) 2003 Akihiro MOTOKI
5 .\" all rights reserved.
6 .\" Translated 2003-08-02, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
7 .\" Updated 2005-02-20, Akihiro MOTOKI
10 .\"WORD: imaginary unit 虚数単位
12 .TH COMPLEX 7 2011-09-16 "" "Linux Programmer's Manual"
15 .\"O complex \- basics of complex mathematics
19 .B #include <complex.h>
22 .\"O Complex numbers are numbers of the form z = a+b*i, where a and b are
23 .\"O real numbers and i = sqrt(\-1), so that i*i = \-1.
24 複素数は z = a+b*i の形式の数である。 a と b は実数であり、
25 i は i = sqrt(\-1) つまり i*i = \-1 の関係を満たす。
27 .\"O There are other ways to represent that number.
28 .\"O The pair (a,b) of real
29 .\"O numbers may be viewed as a point in the plane, given by X- and
31 .\"O This same point may also be described by giving
32 .\"O the pair of real numbers (r,phi), where r is the distance to the origin O,
33 .\"O and phi the angle between the X-axis and the line Oz.
35 .\"O z = r*exp(i*phi) = r*(cos(phi)+i*sin(phi)).
36 複素数を表現する別の方法もある。実数の組 (a,b) は X座標、Y座標で
37 指定された平面上の点と見ることができる。この同じ点は、実数の組
38 (r,phi) で表すこともできる。r は原点 0 からの距離であり、phi は
39 X軸と 0 と z を結ぶ線分がなす角である。このとき、
40 z = r*exp(i*phi) = r*(cos(phi)+i*sin(phi))
43 .\"O The basic operations are defined on z = a+b*i and w = c+d*i as:
44 2つの複素数 z = a+b*i, w = c+d*i に関する基本演算は次のように定義される:
46 .\"O .B addition: z+w = (a+c) + (b+d)*i
47 .B 加法: z+w = (a+c) + (b+d)*i
49 .\"O .B multiplication: z*w = (a*c \- b*d) + (a*d + b*c)*i
50 .B 乗法: z*w = (a*c \- b*d) + (a*d + b*c)*i
52 .\"O .B division: z/w = ((a*c + b*d)/(c*c + d*d)) + ((b*c \- a*d)/(c*c + d*d))*i
53 .B 除法: z/w = ((a*c + b*d)/(c*c + d*d)) + ((b*c \- a*d)/(c*c + d*d))*i
55 .\"O Nearly all math function have a complex counterpart but there are
56 .\"O some complex-only functions.
57 ほとんど全ての数学関数に関して複素数版があるが、
61 .\"O Your C-compiler can work with complex numbers if it supports the C99 standard.
62 .\"O Link with \fI\-lm\fP.
63 .\"O The imaginary unit is represented by I.
64 使用する C コンパイラが C99 標準をサポートしていれば複素数を使うことができる。
65 \fI\-lm\fP をつけてリンクすること。虚数単位は I で表現される。
68 .\"O /* check that exp(i * pi) == \-1 */
69 /* exp(i * pi) == \-1 となることを確認する */
70 #include <math.h> /* for atan */
77 double pi = 4 * atan(1.0);
78 double complex z = cexp(I * pi);
79 printf("%f + %f * i\\n", creal(z), cimag(z));