The function may be called by the names: s15agc, nag_specfun_erfcx_real or nag_erfcx.
s15agc calculates an approximate value for the scaled complementary error function
Let be the root of the equation (then ). For the value of is based on the following rational Chebyshev expansion for :
where denotes a rational function of degree in the numerator and in the denominator.
For the value of is based on a rational Chebyshev expansion for : for the value is based on the expansion
and for it is based on the expansion
For each expansion, the specific values of and are selected to be minimal such that the maximum relative error in the expansion is of the order , where is the maximum number of decimal digits that can be accurately represented for the particular implementation (see X02BEC).
Asymptotically, . There is a danger of setting underflow in whenever , where is the largest positive model number (see X02ALC) and is the smallest positive model number (see X02AKC). In this case s15agc exits with NW_HI and returns . For in the range , where is the machine precision, the asymptotic value is returned for and s15agc exits with NW_REAL.
There is a danger of setting overflow in whenever . In this case s15agc exits with NW_NEG and returns .
The values of , and are given in the Users' Note for your implementation.
Cody W J (1969) Rational Chebyshev approximations for the error function Math.Comp.23 631–637
1: – doubleInput
On entry: the argument of the function.
2: – NagError *Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
6Error Indicators and Warnings
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
On entry, and the constant .
On entry, and the constant .
On entry, was in the interval where is approximately : .
The relative error in computing may be estimated by evaluating
where denotes repeated integration. Empirical results suggest that on the interval the loss in base significant digits for maximum relative error is around , while for root-mean-square relative error on that interval it is (see X02BHC for the definition of the model parameter ). On the interval the values are around for maximum and for root-mean-square relative errors; note that on these two intervals is the primary computation. See also Section 7 in s15adc.
8Parallelism and Performance
s15agc is not threaded in any implementation.
This example reads values of the argument from a file, evaluates the function at each value of and prints the results.