scipy.special.ndtri_exp#
- scipy.special.ndtri_exp(y, out=None) = <wrapped_ufunc 'ndtri_exp'>#
Inverse of
log_ndtrvs x. Allows for greater precision thanndtricomposed withnumpy.expfor very small values of y and for y close to 0.- Parameters:
- yarray_like of float
Function argument
- outndarray, optional
Optional output array for the function results
- Returns:
- scalar or ndarray
Inverse of the log CDF of the standard normal distribution, evaluated at y.
See also
Notes
Array API Standard Support
ndtri_exphas 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.ndtri_expdoes not currently supportoutfor the PyTorch backend.See Support for the array API standard for more information.
Examples
>>> import numpy as np >>> import scipy.special as sc
ndtri_expagrees with the naive implementation when the latter does not suffer from underflow.>>> sc.ndtri_exp(-1) -0.33747496376420244 >>> sc.ndtri(np.exp(-1)) -0.33747496376420244
For extreme values of y, the naive approach fails
>>> sc.ndtri(np.exp(-800)) -inf >>> sc.ndtri(np.exp(-1e-20)) inf
whereas
ndtri_expis still able to compute the result to high precision.>>> sc.ndtri_exp(-800) -39.88469483825668 >>> sc.ndtri_exp(-1e-20) 9.262340089798409