fn

ndtr

Tensor
ndtr(x: Tensor)
source

Standard normal cumulative distribution function.

Evaluates Φ(x)=P(Zx)\Phi(x) = P(Z \le x) where ZZ is a standard normal random variable. Implemented as a thin wrapper around the error function via the textbook identity Φ(x)=12(1+erf(x/2))\Phi(x) = \tfrac{1}{2}\,(1 + \mathrm{erf}(x/\sqrt{2})).

Parameters

xTensor
Input tensor; any floating-point dtype.

Returns

Tensor

Φ(x)\Phi(x) element-wise, same shape and dtype as x; values lie in (0, 1).

Notes

Definition:

Φ(x)=12πxet2/2dt=12(1+erf ⁣(x2)).\Phi(x) = \frac{1}{\sqrt{2\pi}} \int_{-\infty}^x e^{-t^2/2}\, dt = \frac{1}{2}\left(1 + \mathrm{erf}\!\left( \frac{x}{\sqrt{2}}\right)\right).

For x deep in the left tail, ndtr underflows to 0 and losses precision; prefer log_ndtr for log-domain work. Special values: Φ()=0\Phi(-\infty) = 0, Φ(0)=0.5\Phi(0) = 0.5, Φ(+)=1\Phi(+\infty) = 1.

Examples

>>> import lucid
>>> from lucid.special import ndtr
>>> ndtr(lucid.tensor([-3.0, -1.0, 0.0, 1.0, 3.0]))
Tensor([0.0013, 0.1587, 0.5000, 0.8413, 0.9987])