scipy.special.erf#

scipy.special.erf(z, out=None) = <ufunc 'erf'>#

Returns the error function of complex argument.

It is defined as 2/sqrt(pi)*integral(exp(-t**2), t=0..z).

Parameters:
xndarray

Input array.

outndarray, optional

Optional output array for the function values

Returns:
resscalar or ndarray

The values of the error function at the given points x.

See also

erfc, erfinv, erfcinv, wofz, erfcx, erfi

Notes

The cumulative of the unit normal distribution is given by Phi(z) = 1/2[1 + erf(z/sqrt(2))].

erf has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable SCIPY_ARRAY_API=1 and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.

Library

CPU

GPU

NumPy

n/a

CuPy

n/a

PyTorch

JAX

Dask

n/a

See Support for the array API standard for more information.

References

[2]

Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972. http://www.math.sfu.ca/~cbm/aands/page_297.htm

[3]

Steven G. Johnson, Faddeeva W function implementation. http://ab-initio.mit.edu/Faddeeva

Examples

>>> import numpy as np
>>> from scipy import special
>>> import matplotlib.pyplot as plt
>>> x = np.linspace(-3, 3)
>>> plt.plot(x, special.erf(x))
>>> plt.xlabel('$x$')
>>> plt.ylabel('$erf(x)$')
>>> plt.show()
../../_images/scipy-special-erf-1.png