Prev Next


Confluent hypergeometric function.


double a, b, x, y, hyperg();
y = hyperg(a, b, x);


Computes the confluent hypergeometric function

                          1           2
                       a x    a(a+1) x
   F ( a,b;x )  =  1 + ---- + --------- + ...
  1 1                  b 1!   b(b+1) 2!

Many higher transcendental functions are special cases of this power series.
As is evident from the formula, b must not be a negative integer or zero unless a is an integer with 0 >= a > b.
The routine attempts both a direct summation of the series and an asymptotic expansion.  In each case error due to roundoff, cancellation and nonconvergence is estimated. The result with smaller estimated error is returned.

Tested at random points (a, b, x), all three variables ranging from 0 to 30.

                      Relative error:
arithmetic   domain     # trials      peak         rms
    DEC       0,30         2000       1.2e-15     1.3e-16
21800   max =  1.4200E-14   rms =  1.0841E-15  ave = -5.3640E-17
25500   max = 1.2759e-14   rms = 3.7155e-16  ave = 1.5384e-18
    IEEE      0,30        30000       1.8e-14     1.1e-15

Larger errors can be observed when b is near a negative integer or zero.  Certain combinations of arguments yield serious cancellation errors in the power series summation and also are not in the region of near convergence of the asymptotic series. An error message is printed if the self-estimated relative error is greater than 1.0e-12.