bug-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gsl] Bug report: gsl_sf_hyperg_2F1


From: Robert L . Wolpert
Subject: [Bug-gsl] Bug report: gsl_sf_hyperg_2F1
Date: Mon, 5 Sep 2011 16:46:44 -0400

Hi, GNU.  

The Gauss hypergeometric function 2F1 is described in detail in Abramowitz &
Stegan (1964) eqn. 15.1.1, page 556.  It is implemented in the gsl library as
"gsl_sf_hyperg_2F1".  The implementation frequently returns "NaN" or "Inf"
for domain values where 2F1 is well-defined and easy to calculate.  I hope
you will address this in an upcoming version, because your implementations
are widely used and respected.

Specifically:

  GSL Version:     1.3
  HW:              x86-64 (Dell Precision 690, 2x quad-core Xeon 5300, 16Gb ram)
  OS:              Scientific Linux release 6.1 (Carbon)
  Compiler:        gcc (GCC) 4.4.5 20110214 (Red Hat 4.4.5-6)
  Short Descrip:
                   If either argument a or b is a negative integer "-n", then
                   the function 
                                   2F1(a,b; c; z)

                   is a polynomial in z of order n or less--- well-defined,
                   finite, and easy to calculate for all z and for all c
                   (except some negative integers).

                   This arises frequently in probability calculations.

                   Nevertheless, the gnu implementation fails for many of
                   these cases.  For example, 2F1( -1, -10, 1.0, 0.5 ) is
                   exactly 6, but gsl_sf_hyperg_2F1() invokes the GSL error
                   handler with a claimed domain error.

                   The same function with b = -9 istead of -10 works fine:
                   gsl_sf_hyperg_2F1() returns 5.5, the correct answer.

                   The gsl 2F1 function also fails in many other ranges where
                   the function is well-defined ( e.g. whenever |z|>1 ), many
                   of which could be avoided by having the code work its
                   way through the transformation formulas given by (p. 559)
                   Abramowitz and Stegan in 15.3.3--15.3.9
 
  Program:         Here's one:  

Attachment: 2F1.c
Description: Binary data

                   The problem arises even without optimization.


Thanks for your attention, and for the important contribution the gsl library
makes to all of us.                                                  -RLW

----------------------------------------------------------------------
 Prof. Robert L. Wolpert : <address@hidden>  : +1-919-684-3275
 Duke Univ. Dept. of Statistical Science   : 211c Old Chem, Box 90251
 & Nicholas School of the Environment ES&P :  www.stat.Duke.edu/~rlw/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]