nag_erfc (s15adc) (PDF version)
s Chapter Contents
s Chapter Introduction
NAG C Library Manual

NAG Library Function Document

nag_erfc (s15adc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_erfc (s15adc) returns the value of the complementary error function, erfcx .

2  Specification

#include <nag.h>
#include <nags.h>
double  nag_erfc (double x)

3  Description

nag_erfc (s15adc) calculates an approximate value for the complement of the error function
erfcx = 2 π x e - u 2 du = 1 - erfx .
The approximation is based on a Chebyshev expansion.

4  References

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

5  Arguments

1:     xdoubleInput
On entry: the argument x  of the function.

6  Error Indicators and Warnings

None.

7  Accuracy

If δ  and ε  are relative errors in the argument and result, respectively, then in principle ε 2 xe - x 2 / π erfcx δ , so that the relative error in the argument, x , is amplified by a factor 2 xe - x 2 / π erfcx  in the result.
Near x=0  this factor behaves as 2x / π  and hence the accuracy is largely determined by the machine precision. Also for large negative x , where the factor is xe - x 2 / π , accuracy is mainly limited by machine precision. However, for large positive x , the factor becomes 2 x 2  and to an extent relative accuracy is necessarily lost. The absolute accuracy E  is given by E 2 xe - x 2 / π δ  so absolute accuracy is guaranteed for all x .

8  Further Comments

None.

9  Example

The following program reads values of the argument x  from a file, evaluates the function at each value of x  and prints the results.

9.1  Program Text

Program Text (s15adce.c)

9.2  Program Data

Program Data (s15adce.d)

9.3  Program Results

Program Results (s15adce.r)


nag_erfc (s15adc) (PDF version)
s Chapter Contents
s Chapter Introduction
NAG C Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012