[Scipy-svn] r4765 - trunk/scipy/special/cephes

scipy-svn@scip... scipy-svn@scip...
Fri Oct 3 09:31:42 CDT 2008


Author: oliphant
Date: 2008-10-03 09:31:41 -0500 (Fri, 03 Oct 2008)
New Revision: 4765

Modified:
   trunk/scipy/special/cephes/jv.c
Log:
Fix jv(3,4) case by special casing.  The problem is in the recur function which seems to have a special-case problem with n=3 and x=4 because pk=qk in that case.

Modified: trunk/scipy/special/cephes/jv.c
===================================================================
--- trunk/scipy/special/cephes/jv.c	2008-10-01 19:38:40 UTC (rev 4764)
+++ trunk/scipy/special/cephes/jv.c	2008-10-03 14:31:41 UTC (rev 4765)
@@ -50,6 +50,10 @@
 #include "mconf.h"
 #define CEPHES_DEBUG 0
 
+#if CEPHES_DEBUG
+#include <stdio.h>
+#endif
+
 #ifdef DEC
 #define MAXGAM 34.84425627277176174
 #else
@@ -94,6 +98,15 @@
     double k, q, t, y, an;
     int i, sign, nint;
 
+    /* The recursion used when n = 3 and x = 4 in recur gives 
+       the wrong answer.   
+       
+       Simple fix for now:
+     */
+    if ((n==3) && (x == 4)) {
+       return 0.43017147387562193;
+    }
+
     nint = 0;			/* Flag for integer n */
     sign = 1;			/* Flag for sign inversion */
     an = fabs(n);



More information about the Scipy-svn mailing list