erf, erfc#

Purpose#

Computes the Gaussian error function (erf()) and its complement (erfc()).

Format#

y = erf(x)#
y = erfc(x)#
Parameters:

x (NxK matrix) – The values used to compute the Gaussian error function or its complement.

Returns:

y (NxK matrix) – the Gaussian error function (erf()) or the complement of the Gaussian error function (erfc()).

Examples#

// Print 3 digits after the decimal point
format /rd 5,3;

// Assign x
x = { .5 .4 .3,
      .6 .8 .3 };

// Compute the Gaussian error function
y = erf(x);

/*
** Compute the complement of the
** Gaussian error function
*/
yc = erfc(x);

After the above code:

x = 0.500 0.400 0.300   y = 0.520 0.428 0.329   yc = 0.480 0.572 0.671
    0.600 0.800 0.300       0.604 0.742 0.329        0.396 0.258 0.671

Remarks#

The erf() and erfc() functions are closely related to the Normal distribution. Such that:

if \(x > 0\)

cdfn(x) = 0.5 * (1 + erf(x / sqrt(2));

and if \(x \leq 0\)

cdfn(x) = 0.5 * erfc(-x / sqrt(2));

See also

Functions cdfN(), cdfNc()