# GNU Scientific Library - Bugs: bug #30324, improve range of 2F1

You are not allowed to post comments on this tracker with your current authentication level.

*bug #30324*: improve range of 2F1

Submitter: | -Deleted Account- <bjg> | ||

Submitted: | Fri 02 Jul 2010 01:06:07 PM UTC | ||

Category: | Accuracy problem | Severity: | 3 - Normal |

Operating System: | Status: | Confirmed | |

Assigned to: | None | Open/Closed: | Open |

Release: | 1.14 |

No files currently attached

Depends on the following items: None found

Items that depend on this one: None found

CC list is empty

No changes have been made to this item

From: Heiko Bauke <heiko.bauke@snafu.de>

To: -email is unavailable-

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 [1] 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

[1] http://mathworld.wolfram.com/HypergeometricFunction.html