|
Packit |
67cb25 |
.. index:: complex numbers
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
***************
|
|
Packit |
67cb25 |
Complex Numbers
|
|
Packit |
67cb25 |
***************
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
The functions described in this chapter provide support for complex
|
|
Packit |
67cb25 |
numbers. The algorithms take care to avoid unnecessary intermediate
|
|
Packit |
67cb25 |
underflows and overflows, allowing the functions to be evaluated over
|
|
Packit |
67cb25 |
as much of the complex plane as possible.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. FIXME: this still needs to be
|
|
Packit |
67cb25 |
.. done for the csc,sec,cot,csch,sech,coth functions
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
For multiple-valued functions the branch cuts have been chosen to follow
|
|
Packit |
67cb25 |
the conventions of Abramowitz and Stegun.
|
|
Packit |
67cb25 |
The functions return principal values which are
|
|
Packit |
67cb25 |
the same as those in GNU Calc, which in turn are the same as those in
|
|
Packit |
67cb25 |
"Common Lisp, The Language (Second Edition)" [#f1]_
|
|
Packit |
67cb25 |
and the HP-28/48 series of calculators.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
The complex types are defined in the header file :file:`gsl_complex.h`,
|
|
Packit |
67cb25 |
while the corresponding complex functions and arithmetic operations are
|
|
Packit |
67cb25 |
defined in :file:`gsl_complex_math.h`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: representations of complex numbers
|
|
Packit |
67cb25 |
single: polar form of complex numbers
|
|
Packit |
67cb25 |
single: gsl_complex
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Representation of complex numbers
|
|
Packit |
67cb25 |
=================================
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Complex numbers are represented using the type :code:`gsl_complex`. The
|
|
Packit |
67cb25 |
internal representation of this type may vary across platforms and
|
|
Packit |
67cb25 |
should not be accessed directly. The functions and macros described
|
|
Packit |
67cb25 |
below allow complex numbers to be manipulated in a portable way.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
For reference, the default form of the :code:`gsl_complex` type is
|
|
Packit |
67cb25 |
given by the following struct::
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
typedef struct
|
|
Packit |
67cb25 |
{
|
|
Packit |
67cb25 |
double dat[2];
|
|
Packit |
67cb25 |
} gsl_complex;
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
The real and imaginary part are stored in contiguous elements of a two
|
|
Packit |
67cb25 |
element array. This eliminates any padding between the real and
|
|
Packit |
67cb25 |
imaginary parts, :code:`dat[0]` and :code:`dat[1]`, allowing the struct to
|
|
Packit |
67cb25 |
be mapped correctly onto packed complex arrays.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_rect (double x, double y)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function uses the rectangular Cartesian components
|
|
Packit |
67cb25 |
:math:`(x,y)` to return the complex number :math:`z = x + i y`.
|
|
Packit |
67cb25 |
An inline version of this function is used when :macro:`HAVE_INLINE`
|
|
Packit |
67cb25 |
is defined.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_polar (double r, double theta)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex number :math:`z = r \exp(i \theta) = r
|
|
Packit |
67cb25 |
(\cos(\theta) + i \sin(\theta))` from the polar representation
|
|
Packit |
67cb25 |
(:data:`r`, :data:`theta`).
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. macro::
|
|
Packit |
67cb25 |
GSL_REAL (z)
|
|
Packit |
67cb25 |
GSL_IMAG (z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These macros return the real and imaginary parts of the complex number
|
|
Packit |
67cb25 |
:data:`z`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. macro:: GSL_SET_COMPLEX (zp, x, y)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This macro uses the Cartesian components (:data:`x`, :data:`y`) to set the
|
|
Packit |
67cb25 |
real and imaginary parts of the complex number pointed to by :data:`zp`.
|
|
Packit |
67cb25 |
For example::
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
GSL_SET_COMPLEX(&z, 3, 4)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
sets :math:`z` to be :math:`3 + 4i`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. macro::
|
|
Packit |
67cb25 |
GSL_SET_REAL (zp,x)
|
|
Packit |
67cb25 |
GSL_SET_IMAG (zp,y)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These macros allow the real and imaginary parts of the complex number
|
|
Packit |
67cb25 |
pointed to by :data:`zp` to be set independently.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Properties of complex numbers
|
|
Packit |
67cb25 |
=============================
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index:: argument of complex number
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: double gsl_complex_arg (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the argument of the complex number :data:`z`,
|
|
Packit |
67cb25 |
:math:`\arg(z)`, where :math:`-\pi < \arg(z) <= \pi`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index:: magnitude of complex number
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: double gsl_complex_abs (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the magnitude of the complex number :data:`z`, :math:`|z|`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: double gsl_complex_abs2 (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the squared magnitude of the complex number
|
|
Packit |
67cb25 |
:data:`z`, :math:`|z|^2`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: double gsl_complex_logabs (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the natural logarithm of the magnitude of the
|
|
Packit |
67cb25 |
complex number :data:`z`, :math:`\log|z|`. It allows an accurate
|
|
Packit |
67cb25 |
evaluation of :math:`\log|z|` when :math:`|z|` is close to one. The direct
|
|
Packit |
67cb25 |
evaluation of :code:`log(gsl_complex_abs(z))` would lead to a loss of
|
|
Packit |
67cb25 |
precision in this case.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index:: complex arithmetic
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Complex arithmetic operators
|
|
Packit |
67cb25 |
============================
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_add (gsl_complex a, gsl_complex b)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the sum of the complex numbers :data:`a` and
|
|
Packit |
67cb25 |
:data:`b`, :math:`z=a+b`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_sub (gsl_complex a, gsl_complex b)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the difference of the complex numbers :data:`a` and
|
|
Packit |
67cb25 |
:data:`b`, :math:`z=a-b`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_mul (gsl_complex a, gsl_complex b)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the product of the complex numbers :data:`a` and
|
|
Packit |
67cb25 |
:data:`b`, :math:`z=ab`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_div (gsl_complex a, gsl_complex b)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the quotient of the complex numbers :data:`a` and
|
|
Packit |
67cb25 |
:data:`b`, :math:`z=a/b`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_add_real (gsl_complex a, double x)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the sum of the complex number :data:`a` and the
|
|
Packit |
67cb25 |
real number :data:`x`, :math:`z=a+x`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_sub_real (gsl_complex a, double x)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the difference of the complex number :data:`a` and the
|
|
Packit |
67cb25 |
real number :data:`x`, :math:`z=a-x`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_mul_real (gsl_complex a, double x)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the product of the complex number :data:`a` and the
|
|
Packit |
67cb25 |
real number :data:`x`, :math:`z=ax`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_div_real (gsl_complex a, double x)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the quotient of the complex number :data:`a` and the
|
|
Packit |
67cb25 |
real number :data:`x`, :math:`z=a/x`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_add_imag (gsl_complex a, double y)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the sum of the complex number :data:`a` and the
|
|
Packit |
67cb25 |
imaginary number :math:`iy`, :math:`z=a+iy`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_sub_imag (gsl_complex a, double y)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the difference of the complex number :data:`a` and the
|
|
Packit |
67cb25 |
imaginary number :math:`iy`, :math:`z=a-iy`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_mul_imag (gsl_complex a, double y)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the product of the complex number :data:`a` and the
|
|
Packit |
67cb25 |
imaginary number :math:`iy`, :math:`z=a*(iy)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_div_imag (gsl_complex a, double y)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the quotient of the complex number :data:`a` and the
|
|
Packit |
67cb25 |
imaginary number :math:`iy`, :math:`z=a/(iy)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index:: conjugate of complex number
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_conjugate (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex conjugate of the complex number
|
|
Packit |
67cb25 |
:data:`z`, :math:`z^* = x - i y`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_inverse (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the inverse, or reciprocal, of the complex number
|
|
Packit |
67cb25 |
:data:`z`, :math:`1/z = (x - i y)/(x^2 + y^2)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_negative (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the negative of the complex number
|
|
Packit |
67cb25 |
:data:`z`, :math:`-z = (-x) + i(-y)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Elementary Complex Functions
|
|
Packit |
67cb25 |
============================
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index:: square root of complex number
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_sqrt (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the square root of the complex number :data:`z`,
|
|
Packit |
67cb25 |
:math:`\sqrt z`. The branch cut is the negative real axis. The result
|
|
Packit |
67cb25 |
always lies in the right half of the complex plane.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_sqrt_real (double x)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex square root of the real number
|
|
Packit |
67cb25 |
:data:`x`, where :data:`x` may be negative.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: power of complex number
|
|
Packit |
67cb25 |
single: exponentiation of complex number
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_pow (gsl_complex z, gsl_complex a)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
The function returns the complex number :data:`z` raised to the complex
|
|
Packit |
67cb25 |
power :data:`a`, :math:`z^a`. This is computed as :math:`\exp(\log(z)*a)`
|
|
Packit |
67cb25 |
using complex logarithms and complex exponentials.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_pow_real (gsl_complex z, double x)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex number :data:`z` raised to the real
|
|
Packit |
67cb25 |
power :data:`x`, :math:`z^x`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_exp (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex exponential of the complex number
|
|
Packit |
67cb25 |
:data:`z`, :math:`\exp(z)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index:: logarithm of complex number
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_log (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex natural logarithm (base :math:`e`) of
|
|
Packit |
67cb25 |
the complex number :data:`z`, :math:`\log(z)`. The branch cut is the
|
|
Packit |
67cb25 |
negative real axis.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_log10 (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex base-10 logarithm of
|
|
Packit |
67cb25 |
the complex number :data:`z`, :math:`\log_{10} (z)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_log_b (gsl_complex z, gsl_complex b)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex base-:data:`b` logarithm of the complex
|
|
Packit |
67cb25 |
number :data:`z`, :math:`\log_b(z)`. This quantity is computed as the ratio
|
|
Packit |
67cb25 |
:math:`\log(z)/\log(b)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index:: trigonometric functions of complex numbers
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Complex Trigonometric Functions
|
|
Packit |
67cb25 |
===============================
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: sin, of complex number
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_sin (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex sine of the complex number :data:`z`,
|
|
Packit |
67cb25 |
:math:`\sin(z) = (\exp(iz) - \exp(-iz))/(2i)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index:: cosine of complex number
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_cos (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex cosine of the complex number :data:`z`,
|
|
Packit |
67cb25 |
:math:`\cos(z) = (\exp(iz) + \exp(-iz))/2`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index:: tangent of complex number
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_tan (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex tangent of the complex number :data:`z`,
|
|
Packit |
67cb25 |
:math:`\tan(z) = \sin(z)/\cos(z)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_sec (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex secant of the complex number :data:`z`,
|
|
Packit |
67cb25 |
:math:`\sec(z) = 1/\cos(z)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_csc (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex cosecant of the complex number :data:`z`,
|
|
Packit |
67cb25 |
:math:`\csc(z) = 1/\sin(z)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_cot (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex cotangent of the complex number :data:`z`,
|
|
Packit |
67cb25 |
:math:`\cot(z) = 1/\tan(z)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index:: inverse complex trigonometric functions
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Inverse Complex Trigonometric Functions
|
|
Packit |
67cb25 |
=======================================
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_arcsin (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex arcsine of the complex number :data:`z`,
|
|
Packit |
67cb25 |
:math:`\arcsin(z)`. The branch cuts are on the real axis, less than :math:`-1`
|
|
Packit |
67cb25 |
and greater than :math:`1`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_arcsin_real (double z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex arcsine of the real number :data:`z`,
|
|
Packit |
67cb25 |
:math:`\arcsin(z)`. For :math:`z` between :math:`-1` and :math:`1`, the
|
|
Packit |
67cb25 |
function returns a real value in the range :math:`[-\pi/2,\pi/2]`. For
|
|
Packit |
67cb25 |
:math:`z` less than :math:`-1` the result has a real part of :math:`-\pi/2`
|
|
Packit |
67cb25 |
and a positive imaginary part. For :math:`z` greater than :math:`1` the
|
|
Packit |
67cb25 |
result has a real part of :math:`\pi/2` and a negative imaginary part.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_arccos (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex arccosine of the complex number :data:`z`,
|
|
Packit |
67cb25 |
:math:`\arccos(z)`. The branch cuts are on the real axis, less than :math:`-1`
|
|
Packit |
67cb25 |
and greater than :math:`1`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_arccos_real (double z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex arccosine of the real number :data:`z`,
|
|
Packit |
67cb25 |
:math:`\arccos(z)`. For :math:`z` between :math:`-1` and :math:`1`, the
|
|
Packit |
67cb25 |
function returns a real value in the range :math:`[0,\pi]`. For :math:`z`
|
|
Packit |
67cb25 |
less than :math:`-1` the result has a real part of :math:`\pi` and a
|
|
Packit |
67cb25 |
negative imaginary part. For :math:`z` greater than :math:`1` the result
|
|
Packit |
67cb25 |
is purely imaginary and positive.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_arctan (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex arctangent of the complex number
|
|
Packit |
67cb25 |
:data:`z`, :math:`\arctan(z)`. The branch cuts are on the imaginary axis,
|
|
Packit |
67cb25 |
below :math:`-i` and above :math:`i`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_arcsec (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex arcsecant of the complex number :data:`z`,
|
|
Packit |
67cb25 |
:math:`\arcsec(z) = \arccos(1/z)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_arcsec_real (double z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex arcsecant of the real number :data:`z`,
|
|
Packit |
67cb25 |
:math:`\arcsec(z) = \arccos(1/z)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_arccsc (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex arccosecant of the complex number :data:`z`,
|
|
Packit |
67cb25 |
:math:`\arccsc(z) = \arcsin(1/z)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_arccsc_real (double z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex arccosecant of the real number :data:`z`,
|
|
Packit |
67cb25 |
:math:`\arccsc(z) = \arcsin(1/z)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_arccot (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex arccotangent of the complex number :data:`z`,
|
|
Packit |
67cb25 |
:math:`\arccot(z) = \arctan(1/z)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: hyperbolic functions, complex numbers
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Complex Hyperbolic Functions
|
|
Packit |
67cb25 |
============================
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_sinh (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex hyperbolic sine of the complex number
|
|
Packit |
67cb25 |
:data:`z`, :math:`\sinh(z) = (\exp(z) - \exp(-z))/2`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_cosh (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex hyperbolic cosine of the complex number
|
|
Packit |
67cb25 |
:data:`z`, :math:`\cosh(z) = (\exp(z) + \exp(-z))/2`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_tanh (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex hyperbolic tangent of the complex number
|
|
Packit |
67cb25 |
:data:`z`, :math:`\tanh(z) = \sinh(z)/\cosh(z)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_sech (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex hyperbolic secant of the complex
|
|
Packit |
67cb25 |
number :data:`z`, :math:`\sech(z) = 1/\cosh(z)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_csch (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex hyperbolic cosecant of the complex
|
|
Packit |
67cb25 |
number :data:`z`, :math:`\csch(z) = 1/\sinh(z)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_coth (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex hyperbolic cotangent of the complex
|
|
Packit |
67cb25 |
number :data:`z`, :math:`\coth(z) = 1/\tanh(z)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: inverse hyperbolic functions, complex numbers
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Inverse Complex Hyperbolic Functions
|
|
Packit |
67cb25 |
====================================
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_arcsinh (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex hyperbolic arcsine of the
|
|
Packit |
67cb25 |
complex number :data:`z`, :math:`\arcsinh(z)`. The branch cuts are on the
|
|
Packit |
67cb25 |
imaginary axis, below :math:`-i` and above :math:`i`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_arccosh (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex hyperbolic arccosine of the complex
|
|
Packit |
67cb25 |
number :data:`z`, :math:`\arccosh(z)`. The branch cut is on the real
|
|
Packit |
67cb25 |
axis, less than :math:`1`. Note that in this case we use the negative
|
|
Packit |
67cb25 |
square root in formula 4.6.21 of Abramowitz & Stegun giving
|
|
Packit |
67cb25 |
:math:`\arccosh(z)=\log(z-\sqrt{z^2-1})`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_arccosh_real (double z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex hyperbolic arccosine of
|
|
Packit |
67cb25 |
the real number :data:`z`, :math:`\arccosh(z)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_arctanh (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex hyperbolic arctangent of the complex
|
|
Packit |
67cb25 |
number :data:`z`, :math:`\arctanh(z)`. The branch cuts are on the real
|
|
Packit |
67cb25 |
axis, less than :math:`-1` and greater than :math:`1`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_arctanh_real (double z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex hyperbolic arctangent of the real
|
|
Packit |
67cb25 |
number :data:`z`, :math:`\arctanh(z)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_arcsech (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex hyperbolic arcsecant of the complex
|
|
Packit |
67cb25 |
number :data:`z`, :math:`\arcsech(z) = \arccosh(1/z)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_arccsch (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex hyperbolic arccosecant of the complex
|
|
Packit |
67cb25 |
number :data:`z`, :math:`\arccsch(z) = \arcsinh(1/z)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: gsl_complex gsl_complex_arccoth (gsl_complex z)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function returns the complex hyperbolic arccotangent of the complex
|
|
Packit |
67cb25 |
number :data:`z`, :math:`\arccoth(z) = \arctanh(1/z)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
References and Further Reading
|
|
Packit |
67cb25 |
==============================
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
The implementations of the elementary and trigonometric functions are
|
|
Packit |
67cb25 |
based on the following papers,
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
* T. E. Hull, Thomas F. Fairgrieve, Ping Tak Peter Tang,
|
|
Packit |
67cb25 |
"Implementing Complex Elementary Functions Using Exception
|
|
Packit |
67cb25 |
Handling", ACM Transactions on Mathematical Software, Volume 20
|
|
Packit |
67cb25 |
(1994), pp 215--244, Corrigenda, p553
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
* T. E. Hull, Thomas F. Fairgrieve, Ping Tak Peter Tang,
|
|
Packit |
67cb25 |
"Implementing the complex arcsin and arccosine functions using exception
|
|
Packit |
67cb25 |
handling", ACM Transactions on Mathematical Software, Volume 23
|
|
Packit |
67cb25 |
(1997) pp 299--335
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
The general formulas and details of branch cuts can be found in the
|
|
Packit |
67cb25 |
following books,
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
* Abramowitz and Stegun, Handbook of Mathematical Functions,
|
|
Packit |
67cb25 |
"Circular Functions in Terms of Real and Imaginary Parts", Formulas
|
|
Packit |
67cb25 |
4.3.55--58,
|
|
Packit |
67cb25 |
"Inverse Circular Functions in Terms of Real and Imaginary Parts",
|
|
Packit |
67cb25 |
Formulas 4.4.37--39,
|
|
Packit |
67cb25 |
"Hyperbolic Functions in Terms of Real and Imaginary Parts",
|
|
Packit |
67cb25 |
Formulas 4.5.49--52,
|
|
Packit |
67cb25 |
"Inverse Hyperbolic Functions---relation to Inverse Circular Functions",
|
|
Packit |
67cb25 |
Formulas 4.6.14--19.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
* Dave Gillespie, Calc Manual, Free Software Foundation, ISBN
|
|
Packit |
67cb25 |
1-882114-18-3
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. rubric:: Footnotes
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. [#f1] Note that the first edition uses different definitions.
|