Inverse of the cumulative distribution function

ndtri(y)

Returns the argument x for which the area under the Gaussian probability density function (integrated from minus infinity to x) is equal to y.

Parameters:y (float) – area under the curve.

Description

For small arguments \(0 < y < \exp{(-2)}\), the program computes \(z = \sqrt{-2.0 * \log{y}}\); then the approximation is

\[x = z - \log{(z)}/z - (1/z) P(1/z) / Q(1/z).\]

There are two rational functions P/Q, one for \(0 < y < \exp{(-32)}\) and the other for \(y\) up to \(\exp{(-2)}\). For larger arguments, \(w = y - 0.5\), and

\[x/\sqrt{2\pi} = w + w^3 R(w^2)/S(w^2).\]

Accuracy

  Relative error
arithmetic domain # trials peak rms
DEC 0.125, 1 5500 9.5e-17 2.1e-17
DEC 6e-39, 0.135 3500 5.7e-17 1.3e-17
IEEE 0.125, 1 20000 7.2e-16 1.3e-16
IEEE 3e-308, 0.135 50000 4.6e-16 9.8e-17

Error messages

message condition value returned
ndtri domain x <= 0 -MAXNUM
ndtri domain x >= 1 MAXNUM

Reference: http://www.netlib.org/cephes/doubldoc.html#ndtri