NAG FL Interface
s22baf (hyperg_confl_real)
1
Purpose
s22baf returns a value for the confluent hypergeometric function ${}_{1}F_{1}\left(a;b;x\right)$ with real parameters $a$ and $b$, and real argument $x$. This function is sometimes also known as Kummer's function $M\left(a,b,x\right)$.
2
Specification
Fortran Interface
Integer, Intent (Inout) 
:: 
ifail 
Real (Kind=nag_wp), Intent (In) 
:: 
a, b, x 
Real (Kind=nag_wp), Intent (Out) 
:: 
m 

C Header Interface
#include <nag.h>
void 
s22baf_ (const double *a, const double *b, const double *x, double *m, Integer *ifail) 

C++ Header Interface
#include <nag.h> extern "C" {
void 
s22baf_ (const double &a, const double &b, const double &x, double &m, Integer &ifail) 
}

The routine may be called by the names s22baf or nagf_specfun_hyperg_confl_real.
3
Description
s22baf returns a value for the confluent hypergeometric function ${}_{1}F_{1}\left(a;b;x\right)$ with real parameters $a$ and $b$, and real argument $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={m}_{f}\times {2}^{{m}_{s}}$ 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 an 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
where
${\left(a\right)}_{s}=1\left(a\right)\left(a+1\right)\left(a+2\right)\dots \left(a+s1\right)$ is the rising factorial of
$a$.
$M\left(a,b,x\right)$ is a solution to the second order ODE (Kummer's Equation):
Given the parameters and argument $\left(a,b,x\right)$, this routine determines a set of safe values $\left\{\left({\alpha}_{i},{\beta}_{i},{\zeta}_{i}\right)\mid i\le 2\right\}$ and selects an appropriate algorithm to accurately evaluate the functions ${M}_{i}\left({\alpha}_{i},{\beta}_{i},{\zeta}_{i}\right)$. The result is then used to construct the solution to the original problem $M\left(a,b,x\right)$ using, where necessary, recurrence relations and/or continuation.
Additionally, an artificial bound, $\mathit{arbnd}$ is placed on the magnitudes of $a$, $b$ and $x$ to minimize the occurrence of overflow in internal calculations. $\mathit{arbnd}=0.0001\times {I}_{\mathrm{max}}$, where ${I}_{\mathrm{max}}={\mathbf{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 for a detailed discussion of the confluent hypergeometric function including special cases, transformations, relations and asymptotic approximations.
4
References
Pearson J (2009) Computation of hypergeometric functions MSc Dissertation, Mathematical Institute, University of Oxford
5
Arguments

1:
$\mathbf{a}$ – Real (Kind=nag_wp)
Input

On entry: the parameter $a$ of the function.
Constraint:
$\left{\mathbf{a}}\right\le \mathit{arbnd}$.

2:
$\mathbf{b}$ – Real (Kind=nag_wp)
Input

On entry: the parameter $b$ of the function.
Constraint:
$\left{\mathbf{b}}\right\le \mathit{arbnd}$.

3:
$\mathbf{x}$ – Real (Kind=nag_wp)
Input

On entry: the argument $x$ of the function.
Constraint:
$\left{\mathbf{x}}\right\le \mathit{arbnd}$.

4:
$\mathbf{m}$ – Real (Kind=nag_wp)
Output

On exit: the solution
$M\left(a,b,x\right)$.
Note: if overflow occurs upon completion, as indicated by
${\mathbf{ifail}}={\mathbf{2}}$,
$\leftM\left(a,b,x\right)\right$ may be assumed to be too large to be representable.
m will be returned as
$\pm {R}_{\mathrm{max}}$, where
${R}_{\mathrm{max}}$ is the largest representable real number (see
x02alf). The sign of
m should match the sign of
$M\left(a,b,x\right)$. If overflow occurs during a subcalculation, as indicated by
${\mathbf{ifail}}={\mathbf{5}}$, the sign may be incorrect, and the true value of
$M\left(a,b,x\right)$ may or may not be greater than
${R}_{\mathrm{max}}$. In either case it is advisable to subsequently use
s22bbf.

5:
$\mathbf{ifail}$ – Integer
Input/Output

On entry:
ifail must be set to
$0$,
$1$ or
$1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $1$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value
$1$ or
$1$ is recommended. If message printing is undesirable, then the value
$1$ is recommended. Otherwise, the value
$0$ is recommended.
When the value $\mathbf{1}$ or $\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit:
${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see
Section 6).
6
Error Indicators and Warnings
If on entry
${\mathbf{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:
 ${\mathbf{ifail}}=1$

Underflow occurred during the evaluation of $M\left(a,b,x\right)$.
The returned value may be inaccurate.
 ${\mathbf{ifail}}=2$

On completion, overflow occurred in the evaluation of $M\left(a,b,x\right)$.
 ${\mathbf{ifail}}=3$

All approximations have completed, and the final residual estimate indicates some precision may have been lost.
Relative residual $\text{}=\u2329\mathit{\text{value}}\u232a$.
 ${\mathbf{ifail}}=4$

All approximations have completed, and the final residual estimate indicates no accuracy can be guaranteed.
Relative residual $\text{}=\u2329\mathit{\text{value}}\u232a$.
 ${\mathbf{ifail}}=5$

Overflow occurred in a subcalculation of $M\left(a,b,x\right)$.
The answer may be completely incorrect.
 ${\mathbf{ifail}}=11$

On entry, ${\mathbf{a}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: $\left{\mathbf{a}}\right\le \mathit{arbnd}=\u2329\mathit{\text{value}}\u232a$.
 ${\mathbf{ifail}}=31$

On entry, ${\mathbf{b}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: $\left{\mathbf{b}}\right\le \mathit{arbnd}=\u2329\mathit{\text{value}}\u232a$.
 ${\mathbf{ifail}}=32$

On entry, ${\mathbf{b}}=\u2329\mathit{\text{value}}\u232a$.
$M\left(a,b,x\right)$ is undefined when $b$ is zero or a negative integer.
 ${\mathbf{ifail}}=51$

On entry, ${\mathbf{x}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: $\left{\mathbf{x}}\right\le \mathit{arbnd}=\u2329\mathit{\text{value}}\u232a$.
 ${\mathbf{ifail}}=99$
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 7 in the Introduction to the NAG Library FL Interface for further information.
 ${\mathbf{ifail}}=399$
Your licence key may have expired or may not have been installed correctly.
See
Section 8 in the Introduction to the NAG Library FL Interface for further information.
 ${\mathbf{ifail}}=999$
Dynamic memory allocation failed.
See
Section 9 in the Introduction to the NAG Library FL Interface for further information.
7
Accuracy
In general, if
${\mathbf{ifail}}={\mathbf{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
$\mathit{res}$ is made internally using equation
(1). If the magnitude of
$\mathit{res}$ is sufficiently large, a
nonzero
ifail
will be returned. Specifically,
${\mathbf{ifail}}={\mathbf{0}}$ 
$\mathit{res}\le 1000\epsilon $ 
${\mathbf{ifail}}={\mathbf{3}}$ 
$1000\epsilon <\mathit{res}\le 0.1$ 
${\mathbf{ifail}}={\mathbf{4}}$ 
$\mathit{res}>0.1$ 
where
$\epsilon $ is the
machine precision as returned by
x02ajf.
A further estimate of the residual can be constructed using equation
(1), and the differential identity,
This estimate is however, dependent upon the error involved in approximating $M\left(a+1,b+1,x\right)$ and $M\left(a+2,b+2,x\right)$.
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={b}_{i}+{b}_{r}=100+\text{1.0E\u22126}$, then on a machine with
$16$ decimal digits of precision, the internal calculation of
${b}_{r}$ 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
Parallelism and Performance
s22baf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
s22baf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the
Users' Note for your implementation for any additional implementationspecific information.
None.
10
Example
This example prints the results returned by s22baf called using parameters $a=13.6$ and $b=14.2$ with $11$ differing values of argument $x$.
10.1
Program Text
10.2
Program Data
None.
10.3
Program Results