Prev Next


Gauss hypergeometric function   2F1.


double a, b, c, x, y, hyp2f1();
y = hyp2f1(a, b, c, x);


  hyp2f1( a, b, c, x )  =   F ( a, b; c; x )
                           2 1

            -   a(a+1)...(a+k) b(b+1)...(b+k)   k+1
   =  1 +   >   -----------------------------  x   .
            -         c(c+1)...(c+k) (k+1)!
          k = 0

  Cases addressed are:
Tests and escapes for negative integer a, b, or c
Linear transformation if c - a or c - b negative integer
Special case c = a or c = b
Linear transformation for  x near +1
Transformation for x < -0.5
Psi function expansion if x > 0.5 and c - a - b integer Conditionally, a recurrence on c to make c-a-b > 0

|x| > 1 is rejected.

The parameters a, b, c are considered to be integer valued if they are within 1.0e-14 of the nearest integer (1.0e-13 for IEEE arithmetic).

               Relative error (-1 < x < 1):
arithmetic   domain     # trials      peak         rms
    IEEE      -1,7        230000      1.2e-11     5.2e-14

Several special cases also tested with a, b, c in the range -7 to 7.

A "partial loss of precision" message is printed if the internally estimated relative error exceeds 1^-12.
A "singularity" message is printed on overflow or in cases not addressed (such as x < -1).