nag_specfun_1f1_real_scaled (s22bbc) (PDF version)
s Chapter Contents
s Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_specfun_1f1_real_scaled (s22bbc)

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_specfun_1f1_real_scaled (s22bbc) returns a value for the confluent hypergeometric function F 1 1 a;b;x , with real parameters a and b and real argument x. The solution is returned in the scaled form F 1 1 a;b;x = mf × 2ms . This function is sometimes also known as Kummer's function Ma,b,x.

2  Specification

#include <nag.h>
#include <nags.h>
void  nag_specfun_1f1_real_scaled (double ani, double adr, double bni, double bdr, double x, double *frm, Integer *scm, NagError *fail)

3  Description

nag_specfun_1f1_real_scaled (s22bbc) returns a value for the confluent hypergeometric function F1 1 a;b;x , with real parameters a and b and real argument x, in the scaled form F1 1 a;b;x = mf × 2 ms , where mf is the real scaled component and ms is the integer power of two scaling. This function is unbounded or not uniquely defined for b equal to zero or a negative integer.
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 and argument a,b,x , this function determines a set of safe values α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.
For improved precision in the final result, this function accepts a and b split into an integral and a decimal fractional component. Specifically a=ai+ar, where ar0.5 and ai=a-ar is integral. b is similarly deconstructed.
Additionally, an artificial bound, arbnd is placed on the magnitudes of ai, bi and x to minimize the occurrence of overflow in internal calculations. arbnd = 0.0001 × Imax , where Imax=X02BBC. It should, however, not be assumed that this function will produce an accurate result for all values of ai, bi 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 hypergeometric 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  Arguments

1:     ani doubleInput
On entry: ai, the nearest integer to a, satisfying ai = a-ar.
Constraints:
  • ani=ani;
  • aniarbnd.
2:     adr doubleInput
On entry: ar, the signed decimal remainder satisfying ar = a-ai  and ar 0.5.
Constraint: adr0.5.
Note: if adr<100.0ε, ar=0.0 will be used, where ε is the machine precision as returned by nag_machine_precision (X02AJC).
3:     bni doubleInput
On entry: bi, the nearest integer to b, satisfying bi=b-br.
Constraints:
  • bni=bni;
  • bniarbnd;
  • if bdr=0.0, bni>0.
4:     bdr doubleInput
On entry: br, the signed decimal remainder satisfying br = b-bi and br 0.5.
Constraint: bdr0.5.
Note: if bdr-adr<100.0ε, ar=br will be used, where ε is the machine precision as returned by nag_machine_precision (X02AJC).
5:     x doubleInput
On entry: the argument x of the function.
Constraint: xarbnd.
6:     frm double *Output
On exit: mf, the scaled real component of the solution satisfying mf=Ma,b,x×2-ms.
Note: if overflow occurs upon completion, as indicated by fail.code= NW_OVERFLOW_WARN, the value of mf returned may still be correct. If overflow occurs in a subcalculation, as indicated by fail.code= NE_OVERFLOW, this should not be assumed.
7:     scm Integer *Output
On exit: ms, the scaling power of two, satisfying ms= log2 Ma,b,x mf .
Note: if overflow occurs upon completion, as indicated by fail.code= NW_OVERFLOW_WARN, then msImax, where Imax is the largest representable integer (see nag_max_integer (X02BBC)). If overflow occurs during a subcalculation, as indicated by fail.code= NE_OVERFLOW, ms may or may not be greater than Imax. In either case, scm=nag_max_integer will have been returned.
8:     fail NagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.2.1.2 in the Essential Introduction for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
An unexpected error has been triggered by this function. Please contact NAG.
See Section 3.6.6 in the Essential Introduction for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 3.6.5 in the Essential Introduction for further information.
NE_OVERFLOW
Overflow occurred in a subcalculation of Ma,b,x.
The answer may be completely incorrect.
NE_REAL
On entry, adr=value.
Constraint: adr0.5.
On entry, bdr=value.
Constraint: bdr0.5.
NE_REAL_2
On entry, b=bni+bdr=value.
Ma,b,x is undefined when b is zero or a negative integer.
NE_REAL_ARG_NON_INTEGRAL
ani is non-integral.
On entry, ani=value.
Constraint: ani=ani.
bni is non-integral.
On entry, bni=value.
Constraint: bni=bni.
NE_REAL_RANGE_CONS
On entry, ani=value.
Constraint: aniarbnd=value.
On entry, bni=value.
Constraint: bniarbnd=value.
On entry, x=value.
Constraint: xarbnd=value.
NE_TOTAL_PRECISION_LOSS
All approximations have completed, and the final residual estimate indicates no accuracy can be guaranteed.
Relative residual =value.
NW_OVERFLOW_WARN
On completion, overflow occurred in the evaluation of Ma,b,x.
NW_SOME_PRECISION_LOSS
All approximations have completed, and the final residual estimate indicates some precision may have been lost.
Relative residual =value.
NW_UNDERFLOW_WARN
Underflow occurred during the evaluation of Ma,b,x.
The returned value may be inaccurate.

7  Accuracy

In general, if fail.code= NE_NOERROR, 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 different fail.code will be returned. Specifically,
fail.code= NE_NOERROR res1000ε
fail.code= NW_SOME_PRECISION_LOSS 1000ε<res0.1
fail.code= NE_TOTAL_PRECISION_LOSS 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 .

8  Parallelism and Performance

nag_specfun_1f1_real_scaled (s22bbc) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
nag_specfun_1f1_real_scaled (s22bbc) 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 function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9  Further Comments

The values of mf and ms are implementation dependent. In most cases, if F 1 1 a;b;x = 0 , m f = 0 and m s = 0 will be returned, and if F 1 1 a;b;x = 0  is finite, the fractional component will be bound by 0.5 m f < 1, with m s  chosen accordingly.
The values returned in frm (mf) and scm (ms) may be used to explicitly evaluate Ma,b,x, and may also be used to evaluate products and ratios of multiple values of M as follows,
Ma,b,x = mf × 2ms M a1,b1,x1 × M a2,b2,x2 = mf1 × mf2 × 2 ms1 + ms2 M a1,b1,x1 M a2,b2,x2 = mf1 mf2 × 2 ms1 - ms2 ln M a,b,x = lnmf + ms × ln2 .  

10  Example

This example evaluates the confluent hypergeometric function at two points in scaled form using nag_specfun_1f1_real_scaled (s22bbc), and subsequently calculates their product and ratio without having to explicitly construct M.

10.1  Program Text

Program Text (s22bbce.c)

10.2  Program Data

None.

10.3  Program Results

Program Results (s22bbce.r)


nag_specfun_1f1_real_scaled (s22bbc) (PDF version)
s Chapter Contents
s Chapter Introduction
NAG Library Manual

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