scipy.special.ndtri_exp#

scipy.special.ndtri_exp(y, out=None) = <wrapped_ufunc 'ndtri_exp'>#

Inverse of log_ndtr vs x. Allows for greater precision than ndtri composed with numpy.exp for 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

log_ndtr

log of the standard normal cumulative distribution function

ndtr

standard normal cumulative distribution function

ndtri

standard normal percentile function

Notes

Array API Standard Support

ndtri_exp has 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. out is 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. out is never supported for JAX because JAX arrays are immutable. ndtri_exp does not currently support out for the PyTorch backend.

See Support for the array API standard for more information.

Examples

>>> import numpy as np
>>> import scipy.special as sc

ndtri_exp agrees 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_exp is still able to compute the result to high precision.

>>> sc.ndtri_exp(-800)
-39.88469483825668
>>> sc.ndtri_exp(-1e-20)
9.262340089798409