s14ba computes values for the incomplete gamma functions and .
Syntax
C# |
---|
public static void s14ba( double a, double x, double tol, out double p, out double q, out int ifail ) |
Visual Basic |
---|
Public Shared Sub s14ba ( _ a As Double, _ x As Double, _ tol As Double, _ <OutAttribute> ByRef p As Double, _ <OutAttribute> ByRef q As Double, _ <OutAttribute> ByRef ifail As Integer _ ) |
Visual C++ |
---|
public: static void s14ba( double a, double x, double tol, [OutAttribute] double% p, [OutAttribute] double% q, [OutAttribute] int% ifail ) |
F# |
---|
static member s14ba : a : float * x : float * tol : float * p : float byref * q : float byref * ifail : int byref -> unit |
Parameters
- a
- Type: System..::..DoubleOn entry: the argument of the functions.Constraint: .
- x
- Type: System..::..DoubleOn entry: the argument of the functions.Constraint: .
- tol
- Type: System..::..Double
- p
- Type: System..::..Double%On exit: the values of the functions and respectively.
- q
- Type: System..::..Double%On exit: the values of the functions and respectively.
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
s14ba evaluates the incomplete gamma functions in the normalized form
with and , to a user-specified accuracy. With this normalization, .
Several methods are used to evaluate the functions depending on the arguments and , the methods including Taylor expansion for , Legendre's continued fraction for , and power series for . When both and are large, and , the uniform asymptotic expansion of Temme (1987) is employed for greater efficiency – specifically, this expansion is used when and .
Once either or is computed, the other is obtained by subtraction from . In order to avoid loss of relative precision in this subtraction, the smaller of and is computed first.
This method is derived from the method GAM in Gautschi (1979b).
References
Gautschi W (1979a) A computational procedure for incomplete gamma functions ACM Trans. Math. Software 5 466–481
Gautschi W (1979b) Algorithm 542: Incomplete gamma functions ACM Trans. Math. Software 5 482–489
Temme N M (1987) On the computation of the incomplete gamma functions for large values of the parameters Algorithms for Approximation (eds J C Mason and M G Cox) Oxford University Press
Error Indicators and Warnings
Errors or warnings detected by the method:
On entry, .
On entry, .
- Convergence of the Taylor series or Legendre continued fraction fails within iterations. This error is extremely unlikely to occur; if it does, contact NAG.
Accuracy
There are rare occasions when the relative accuracy attained is somewhat less than that specified by parameter tol. However, the error should never exceed more than one or two decimal places. Note also that there is a limit of decimal places on the achievable accuracy, because constants in the method are given to this precision.
Parallelism and Performance
None.
Further Comments
Example
This example reads values of the argument and from a file, evaluates the function and prints the results.
Example program (C#): s14bae.cs