| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The functions described in this chapter provide support for complex numbers. The algorithms take care to avoid unnecessary intermediate underflows and overflows, allowing the functions to be evaluated over as much of the complex plane as possible.
For multiple-valued functions the branch cuts have been chosen to follow the conventions of Abramowitz and Stegun in the Handbook of Mathematical Functions. The functions return principal values which are the same as those in GNU Calc, which in turn are the same as those in Common Lisp, The Language (Second Edition)(1) and the HP-28/48 series of calculators.
The complex types are defined in the header file ‘gsl_complex.h’, while the corresponding complex functions and arithmetic operations are defined in ‘gsl_complex_math.h’.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Complex numbers are represented using the type gsl_complex. The
internal representation of this type may vary across platforms and
should not be accessed directly. The functions and macros described
below allow complex numbers to be manipulated in a portable way.
For reference, the default form of the gsl_complex type is
given by the following struct,
typedef struct
{
double dat[2];
} gsl_complex;
|
The real and imaginary part are stored in contiguous elements of a two
element array. This eliminates any padding between the real and
imaginary parts, dat[0] and dat[1], allowing the struct to
be mapped correctly onto packed complex arrays.
This function uses the rectangular cartesian components
(x,y) to return the complex number
.
This function returns the complex number
from the polar representation
(r,theta).
These macros return the real and imaginary parts of the complex number z.
This macro uses the cartesian components (x,y) to set the real and imaginary parts of the complex number pointed to by zp. For example,
GSL_SET_COMPLEX(&z, 3, 4) |
sets z to be
.
These macros allow the real and imaginary parts of the complex number pointed to by zp to be set independently.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This function returns the argument of the complex number z,
, where
.
This function returns the magnitude of the complex number z,
.
This function returns the squared magnitude of the complex number
z,
.
This function returns the natural logarithm of the magnitude of the
complex number z,
. It allows an accurate
evaluation of
when
is close to one. The direct
evaluation of log(gsl_complex_abs(z)) would lead to a loss of
precision in this case.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This function returns the sum of the complex numbers a and
b,
.
This function returns the difference of the complex numbers a and
b,
.
This function returns the product of the complex numbers a and
b,
.
This function returns the quotient of the complex numbers a and
b,
.
This function returns the sum of the complex number a and the
real number x,
.
This function returns the difference of the complex number a and the
real number x,
.
This function returns the product of the complex number a and the
real number x,
.
This function returns the quotient of the complex number a and the
real number x,
.
This function returns the sum of the complex number a and the
imaginary number
y,
.
This function returns the difference of the complex number a and the
imaginary number
y,
.
This function returns the product of the complex number a and the
imaginary number
y,
.
This function returns the quotient of the complex number a and the
imaginary number
y,
.
This function returns the complex conjugate of the complex number
z,
.
This function returns the inverse, or reciprocal, of the complex number
z,
.
This function returns the negative of the complex number
z,
.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This function returns the square root of the complex number z,
. The branch cut is the negative real axis. The result
always lies in the right half of the complex plane.
This function returns the complex square root of the real number x, where x may be negative.
The function returns the complex number z raised to the complex
power a,
. This is computed as
using complex logarithms and complex exponentials.
This function returns the complex number z raised to the real
power x,
.
This function returns the complex exponential of the complex number
z,
.
This function returns the complex natural logarithm (base
) of
the complex number z,
. The branch cut is the
negative real axis.
This function returns the complex base-10 logarithm of
the complex number z,
.
This function returns the complex base-b logarithm of the complex
number z,
. This quantity is computed as the ratio
.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This function returns the complex sine of the complex number z,
.
This function returns the complex cosine of the complex number z,
.
This function returns the complex tangent of the complex number z,
.
This function returns the complex secant of the complex number z,
.
This function returns the complex cosecant of the complex number z,
.
This function returns the complex cotangent of the complex number z,
.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This function returns the complex arcsine of the complex number z,
. The branch cuts are on the real axis, less than
and greater than
.
This function returns the complex arcsine of the real number z,
. For
between
and
, the
function returns a real value in the range
. For
less than
the result has a real part of
and a positive imaginary part. For
greater than
the
result has a real part of
and a negative imaginary part.
This function returns the complex arccosine of the complex number z,
. The branch cuts are on the real axis, less than
and greater than
.
This function returns the complex arccosine of the real number z,
. For
between
and
, the
function returns a real value in the range
. For
less than
the result has a real part of
and a
negative imaginary part. For
greater than
the result
is purely imaginary and positive.
This function returns the complex arctangent of the complex number
z,
. The branch cuts are on the imaginary axis,
below
and above
.
This function returns the complex arcsecant of the complex number z,
.
This function returns the complex arcsecant of the real number z,
.
This function returns the complex arccosecant of the complex number z,
.
This function returns the complex arccosecant of the real number z,
.
This function returns the complex arccotangent of the complex number z,
.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This function returns the complex hyperbolic sine of the complex number
z,
.
This function returns the complex hyperbolic cosine of the complex number
z,
.
This function returns the complex hyperbolic tangent of the complex number
z,
.
This function returns the complex hyperbolic secant of the complex
number z,
.
This function returns the complex hyperbolic cosecant of the complex
number z,
.
This function returns the complex hyperbolic cotangent of the complex
number z,
.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This function returns the complex hyperbolic arcsine of the
complex number z,
. The branch cuts are on the
imaginary axis, below
and above
.
This function returns the complex hyperbolic arccosine of the complex
number z,
. The branch cut is on the real
axis, less than
. Note that in this case we use the negative
square root in formula 4.6.21 of Abramowitz & Stegun giving
.
This function returns the complex hyperbolic arccosine of
the real number z,
.
This function returns the complex hyperbolic arctangent of the complex
number z,
. The branch cuts are on the real
axis, less than
and greater than
.
This function returns the complex hyperbolic arctangent of the real
number z,
.
This function returns the complex hyperbolic arcsecant of the complex
number z,
.
This function returns the complex hyperbolic arccosecant of the complex
number z,
.
This function returns the complex hyperbolic arccotangent of the complex
number z,
.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The implementations of the elementary and trigonometric functions are based on the following papers,
The general formulas and details of branch cuts can be found in the following books,
| [ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by Autobuild on September, 26 2007 using texi2html 1.78.