s14bnc evaluates the incomplete gamma functions in the normalized form, for an array of arguments
, for
.
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
.
This function is derived from the function GAM in
Gautschi (1979b).
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
-
1:
– Integer
Input
-
On entry: , the number of points.
Constraint:
.
-
2:
– const double
Input
-
On entry: the argument of the function, for .
Constraint:
, for .
-
3:
– const double
Input
-
On entry: the argument of the function, for .
Constraint:
, for .
-
4:
– double
Input
-
On entry: the relative accuracy required by you in the results. If
s14bnc is entered with
tol greater than
or less than
machine precision, then the value of
machine precision is used instead.
-
5:
– double
Output
-
On exit: , the function values.
-
6:
– double
Output
-
On exit: , the function values.
-
7:
– Integer
Output
-
On exit:
contains the error code for
and
, for
.
- No error.
- .
- .
- Algorithm fails to terminate.
-
8:
– NagError *
Input/Output
-
The
NAG error argument (see
Section 7 in the Introduction to the
NAG Library CL Interface).
There are rare occasions when the relative accuracy attained is somewhat less than that specified by argument
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 function are given to this precision.
Background information to multithreading can be found in the
Multithreading documentation.
The time taken for a call of
s14bnc depends on the precision requested through
tol, and
n.
This example reads values of
a and
x from a file, evaluates the functions at each value of
and
and prints the results.