complex
Section: Environments, Tables, and Troff Macros (7)
Updated: 2026-02-08
Index
JM Home Page
roff page
名前
complex - 複素数の数学の基礎
ライブラリ
数学ライブラリ (libm,~-lm)
書式
#include <complex.h>
説明
複素数は z = a+b*i の形式の数である。 a と b は実数であり、 i は i = sqrt(-1) つまり i*i = -1
の関係を満たす。
複素数を表現する別の方法もある。実数の組 (a,b) は X座標、Y座標で 指定された平面上の点と見ることができる。この同じ点は、実数の組
(r,phi) で表すこともできる。r は原点 0 からの距離であり、phi は X軸と 0 と z を結ぶ線分がなす角である。このとき、 z =
r*exp(i*phi) = r*(cos(phi)+i*sin(phi)) の関係が成り立つ。
2つの複素数 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
-
ほとんど全ての数学関数に関して複素数版があるが、 複素数専用の関数も幾つかある。
例
Your C-compiler can work with complex numbers if it supports the C99
standard. 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));
}
関連項目
cabs(3), cacos(3), cacosh(3), carg(3), casin(3),
casinh(3), catan(3), catanh(3), ccos(3), ccosh(3),
cerf(3), cexp(3), cexp2(3), cimag(3), clog(3), clog10(3),
clog2(3), conj(3), cpow(3), cproj(3), creal(3), csin(3),
csinh(3), csqrt(3), ctan(3), ctanh(3)
Index
- 名前
-
- ライブラリ
-
- 書式
-
- 説明
-
- 例
-
- 関連項目
-
This document was created by
man2html,
using the manual pages.