|
Packit |
67cb25 |
.. index:: trigonometric functions
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
The library includes its own trigonometric functions in order to provide
|
|
Packit |
67cb25 |
consistency across platforms and reliable error estimates. These
|
|
Packit |
67cb25 |
functions are declared in the header file :file:`gsl_sf_trig.h`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Circular Trigonometric Functions
|
|
Packit |
67cb25 |
--------------------------------
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: sine function, special functions
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: double gsl_sf_sin (double x)
|
|
Packit |
67cb25 |
int gsl_sf_sin_e (double x, gsl_sf_result * result)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These routines compute the sine function :math:`\sin(x)`.
|
|
Packit |
67cb25 |
.. Exceptional Return Values:
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: cosine function, special functions
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: double gsl_sf_cos (double x)
|
|
Packit |
67cb25 |
int gsl_sf_cos_e (double x, gsl_sf_result * result)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These routines compute the cosine function :math:`\cos(x)`.
|
|
Packit |
67cb25 |
.. Exceptional Return Values:
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: hypot function, special functions
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: double gsl_sf_hypot (double x, double y)
|
|
Packit |
67cb25 |
int gsl_sf_hypot_e (double x, double y, gsl_sf_result * result)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These routines compute the hypotenuse function :math:`\sqrt{x^2 + y^2}`
|
|
Packit |
67cb25 |
avoiding overflow and underflow.
|
|
Packit |
67cb25 |
.. Exceptional Return Values:
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: complex sinc function, special functions
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: double gsl_sf_sinc (double x)
|
|
Packit |
67cb25 |
int gsl_sf_sinc_e (double x, gsl_sf_result * result)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These routines compute :math:`\sinc(x) = \sin(\pi x) / (\pi x)` for any
|
|
Packit |
67cb25 |
value of :data:`x`.
|
|
Packit |
67cb25 |
.. Exceptional Return Values: none
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Trigonometric Functions for Complex Arguments
|
|
Packit |
67cb25 |
---------------------------------------------
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: complex sine function, special functions
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_sf_complex_sin_e (double zr, double zi, gsl_sf_result * szr, gsl_sf_result * szi)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function computes the complex sine, :math:`\sin(z_r + i z_i)` storing
|
|
Packit |
67cb25 |
the real and imaginary parts in :data:`szr`, :data:`szi`.
|
|
Packit |
67cb25 |
.. Exceptional Return Values: GSL_EOVRFLW
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: complex cosine function, special functions
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_sf_complex_cos_e (double zr, double zi, gsl_sf_result * czr, gsl_sf_result * czi)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function computes the complex cosine, :math:`\cos(z_r + i z_i)` storing
|
|
Packit |
67cb25 |
the real and imaginary parts in :data:`czr`, :data:`czi`.
|
|
Packit |
67cb25 |
.. Exceptional Return Values: GSL_EOVRFLW
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: complex log sine function, special functions
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_sf_complex_logsin_e (double zr, double zi, gsl_sf_result * lszr, gsl_sf_result * lszi)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function computes the logarithm of the complex sine,
|
|
Packit |
67cb25 |
:math:`\log(\sin(z_r + i z_i))` storing the real and imaginary parts in
|
|
Packit |
67cb25 |
:data:`lszr`, :data:`lszi`.
|
|
Packit |
67cb25 |
.. Exceptional Return Values: GSL_EDOM, GSL_ELOSS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Hyperbolic Trigonometric Functions
|
|
Packit |
67cb25 |
----------------------------------
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index:: logarithm of sinh function, special functions
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: double gsl_sf_lnsinh (double x)
|
|
Packit |
67cb25 |
int gsl_sf_lnsinh_e (double x, gsl_sf_result * result)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These routines compute :math:`\log(\sinh(x))` for :math:`x > 0`.
|
|
Packit |
67cb25 |
.. Domain: x > 0
|
|
Packit |
67cb25 |
.. Exceptional Return Values: GSL_EDOM
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: logarithm of cosh function, special functions
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: double gsl_sf_lncosh (double x)
|
|
Packit |
67cb25 |
int gsl_sf_lncosh_e (double x, gsl_sf_result * result)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These routines compute :math:`\log(\cosh(x))` for any :data:`x`.
|
|
Packit |
67cb25 |
.. Exceptional Return Values: none
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Conversion Functions
|
|
Packit |
67cb25 |
--------------------
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: polar to rectangular conversion
|
|
Packit |
67cb25 |
single: rectangular to polar conversion
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_sf_polar_to_rect (double r, double theta, gsl_sf_result * x, gsl_sf_result * y)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function converts the polar coordinates (:data:`r`, :data:`theta`) to
|
|
Packit |
67cb25 |
rectilinear coordinates (:data:`x`, :data:`y`), :math:`x = r\cos(\theta)`,
|
|
Packit |
67cb25 |
:math:`y = r\sin(\theta)`.
|
|
Packit |
67cb25 |
.. Exceptional Return Values: GSL_ELOSS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_sf_rect_to_polar (double x, double y, gsl_sf_result * r, gsl_sf_result * theta)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function converts the rectilinear coordinates (:data:`x`, :data:`y`) to
|
|
Packit |
67cb25 |
polar coordinates (:data:`r`, :data:`theta`), such that :math:`x = r\cos(\theta)`,
|
|
Packit |
67cb25 |
:math:`y = r\sin(\theta)`. The argument :data:`theta`
|
|
Packit |
67cb25 |
lies in the range :math:`[-\pi, \pi]`.
|
|
Packit |
67cb25 |
.. Exceptional Return Values: GSL_EDOM
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Restriction Functions
|
|
Packit |
67cb25 |
---------------------
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: angular reduction
|
|
Packit |
67cb25 |
single: reduction of angular variables
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: double gsl_sf_angle_restrict_symm (double theta)
|
|
Packit |
67cb25 |
int gsl_sf_angle_restrict_symm_e (double * theta)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These routines force the angle :data:`theta` to lie in the range
|
|
Packit |
67cb25 |
:math:`(-\pi,\pi]`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Note that the mathematical value of :math:`\pi` is slightly greater
|
|
Packit |
67cb25 |
than :macro:`M_PI`, so the machine numbers :macro:`M_PI` and :macro:`-M_PI`
|
|
Packit |
67cb25 |
are included in the range.
|
|
Packit |
67cb25 |
.. Exceptional Return Values: GSL_ELOSS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: double gsl_sf_angle_restrict_pos (double theta)
|
|
Packit |
67cb25 |
int gsl_sf_angle_restrict_pos_e (double * theta)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These routines force the angle :data:`theta` to lie in the range :math:`[0, 2\pi)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Note that the mathematical value of :math:`2\pi` is slightly greater
|
|
Packit |
67cb25 |
than :code:`2*M_PI`, so the machine number :code:`2*M_PI` is included in
|
|
Packit |
67cb25 |
the range.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. Exceptional Return Values: GSL_ELOSS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Trigonometric Functions With Error Estimates
|
|
Packit |
67cb25 |
--------------------------------------------
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_sf_sin_err_e (double x, double dx, gsl_sf_result * result)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This routine computes the sine of an angle :data:`x` with an associated
|
|
Packit |
67cb25 |
absolute error :data:`dx`,
|
|
Packit |
67cb25 |
:math:`\sin(x \pm dx)`. Note that this function is provided in the error-handling form only since
|
|
Packit |
67cb25 |
its purpose is to compute the propagated error.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_sf_cos_err_e (double x, double dx, gsl_sf_result * result)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This routine computes the cosine of an angle :data:`x` with an associated
|
|
Packit |
67cb25 |
absolute error :data:`dx`,
|
|
Packit |
67cb25 |
:math:`\cos(x \pm dx)`. Note that this function is provided in the error-handling form only since
|
|
Packit |
67cb25 |
its purpose is to compute the propagated error.
|