[Top][All Lists]

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

[Bug-gsl] [bug #30324] improve range of 2F1

From: Brian Gough
Subject: [Bug-gsl] [bug #30324] improve range of 2F1
Date: Fri, 02 Jul 2010 13:06:08 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv: Gecko/2009061118 Fedora/3.0.11-1.fc9 Firefox/3.0.11


                 Summary: improve range of 2F1
                 Project: GNU Scientific Library
            Submitted by: bjg
            Submitted on: Fri 02 Jul 2010 02:06:07 PM BST
                Category: Accuracy problem
                Severity: 3 - Normal
        Operating System: 
                  Status: Confirmed
             Assigned to: None
             Open/Closed: Open
                 Release: 1.14
         Discussion Lock: Any



From: Heiko Bauke <address@hidden>
To: address@hidden
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

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.));
      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.


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


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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