Errorfunction Module

Error function (erf) and related functions. the error function (also called the Gauss error function), often denoted by erf, is a complex function of a complex variable defined as: erf (z) = 2/√π * \int e^(-t²) dt from 0 to z This integral is a special (non-elementary) sigmoid function that occurs often in probability, statistics, and partial differential equations. In many of these applications, the function argument is a real number. If the function argument is real, then the function value is also real. In statistics, for non-negative values of x, the error function has the following interpretation: for a random variable Y that is normally distributed with mean 0 and standard deviation 1/√2 , erf x is the probability that Y falls in the range [−x, x].

Functions and values

Function or value Description

Erf x

Full Usage: Erf x

Parameters:
    x : float -

Returns: float

Computes the error function. Note that this implementation has only been verified to have a relative error of around 1e-5.

x : float

Returns: float

Example

Erfc x

Full Usage: Erfc x

Parameters:
    x : float -

Returns: float

Computes the complement of the error function. Note that this implementation has only been verified to have a relative error of around 1e-4.

x : float

Returns: float

Example

_erfcx x

Full Usage: _erfcx x

Parameters:
    x : float - Input to compute exp(x**2) * erfc(x)

Returns: float

Scaled complementary error function, exp(x**2) * erfc(x). The caller is responsible to handle edge cases such as nan, infinity, and -infinity in the input

x : float

Input to compute exp(x**2) * erfc(x)

Returns: float

erfcx x

Full Usage: erfcx x

Parameters:
    x : float - Input to compute exp(x**2) * erfc(x)

Returns: float

Scaled complementary error function, exp(x**2) * erfc(x). Edge cases in the input (nan, infinity, and -infinity) are catched and handled. This might be slower than the unchecked version `_erfcx` but does not require input sanitation to get expected results for these cases.

x : float

Input to compute exp(x**2) * erfc(x)

Returns: float

inverf x

Full Usage: inverf x

Parameters:
    x : float -

Returns: float

inverse of error function. uses newton refinement; from https://libit.sourceforge.net/
accuracy to the fifth digit

x : float

Returns: float

Example

inverfc x

Full Usage: inverfc x

Parameters:
    x : float -

Returns: float

inverse of complementary error function
accuracy to the fifth digit

x : float

Returns: float

Example