scipy.special.log_ndtr(x, out=None) = <ufunc 'log_ndtr'>#

Logarithm of Gaussian cumulative distribution function.

Returns the log of the area under the standard Gaussian probability density function, integrated from minus infinity to x:

log(1/sqrt(2*pi) * integral(exp(-t**2 / 2), t=-inf..x))
xarray_like, real or complex


outndarray, optional

Optional output array for the function results

scalar or ndarray

The value of the log of the normal CDF evaluated at x


>>> import numpy as np
>>> from scipy.special import log_ndtr, ndtr

The benefit of log_ndtr(x) over the naive implementation np.log(ndtr(x)) is most evident with moderate to large positive values of x:

>>> x = np.array([6, 7, 9, 12, 15, 25])
>>> log_ndtr(x)
array([-9.86587646e-010, -1.27981254e-012, -1.12858841e-019,
       -1.77648211e-033, -3.67096620e-051, -3.05669671e-138])

The results of the naive calculation for the moderate x values have only 5 or 6 correct significant digits. For values of x greater than approximately 8.3, the naive expression returns 0:

>>> np.log(ndtr(x))
array([-9.86587701e-10, -1.27986510e-12,  0.00000000e+00,
        0.00000000e+00,  0.00000000e+00,  0.00000000e+00])