1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
.\" Distributed under GPL
.\"
.\" Japanese Version Copyright (c) 2003 Akihiro MOTOKI
.\" all rights reserved.
.\" Translated 2003-08-02, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\" Updated 2005-02-20, Akihiro MOTOKI
.\"
.\"WORD: operations 黻
.\"WORD: imaginary unit ñ
.\"
.TH COMPLEX 7 2002-07-28 "" "Linux Programmer's Manual"
.SH ̾
complex \- ʣǿοؤδ
.SH
.B #include <complex.h>
.SH
ʣǿ z = a+b*i ηοǤ롣 a b ϼ¿Ǥꡢ
i i = sqrt(\-1) Ĥޤ i*i = \-1 δط
.br
ʣǿɽ̤ˡ⤢롣¿ (a,b) XɸYɸ
ꤵ줿ʿ̾ȸ뤳ȤǤ롣Ʊϡ¿
(r,phi) ɽȤǤ롣r ϸ 0 εΥǤꡢphi
X 0 z ʬʤѤǤ롣ΤȤ
z = r*exp(i*phi) = r*(cos(phi)+i*sin(phi))
δطΩġ
.PP
2Ĥʣǿ z = a+b*i, w = c+d*i ˴ؤܱ黻ϼΤ褦:
.TP
.B ˡ: z+w = (a+c) + (b+d)*i
.TP
.B ˡ: z*w = (a*c \- b*d) + (a*d + b*c)*i
.TP
.B ˡ: z/w = ((a*c + b*d)/(c*c + d*d)) + ((b*c \- a*d)/(c*c + d*d))*i
.PP
ۤȤƤοشؿ˴ؤʣǿǤ뤬
ʣǿѤδؿĤ롣
.SH
Ѥ C ѥ餬 C99 ɸݡȤƤʣǿȤȤǤ롣
\fI\-lm\fP Ĥƥ뤳ȡñ̤ I ɽ롣
.sp
.nf
/* exp(i * pi) == \-1 Ȥʤ뤳Ȥǧ */
#include <math.h> /* for atan */
#include <complex.h>
int
main(void)
{
double pi = 4 * atan(1.0);
complex z = cexp(I * pi);
printf("%f + %f * i\\n", creal(z), cimag(z));
}
.fi
.SH Ϣ
.BR cabs (3),
.BR carg (3),
.BR cexp (3),
.BR cimag (3),
.BR creal (3)
|