s15ag returns the value of the scaled complementary error function .
Syntax
C# |
---|
public static double s15ag( double x, out int ifail ) |
Visual Basic |
---|
Public Shared Function s15ag ( _ x As Double, _ <OutAttribute> ByRef ifail As Integer _ ) As Double |
Visual C++ |
---|
public: static double s15ag( double x, [OutAttribute] int% ifail ) |
F# |
---|
static member s15ag : x : float * ifail : int byref -> float |
Parameters
- x
- Type: System..::..DoubleOn entry: the argument of the function.
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Return Value
s15ag returns the value of the scaled complementary error function .
Description
s15ag 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 x02be).
Asymptotically, . There is a danger of setting underflow in whenever , where is the largest positive model number (see x02al) and is the smallest positive model number (see x02ak). In this case s15ag exits with and returns . For in the range , where is the machine precision, the asymptotic value is returned for and s15ag exits with .
There is a danger of setting overflow in whenever . In this case s15ag exits with and returns .
The values of , and are given in the Users' Note for your implementation.
References
Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
Cody W J (1969) Rational Chebyshev approximations for the error function Math.Comp. 23 631–637
Error Indicators and Warnings
Note: s15ag may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the method:
- On entry, (see [Description]). On failure the function value returned is .
- On entry, (see [Description]). On failure the function value returned is .
- On entry, (see [Description]). On failure the function value returned is the largest positive model number.
Accuracy
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 x02bh 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 [Accuracy] in s15ad.
Parallelism and Performance
None.
Further Comments
None.
Example
This example reads values of the argument from a file, evaluates the function at each value of and prints the results.
Example program (C#): s15age.cs