PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_specfun_1f1_real (s22ba)
Purpose
nag_specfun_1f1_real (s22ba) returns a value for the confluent hypergeometric function with real parameters and , and real argument . This function is sometimes also known as Kummer's function .
Syntax
Description
nag_specfun_1f1_real (s22ba) returns a value for the confluent hypergeometric function with real parameters and , and real argument . This function is unbounded or not uniquely defined for equal to zero or a negative integer.
The associated function
nag_specfun_1f1_real_scaled (s22bb) performs the same operations, but returns
in the scaled form
to allow calculations to be performed when
is not representable as a single working precision number. It also accepts the parameters
and
as summations of an integer and a decimal fraction, giving higher accuracy when
or
are close to an integer. In such cases,
nag_specfun_1f1_real_scaled (s22bb) should be used when high accuracy is required.
The confluent hypergeometric function is defined by the confluent series
where
is the rising factorial of
.
is a solution to the second order ODE (Kummer's Equation):
Given the parameters and argument , this function determines a set of safe values and selects an appropriate algorithm to accurately evaluate the functions . The result is then used to construct the solution to the original problem using, where necessary, recurrence relations and/or continuation.
Additionally, an artificial bound, is placed on the magnitudes of , and to minimize the occurrence of overflow in internal calculations. , where . It should, however, not be assumed that this function will produce an accurate result for all values of , and 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.
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
Parameters
Compulsory Input Parameters
- 1:
– double scalar
-
The parameter of the function.
Constraint:
.
- 2:
– double scalar
-
The parameter of the function.
Constraint:
.
- 3:
– double scalar
-
The argument of the function.
Constraint:
.
Optional Input Parameters
None.
Output Parameters
- 1:
– double scalar
-
The solution
.
Note: if overflow occurs upon completion, as indicated by
,
may be assumed to be too large to be representable.
m will be returned as
, where
is the largest representable real number (see
nag_machine_real_largest (x02al)). The sign of
m should match the sign of
. If overflow occurs during a subcalculation, as indicated by
, the sign may be incorrect, and the true value of
may or may not be greater than
. In either case it is advisable to subsequently use
nag_specfun_1f1_real_scaled (s22bb).
- 2:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
Cases prefixed with W are classified as warnings and
do not generate an error of type NAG:error_n. See nag_issue_warnings.
- W
-
Underflow occurred during the evaluation of .
The returned value may be inaccurate.
-
-
On completion, overflow occurred in the evaluation of .
-
-
All approximations have completed, and the final residual estimate indicates some precision may have been lost.
-
-
All approximations have completed, and the final residual estimate indicates no accuracy can be guaranteed.
-
-
Overflow occurred in a subcalculation of .
The answer may be completely incorrect.
-
-
Constraint: .
-
-
Constraint: .
-
-
On entry.
is undefined when is zero or a negative integer.
-
-
Constraint: .
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
In general, if
, the value of
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
is made internally using equation
(1). If the magnitude of
is sufficiently large, a
nonzero
ifail
will be returned. Specifically,
|
|
|
|
|
|
where
is the
machine precision as returned by
nag_machine_precision (x02aj).
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 and .
Furthermore, the accuracy of the solution, and the error estimate, can be dependent upon the accuracy of the decimal fraction of the input parameters
and
. For example, if
, then on a machine with
decimal digits of precision, the internal calculation of
will only be accurate to
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
nag_specfun_1f1_real_scaled (s22bb), which requires you to supply the correct decimal fraction.
Further Comments
None.
Example
This example prints the results returned by nag_specfun_1f1_real (s22ba) called using parameters and with differing values of argument .
Open in the MATLAB editor:
s22ba_example
function s22ba_example
fprintf('s22ba example results\n\n');
a = 13.6;
b = 14.2;
x = [-4.5:1:5.5];
m = x;
for i = 1:numel(x)
[m(i), ifail] = s22ba(a, b, x(i));
end
fprintf(' x M(%5.2f,%5.2f,x) \n',a,b);
fprintf('%10.2f %14.5e\n', [x;m]);
s22ba example results
x M(13.60,14.20,x)
-4.50 1.38786e-02
-3.50 3.56741e-02
-2.50 9.20723e-02
-1.50 2.38486e-01
-0.50 6.19691e-01
0.50 1.61478e+00
1.50 4.21840e+00
2.50 1.10449e+01
3.50 2.89776e+01
4.50 7.61660e+01
5.50 2.00533e+02
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015