scipy.special.erfcinv#
- scipy.special.erfcinv(y, out=None) = <wrapped_ufunc 'erfcinv'>#
Inverse of the complementary error function.
Computes the inverse of the complementary error function.
In the complex domain, there is no unique complex number \(w\) satisfying \(\\operatorname{erfc}(w) = z\). This indicates a true inverse function would be multivalued. When the domain restricts to the real interval \(0 < x < 2\), there is a unique real number satisfying
\[\begin{split}\\operatorname{erfc}(\\operatorname{erfcinv}(x)) = x\end{split}\]It is related to the inverse of the error function by
\[\begin{split}\\operatorname{erfcinv}(1 - x) = \\operatorname{erfinv}(x)\end{split}\]- Parameters:
- yndarray
Argument at which to evaluate. Domain: \([0, 2]\)
- outndarray, optional
Optional output array for the function values
- Returns:
- erfcinvscalar or ndarray
The inverse of \(\\operatorname{erfc}\) of \(y\), element-wise
Notes
Array API Standard Support
erfcinvhas support for Python Array API Standard compatible backends in addition to NumPy. 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
For the NumPy backend, this function supports all NumPy ufunc keyword arguments. Other backends may support
out, but typically none of the other ufunc kwargs.outis typically supported for CuPy and PyTorch, but not currently in cases where SciPy relies on a generic Array API implementation or, for PyTorch on CPU, falls back to the NumPy backend.outis never supported for JAX because JAX arrays are immutable.erfcinvdoes not currently supportoutfor the PyTorch backend.See Array API coverage for more information.
Examples
>>> import numpy as np >>> import matplotlib.pyplot as plt >>> from scipy.special import erfcinv
>>> erfcinv(0.5) 0.4769362762044699
>>> y = np.linspace(0.0, 2.0, num=11) >>> erfcinv(y) array([ inf, 0.9061938 , 0.59511608, 0.37080716, 0.17914345, -0. , -0.17914345, -0.37080716, -0.59511608, -0.9061938 , -inf])
Plot the function:
>>> y = np.linspace(0, 2, 200) >>> fig, ax = plt.subplots() >>> ax.plot(y, erfcinv(y)) >>> ax.grid(True) >>> ax.set_xlabel('y') >>> ax.set_title('erfcinv(y)') >>> plt.show()