help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] 2F1 hypergeometric domain error


From: Brian Gough
Subject: Re: [Help-gsl] 2F1 hypergeometric domain error
Date: Wed, 13 May 2009 20:22:19 +0100
User-agent: Wanderlust/2.14.0 (Africa) Emacs/22.2 Mule/5.0 (SAKAKI)

At Mon, 11 May 2009 14:26:43 -0400,
Taylor Binnington wrote:
> When I call gsl_sf_hyperg_2F1(0, -2, -4, 0.5) I get a domain error. I
> understand where it comes from, by looking in the course code, but I'm not
> sure why the routine does not simply provide 1.0000 as the output, which it
> should be. If I change the -4 to -4.1, for example, THEN my output is
> 1.00000 as it should be but I wish I didn't have to manually do this each
> time. Does anyone know how I can get around this issue?

Thanks for your email.  I looked at the code and there was a bug in
the logic when c is a negative integer.  The patch below should fix it
and will be in the next release.

diff --git a/specfunc/hyperg_2F1.c b/specfunc/hyperg_2F1.c
index 7e8c9d0..882ed35 100644
--- a/specfunc/hyperg_2F1.c
+++ b/specfunc/hyperg_2F1.c
@@ -667,8 +667,9 @@ gsl_sf_hyperg_2F1_e(double a, double b, const double c,
   }
 
   if(c_neg_integer) {
-    if(! (a_neg_integer && a > c + 0.1)) DOMAIN_ERROR(result);
-    if(! (b_neg_integer && b > c + 0.1)) DOMAIN_ERROR(result);
+    if(! (a_neg_integer && a > c + 0.1) && ! (b_neg_integer && b > c + 0.1)) {
+      DOMAIN_ERROR(result);
+    }
   }




reply via email to

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