help-gsl
[Top][All Lists]

## [Help-gsl] Gauss hypergeometric

 From: Heiko Bauke Subject: [Help-gsl] Gauss hypergeometric Date: Thu, 24 Jun 2010 21:11:53 +0200

```Dear GSL developers,

I would like to point out that the GSL functions gsl_sf_hyperg_2F1_e and
gsl_sf_hyperg_2F1 which compute the Gauss hypergeometric function for
-1<=x<1 may be extended with little effort to arguments in the interval
-oo<x<1 by using relations (32) and/or (33) in  by something like
this:

double hyperg_2F1(double a, double b, double c, double x) {
if (-1.<=x and x<1.)
return gsl_sf_hyperg_2F1(a, b, c, x);
if (x<-1.) {
// gsl_sf_hyperg_2F1 may have problems with negative arguments
if (c-a<0)
return pow(1.-x, -a)*
gsl_sf_hyperg_2F1(a, c-b, c, x/(x-1.));
if (c-b<0)
return pow(1.-x, -b)*
gsl_sf_hyperg_2F1(c-a, c, c, x/(x-1.));
// choose one of two equivalent formulas which is expected to be
// more accurate
if (a*(c-b)<(c-a)*b)
return pow(1.-x, -a)*
gsl_sf_hyperg_2F1(a, c-b, c, x/(x-1.));
else
return pow(1.-x, -b)*
gsl_sf_hyperg_2F1(c-a, b, c, x/(x-1.));
}
// insert some error handling for x>=1
return 0;
}

I cannot say much about the accuracy and the stability of this approach.
I think, however, it is reasonable to extend gsl_sf_hyperg_2F1_e and
gsl_sf_hyperg_2F1 in this way. It would make these functions more
general and useful.

Regards,

Heiko

 http://mathworld.wolfram.com/HypergeometricFunction.html

--
-- Strebe nach Ruhe, aber durch das Gleichgewicht, nicht durch den
-- Stillstand deiner Tätigkeit. (Friedrich Schiller)
-- Cluster Computing @ http://www.clustercomputing.de
--       Heiko Bauke @ http://www.mpi-hd.mpg.de/personalhomes/bauke

```