S22BAF (PDF version)
S Chapter Contents
S Chapter Introduction
NAG Library Manual

NAG Library Routine Document


Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

S22BAF returns a value for the confluent hypergeometric function F 1 1 a;b;x  with real parameters a, b and x. This function is sometimes also known as Kummer's function Ma,b,x.

2  Specification

REAL (KIND=nag_wp)  A, B, X, M

3  Description

S22BAF returns a value for the confluent hypergeometric function F1 1 a;b;x  with real parameters a, b and x. This function is unbounded or not uniquely defined for b equal to zero or a negative integer.
The associated routine S22BBF performs the same operations, but returns M in the scaled form M=mf×2ms to allow calculations to be performed when M is not representable as a single working precision number. It also accepts the parameters a and b as summations of integer and a decimal fraction, giving higher accuracy when a or b are close to an integer. In such cases, S22BBF should be used when high accuracy is required.
The confluent hypergeometric function is defined by the confluent series
F1 1 a;b;x = Ma,b,x = s=0 as xs bs s! = 1 + a b x + aa+1 bb+1 2! x2 +
where as = 1 a a+1 a+2 a+s-1  is the rising factorial of a. Ma,b,x  is a solution to the second order ODE (Kummer's Equation):
x d2M dx2 + b-x dM dx - a M = 0 . (1)
Given the parameters a,b,x , this routine determines a set of safe parameters αi,βi,ζi i2  and selects an appropriate algorithm to accurately evaluate the functions Mi αi,βi,ζi . The result is then used to construct the solution to the original problem Ma,b,x  using, where necessary, recurrence relations and/or continuation.
Additionally, an artificial bound, arbnd is placed on the magnitudes of a, b and x to minimize the occurrence of overflow in internal calculations. arbnd = 0.0001 × Imax , where Imax=X02BBF. It should, however, not be assumed that this routine will produce an accurate result for all values of a, b and x satisfying this criterion.
Please consult the NIST Digital Library of Mathematical Functions or the companion (2010) for a detailed discussion of the confluent hypergeoemtric function including special cases, transformations, relations and asymptotic approximations.

4  References

NIST Handbook of Mathematical Functions (2010) (eds F W J Olver, D W Lozier, R F Boisvert, C W Clark) Cambridge University Press
Pearson J (2009) Computation of hypergeometric functions MSc Dissertation, Mathematical Institute, University of Oxford

5  Parameters

1:     A – REAL (KIND=nag_wp)Input
On entry: the parameter a of the function.
Constraint: Aarbnd.
2:     B – REAL (KIND=nag_wp)Input
On entry: the parameter b of the function.
Constraint: Barbnd.
3:     X – REAL (KIND=nag_wp)Input
On entry: the argument x of the function.
Constraint: Xarbnd.
4:     M – REAL (KIND=nag_wp)Output
On exit: the solution Ma,b,x.
Note: if overflow occurs upon completion, as indicated by IFAIL=2, Ma,b,x may be assumed to be too large to be representable. M will be returned as ±Rmax, where Rmax is the largest representable real number (see X02ALF). The sign of M should match the sign of Ma,b,x. If overflow occurs during a subcalculation, as indicated by IFAIL=5, the sign may be incorrect, and the true value of Ma,b,x may or may not be greater than Rmax. In either case it is advisable to subsequently use S22BBF.
5:     IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
Underflow occurred during the evaluation of Ma,b,x.
The returned value may be inaccurate.
On completion, overflow occurred in the evaluation of Ma,b,x.
All approximations have completed, and the final residual estimate indicates some precision may have been lost.
Relative residual =value.
All approximations have completed, and the final residual estimate indicates no accuracy can be guaranteed.
Relative residual =value.
Overflow occurred in a subcalculation of Ma,b,x.
The answer may be completely incorrect.
On entry, A=value.
Constraint: Aarbnd=value.
On entry, B=value.
Constraint: Barbnd=value.
On entry, B=value.
Ma,b,x is undefined when b is zero or a negative integer.
On entry, X=value.
Constraint: Xarbnd=value.

7  Accuracy

In general, if IFAIL=0, the value of M may be assumed accurate, with the possible loss of one or two decimal places. Assuming the result does not under or overflow, an error estimate res is made internally using equation (1). If the magnitude of res is sufficiently large, a nonzero IFAIL will be returned. Specifically,
IFAIL = 0 res1000ε 3 1000ε<res0.1 4 res>0.1 .
A further estimate of the residual can be constructed using equation (1), and the differential identity,
d Ma,b,x dx = ab M a+1,b+1,x , d2 Ma,b,x dx2 = aa+1 bb+1 M a+2,b+2,x .
This estimate is however dependent upon the error involved in approximating M a+1,b+1,x  and M a+2,b+2,x .
Furthermore, the accuracy of the solution, and the error estimate, can be dependent upon the accuracy of the decimal fraction of the input parameters a and b. For example, if b=bi+br=100+1.0E−6, then on a machine with 16 decimal digits of precision, the internal calculation of br will only be accurate to 8 decimal places. This can subsequently pollute the final solution by several decimal places without affecting the residual estimate as greatly. Should you require higher accuracy in such regions, then you should use S22BBF, which requires you to supply the correct decimal fraction.

8  Further Comments


9  Example

This example reads in values for a, b and x and prints the result of S22BAF at these values.

9.1  Program Text

Program Text (s22bafe.f90)

9.2  Program Data

Program Data (s22bafe.d)

9.3  Program Results

Program Results (s22bafe.r)

S22BAF (PDF version)
S Chapter Contents
S Chapter Introduction
NAG Library Manual

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