hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_specfun_compcdf_normal (s15ac)

Purpose

nag_specfun_compcdf_normal (s15ac) returns the value of the complement of the cumulative Normal distribution function, Q(x)Q(x), via the function name.

Syntax

[result, ifail] = s15ac(x)
[result, ifail] = nag_specfun_compcdf_normal(x)

Description

nag_specfun_compcdf_normal (s15ac) evaluates an approximate value for the complement of the cumulative Normal distribution function
Q(x) = 1/(sqrt(2π))eu2 / 2du.
x
Q(x)=12πxe-u2/2du.
The function is based on the fact that
Q(x) = (1/2)erfc(x/(sqrt(2)))
Q(x)=12erfc(x2)
and it calls nag_specfun_erfc_real (s15ad) to obtain the necessary value of erfcerfc, the complementary error function.

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 xx of the function.

Optional Input Parameters

None.

Input Parameters Omitted from the MATLAB Interface

None.

Output Parameters

1:     result – double scalar
The result of the function.
2:     ifail – int64int32nag_int scalar
ifail = 0ifail=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 erfcerfc the accuracy of this function is very similar to that in nag_specfun_erfc_real (s15ad). If εε and δδ are the relative errors in result and argument, respectively, then in principle they are related by
|ε| |( x e x2 / 2 )/(sqrt(2π)Q(x))δ| .
|ε| | x e -x2/2 2πQ(x) δ | .
For xx negative or small positive this factor is always less than one and accuracy is mainly limited by machine precision. For large positive xx we find εx2δεx2δ and hence to a certain extent relative accuracy is unavoidably lost. However the absolute error in the result, EE, is given by
|E| |( x ex2 / 2 )/(sqrt(2π))δ|
|E| | x e -x2/2 2π δ |
and since this factor is always less than one absolute accuracy can be guaranteed for all xx.

Further Comments

None.

Example

function nag_specfun_compcdf_normal_example
x = -20;
[result, ifail] = nag_specfun_compcdf_normal(x)
 

result =

     1


ifail =

                    0


function s15ac_example
x = -20;
[result, ifail] = s15ac(x)
 

result =

     1


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013