?? complex.texi
字號(hào):
@cindex complex numbersThe functions described in this chapter provide support for complexnumbers. The algorithms take care to avoid unnecessary intermediateunderflows and overflows, allowing the functions to be evaluated over as much of the complex plane as possible. @comment FIXME: this still needs to be@comment done for the csc,sec,cot,csch,sech,coth functionsFor multiple-valued functions the branch cuts have been chosen to followthe conventions of Abramowitz and Stegun in the @cite{Handbook ofMathematical Functions}. The functions return principal values which arethe same as those in GNU Calc, which in turn are the same as those in@cite{Common Lisp, The Language (Second Edition)} (n.b. The secondedition uses different definitions from the first edition) and theHP-28/48 series of calculators.The complex types are defined in the header file @file{gsl_complex.h},while the corresponding complex functions and arithmetic operations aredefined in @file{gsl_complex_math.h}.@menu* Complex numbers:: * Properties of complex numbers:: * Complex arithmetic operators:: * Elementary Complex Functions:: * Complex Trigonometric Functions:: * Inverse Complex Trigonometric Functions:: * Complex Hyperbolic Functions:: * Inverse Complex Hyperbolic Functions:: * Complex Number References and Further Reading:: @end menu@node Complex numbers@section Complex numbers@cindex representations of complex numbers@cindex polar form of complex numbersComplex numbers are represented using the type @code{gsl_complex}. Theinternal representation of this type may vary across platforms andshould not be accessed directly. The functions and macros describedbelow allow complex numbers to be manipulated in a portable way.For reference, the default form of the @code{gsl_complex} type isgiven by the following struct,@exampletypedef struct@{ double dat[2];@} gsl_complex;@end example@noindentThe real and imaginary part are stored in contiguous elements of a twoelement array. This eliminates any padding between the real andimaginary parts, @code{dat[0]} and @code{dat[1]}, allowing the struct tobe mapped correctly onto packed complex arrays.@deftypefun gsl_complex gsl_complex_rect (double @var{x}, double @var{y})This function uses the rectangular cartesian components(@var{x},@var{y}) to return the complex number @math{z = x + i y}.@end deftypefun@deftypefun gsl_complex gsl_complex_polar (double @var{r}, double @var{theta})This function returns the complex number @math{z = r \exp(i \theta) = r(\cos(\theta) + i \sin(\theta))} from the polar representation(@var{r},@var{theta}).@end deftypefun@defmac GSL_REAL (@var{z})@defmacx GSL_IMAG (@var{z})These macros return the real and imaginary parts of the complex number@var{z}.@end defmac@defmac GSL_SET_COMPLEX (@var{zp}, @var{x}, @var{y})This macro uses the cartesian components (@var{x},@var{y}) to set thereal and imaginary parts of the complex number pointed to by @var{zp}.For example,@exampleGSL_SET_COMPLEX(&z, 3, 4)@end example@noindentsets @var{z} to be @math{3 + 4i}.@end defmac@defmac GSL_SET_REAL (@var{zp},@var{x})@defmacx GSL_SET_IMAG (@var{zp},@var{y})These macros allow the real and imaginary parts of the complex numberpointed to by @var{zp} to be set independently.@end defmac@node Properties of complex numbers@section Properties of complex numbers@deftypefun double gsl_complex_arg (gsl_complex @var{z})@cindex argument of complex number This function returns the argument of the complex number @var{z},@math{\arg(z)}, where @c{$-\pi < \arg(z) \leq \pi$}@math{-\pi < \arg(z) <= \pi}.@end deftypefun@deftypefun double gsl_complex_abs (gsl_complex @var{z})@cindex magnitude of complex number This function returns the magnitude of the complex number @var{z}, @math{|z|}.@end deftypefun@deftypefun double gsl_complex_abs2 (gsl_complex @var{z})This function returns the squared magnitude of the complex number@var{z}, @math{|z|^2}.@end deftypefun@deftypefun double gsl_complex_logabs (gsl_complex @var{z})This function returns the natural logarithm of the magnitude of thecomplex number @var{z}, @math{\log|z|}. It allows an accurateevaluation of @math{\log|z|} when @math{|z|} is close to one. The directevaluation of @code{log(gsl_complex_abs(z))} would lead to a loss ofprecision in this case.@end deftypefun@node Complex arithmetic operators@section Complex arithmetic operators@cindex complex arithmetic@deftypefun gsl_complex gsl_complex_add (gsl_complex @var{a}, gsl_complex @var)This function returns the sum of the complex numbers @var{a} and@var, @math{z=a+b}.@end deftypefun@deftypefun gsl_complex gsl_complex_sub (gsl_complex @var{a}, gsl_complex @var)This function returns the difference of the complex numbers @var{a} and@var, @math{z=a-b}.@end deftypefun@deftypefun gsl_complex gsl_complex_mul (gsl_complex @var{a}, gsl_complex @var)This function returns the product of the complex numbers @var{a} and@var, @math{z=ab}.@end deftypefun@deftypefun gsl_complex gsl_complex_div (gsl_complex @var{a}, gsl_complex @var)This function returns the quotient of the complex numbers @var{a} and@var, @math{z=a/b}.@end deftypefun@deftypefun gsl_complex gsl_complex_add_real (gsl_complex @var{a}, double @var{x})This function returns the sum of the complex number @var{a} and thereal number @var{x}, @math{z=a+x}.@end deftypefun@deftypefun gsl_complex gsl_complex_sub_real (gsl_complex @var{a}, double @var{x})This function returns the difference of the complex number @var{a} and thereal number @var{x}, @math{z=a-x}.@end deftypefun@deftypefun gsl_complex gsl_complex_mul_real (gsl_complex @var{a}, double @var{x})This function returns the product of the complex number @var{a} and thereal number @var{x}, @math{z=ax}.@end deftypefun@deftypefun gsl_complex gsl_complex_div_real (gsl_complex @var{a}, double @var{x})This function returns the quotient of the complex number @var{a} and thereal number @var{x}, @math{z=a/x}.@end deftypefun@deftypefun gsl_complex gsl_complex_add_imag (gsl_complex @var{a}, double @var{y})This function returns the sum of the complex number @var{a} and theimaginary number @math{i}@var{y}, @math{z=a+iy}.@end deftypefun@deftypefun gsl_complex gsl_complex_sub_imag (gsl_complex @var{a}, double @var{y})This function returns the difference of the complex number @var{a} and theimaginary number @math{i}@var{y}, @math{z=a-iy}.@end deftypefun@deftypefun gsl_complex gsl_complex_mul_imag (gsl_complex @var{a}, double @var{y})This function returns the product of the complex number @var{a} and theimaginary number @math{i}@var{y}, @math{z=a*(iy)}.@end deftypefun@deftypefun gsl_complex gsl_complex_div_imag (gsl_complex @var{a}, double @var{y})This function returns the quotient of the complex number @var{a} and theimaginary number @math{i}@var{y}, @math{z=a/(iy)}.@end deftypefun@deftypefun gsl_complex gsl_complex_conjugate (gsl_complex @var{z})@cindex conjugate of complex numberThis function returns the complex conjugate of the complex number@var{z}, @math{z^* = x - i y}.@end deftypefun@deftypefun gsl_complex gsl_complex_inverse (gsl_complex @var{z})This function returns the inverse, or reciprocal, of the complex number@var{z}, @math{1/z = (x - i y)/(x^2 + y^2)}.@end deftypefun@deftypefun gsl_complex gsl_complex_negative (gsl_complex @var{z})This function returns the negative of the complex number@var{z}, @math{-z = (-x) + i(-y)}.@end deftypefun@node Elementary Complex Functions@section Elementary Complex Functions@deftypefun gsl_complex gsl_complex_sqrt (gsl_complex @var{z})@cindex square root of complex numberThis function returns the square root of the complex number @var{z},@math{\sqrt z}. The branch cut is the negative real axis. The resultalways lies in the right half of the complex plane.@end deftypefun@deftypefun gsl_complex gsl_complex_sqrt_real (double @var{x})This function returns the complex square root of the real number@var{x}, where @var{x} may be negative.@end deftypefun@deftypefun gsl_complex gsl_complex_pow (gsl_complex @var{z}, gsl_complex @var{a})@cindex power of complex number@cindex exponentiation of complex numberThe function returns the complex number @var{z} raised to the complexpower @var{a}, @math{z^a}. This is computed as @math{\exp(\log(z)*a)}using complex logarithms and complex exponentials.@end deftypefun@deftypefun gsl_complex gsl_complex_pow_real (gsl_complex @var{z}, double @var{x})This function returns the complex number @var{z} raised to the realpower @var{x}, @math{z^x}.@end deftypefun@deftypefun gsl_complex gsl_complex_exp (gsl_complex @var{z})This function returns the complex exponential of the complex number@var{z}, @math{\exp(z)}.@end deftypefun@deftypefun gsl_complex gsl_complex_log (gsl_complex @var{z})@cindex logarithm of complex numberThis function returns the complex natural logarithm (base @math{e}) ofthe complex number @var{z}, @math{\log(z)}. The branch cut is thenegative real axis.
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -