Skip to main content
`Ctrl`+`K`

# scipy.special.log_ndtr

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))

  Parameters:
    x array_like, real or complex

      Argument

    out ndarray, optional

      Optional output array for the function results

  Returns:
    scalar or ndarray

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

  See also

  `erf`
  `erfc`
  `scipy.stats.norm`
  `ndtr`

  Notes

  `log_ndtr` 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.

  Examples

      >>> 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])