Blame doc/specfunc-erf.rst

Packit 67cb25
.. index::
Packit 67cb25
   single: error function
Packit 67cb25
   single: erf(x)
Packit 67cb25
   single: erfc(x)
Packit 67cb25
Packit 67cb25
The error function is described in Abramowitz & Stegun, Chapter 7.  The
Packit 67cb25
functions in this section are declared in the header file
Packit 67cb25
:file:`gsl_sf_erf.h`.
Packit 67cb25
Packit 67cb25
Error Function
Packit 67cb25
--------------
Packit 67cb25
Packit 67cb25
.. function:: double gsl_sf_erf (double x)
Packit 67cb25
              int gsl_sf_erf_e (double x, gsl_sf_result * result)
Packit 67cb25
Packit 67cb25
   These routines compute the error function :math:`\erf(x)`,
Packit 67cb25
   where
Packit 67cb25
   :math:`\erf(x) = (2/\sqrt{\pi}) \int_0^x dt \exp(-t^2)`.
Packit 67cb25
.. Exceptional Return Values: none
Packit 67cb25
Packit 67cb25
Complementary Error Function
Packit 67cb25
----------------------------
Packit 67cb25
Packit 67cb25
.. function:: double gsl_sf_erfc (double x)
Packit 67cb25
              int gsl_sf_erfc_e (double x, gsl_sf_result * result)
Packit 67cb25
Packit 67cb25
   These routines compute the complementary error function 
Packit 67cb25
   :math:`\erfc(x) = 1 - \erf(x) = (2/\sqrt{\pi}) \int_x^\infty \exp(-t^2)`
Packit 67cb25
.. Exceptional Return Values: none
Packit 67cb25
Packit 67cb25
Log Complementary Error Function
Packit 67cb25
--------------------------------
Packit 67cb25
Packit 67cb25
.. function:: double gsl_sf_log_erfc (double x)
Packit 67cb25
              int gsl_sf_log_erfc_e (double x, gsl_sf_result * result)
Packit 67cb25
Packit 67cb25
   These routines compute the logarithm of the complementary error function
Packit 67cb25
   :math:`\log(\erfc(x))`.
Packit 67cb25
.. Exceptional Return Values: none
Packit 67cb25
Packit 67cb25
Probability functions
Packit 67cb25
---------------------
Packit 67cb25
Packit 67cb25
The probability functions for the Normal or Gaussian distribution are
Packit 67cb25
described in Abramowitz & Stegun, Section 26.2.
Packit 67cb25
Packit 67cb25
.. function:: double gsl_sf_erf_Z (double x)
Packit 67cb25
              int gsl_sf_erf_Z_e (double x, gsl_sf_result * result)
Packit 67cb25
Packit 67cb25
   These routines compute the Gaussian probability density function 
Packit 67cb25
   :math:`Z(x) = (1/\sqrt{2\pi}) \exp(-x^2/2)`
Packit 67cb25
Packit 67cb25
.. function:: double gsl_sf_erf_Q (double x)
Packit 67cb25
              int gsl_sf_erf_Q_e (double x, gsl_sf_result * result)
Packit 67cb25
Packit 67cb25
   These routines compute the upper tail of the Gaussian probability function 
Packit 67cb25
   :math:`Q(x) = (1/\sqrt{2\pi}) \int_x^\infty dt \exp(-t^2/2)`
Packit 67cb25
Packit 67cb25
.. Exceptional Return Values: none
Packit 67cb25
Packit 67cb25
.. index::
Packit 67cb25
   single: hazard function, normal distribution
Packit 67cb25
   single:  Mills' ratio, inverse
Packit 67cb25
Packit 67cb25
The *hazard function* for the normal distribution, 
Packit 67cb25
also known as the inverse Mills' ratio, is defined as,
Packit 67cb25
Packit 67cb25
.. only:: not texinfo
Packit 67cb25
Packit 67cb25
   .. math:: h(x) = {Z(x) \over Q(x)} = \sqrt{2 \over \pi} {\exp(-x^2 / 2) \over \erfc(x/\sqrt 2)}
Packit 67cb25
Packit 67cb25
.. only:: texinfo
Packit 67cb25
Packit 67cb25
   ::
Packit 67cb25
Packit 67cb25
      h(x) = Z(x)/Q(x) = \sqrt{2/\pi} \exp(-x^2 / 2) / \erfc(x/\sqrt 2)
Packit 67cb25
Packit 67cb25
It decreases rapidly as :math:`x` approaches :math:`-\infty` and asymptotes
Packit 67cb25
to :math:`h(x) \sim x` as :math:`x` approaches :math:`+\infty`.
Packit 67cb25
Packit 67cb25
.. function:: double gsl_sf_hazard (double x)
Packit 67cb25
              int gsl_sf_hazard_e (double x, gsl_sf_result * result)
Packit 67cb25
Packit 67cb25
   These routines compute the hazard function for the normal distribution.
Packit 67cb25
.. Exceptional Return Values: GSL_EUNDRFLW