Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

Chapter Contents
Chapter Introduction
NAG Toolbox

# NAG Toolbox: nag_specfun_cdf_normal (s15ab)

## Purpose

nag_specfun_cdf_normal (s15ab) returns the value of the cumulative Normal distribution function, P(x)$P\left(x\right)$, via the function name.

## Syntax

[result, ifail] = s15ab(x)
[result, ifail] = nag_specfun_cdf_normal(x)

## Description

nag_specfun_cdf_normal (s15ab) evaluates an approximate value for the cumulative Normal distribution function
 x P(x) = 1/(sqrt(2π)) ∫ e − u2 / 2du. − ∞
$P(x)=12π∫-∞xe-u2/2du.$
The function is based on the fact that
 P(x) = (1/2)erfc(( − x)/(sqrt(2))) $P(x)=12erfc(-x2)$
and it calls nag_specfun_erfc_real (s15ad) to obtain a value of erfc$\mathit{erfc}$ for the appropriate argument.

## References

Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications

## Parameters

### Compulsory Input Parameters

1:     x – double scalar
The argument x$x$ of the function.

None.

None.

### Output Parameters

1:     result – double scalar
The result of the function.
2:     ifail – int64int32nag_int scalar
${\mathrm{ifail}}={\mathbf{0}}$ unless the function detects an error (see [Error Indicators and Warnings]).

## Error Indicators and Warnings

There are no failure exits from this function. The parameter ifail is included for consistency with other functions in this chapter.

## Accuracy

Because of its close relationship with erfc$\mathit{erfc}$, the accuracy of this function is very similar to that in nag_specfun_erfc_real (s15ad). If ε$\epsilon$ and δ$\delta$ are the relative errors in result and argument, respectively, they are in principle related by
 |ε| ≃ |( x e − (1/2) x2 )/(sqrt(2π)P(x))δ| $|ε|≃ | x e -12 x2 2πP(x) δ |$
so that the relative error in the argument, x$x$, is amplified by a factor, (xe(1/2)x2)/(sqrt(2π)P(x)) $\frac{x{e}^{-\frac{1}{2}{x}^{2}}}{\sqrt{2\pi }P\left(x\right)}$, in the result.
For x$x$ small and for x$x$ positive this factor is always less than one and accuracy is mainly limited by machine precision.
For large negative x$x$ the factor behaves like x2$\text{}\sim {x}^{2}$ and hence to a certain extent relative accuracy is unavoidably lost.
However the absolute error in the result, E$E$, is given by
 |E| ≃ |( x e − (1/2) x2 )/(sqrt(2π))δ| $|E|≃ | x e -12 x2 2π δ |$
so absolute accuracy can be guaranteed for all x$x$.

None.

## Example

```function nag_specfun_cdf_normal_example
x = -20;
[result, ifail] = nag_specfun_cdf_normal(x)
```
```

result =

2.7536e-89

ifail =

0

```
```function s15ab_example
x = -20;
[result, ifail] = s15ab(x)
```
```

result =

2.7536e-89

ifail =

0

```