Index: explore/J1.py
===================================================================
--- explore/J1.py	(revision aceac39d3abe2b92f7aabc01582ca8c47a704cef)
+++ explore/J1.py	(revision 95ce773c779daaa58a2e556193cd79b2e13d71d8)
@@ -50,6 +50,5 @@
     model = core.load_model('bessel', dtype=dtype)
     calculator = direct_model.DirectModel(data.empty_data1D(x), model)
-    #ret = calculator(background=0)
-    #print ret
+
     return calculator(background=0)
 
Index: explore/J1c.py
===================================================================
--- explore/J1c.py	(revision cbd37a7e9b2cd2085f3e1d42c1ab4a48c4db56a7)
+++ explore/J1c.py	(revision 95ce773c779daaa58a2e556193cd79b2e13d71d8)
@@ -2,7 +2,12 @@
 Show numerical precision of $2 J_1(x)/x$.
 """
+import sys; sys.path.insert(0, '..')
 
 import numpy as np
-from sympy.mpmath import mp
+try:
+    from mpmath import mp
+except:
+    # CRUFT: mpmath split out into its own package
+    from sympy.mpmath import mp
 #import matplotlib; matplotlib.use('TkAgg')
 import pylab
Index: sasmodels/models/bessel.py
===================================================================
--- sasmodels/models/bessel.py	(revision a5af4e1ca0acba8ff274ff823f33faa5a25b0704)
+++ sasmodels/models/bessel.py	(revision 95ce773c779daaa58a2e556193cd79b2e13d71d8)
@@ -78,5 +78,5 @@
 
 Iq = """
-    return J1(q);
+    return J1c(q);
     """
 
Index: sasmodels/models/lib/j0_cephes.c
===================================================================
--- sasmodels/models/lib/j0_cephes.c	(revision 094e320030609bfc152d3be6fc35776ebb90d361)
+++ sasmodels/models/lib/j0_cephes.c	(revision 95ce773c779daaa58a2e556193cd79b2e13d71d8)
@@ -53,6 +53,5 @@
  * except YP, YQ which are designed for absolute error. */
 
-double j0( double );
-double j0(double x) {
+double J0(double x) {
 
 //Cephes single precission
@@ -60,5 +59,5 @@
     double w, z, p, q, xn;
 
-    const double TWOOPI = 6.36619772367581343075535E-1;
+    //const double TWOOPI = 6.36619772367581343075535E-1;
     const double SQ2OPI = 7.9788456080286535587989E-1;
     const double PIO4 = 7.85398163397448309616E-1;
@@ -67,92 +66,4 @@
     const double DR2 = 3.04712623436620863991E1;
 
-    const double PP[8] = {
-        7.96936729297347051624E-4,
-        8.28352392107440799803E-2,
-        1.23953371646414299388E0,
-        5.44725003058768775090E0,
-        8.74716500199817011941E0,
-        5.30324038235394892183E0,
-        9.99999999999999997821E-1,
-        0.0
-    };
-
-    const double PQ[8] = {
-        9.24408810558863637013E-4,
-        8.56288474354474431428E-2,
-        1.25352743901058953537E0,
-        5.47097740330417105182E0,
-        8.76190883237069594232E0,
-        5.30605288235394617618E0,
-        1.00000000000000000218E0,
-        0.0
-    };
-
-    const double QP[8] = {
-        -1.13663838898469149931E-2,
-        -1.28252718670509318512E0,
-        -1.95539544257735972385E1,
-        -9.32060152123768231369E1,
-        -1.77681167980488050595E2,
-        -1.47077505154951170175E2,
-        -5.14105326766599330220E1,
-        -6.05014350600728481186E0,
-    };
-
-    const double QQ[8] = {
-        /*  1.00000000000000000000E0,*/
-        6.43178256118178023184E1,
-        8.56430025976980587198E2,
-        3.88240183605401609683E3,
-        7.24046774195652478189E3,
-        5.93072701187316984827E3,
-        2.06209331660327847417E3,
-        2.42005740240291393179E2,
-    };
-
-    const double YP[8] = {
-        1.55924367855235737965E4,
-        -1.46639295903971606143E7,
-        5.43526477051876500413E9,
-        -9.82136065717911466409E11,
-        8.75906394395366999549E13,
-        -3.46628303384729719441E15,
-        4.42733268572569800351E16,
-        -1.84950800436986690637E16,
-    };
-
-    const double YQ[7] = {
-        /* 1.00000000000000000000E0,*/
-        1.04128353664259848412E3,
-        6.26107330137134956842E5,
-        2.68919633393814121987E8,
-        8.64002487103935000337E10,
-        2.02979612750105546709E13,
-        3.17157752842975028269E15,
-        2.50596256172653059228E17,
-    };
-
-    const double RP[8] = {
-        -4.79443220978201773821E9,
-        1.95617491946556577543E12,
-        -2.49248344360967716204E14,
-        9.70862251047306323952E15,
-        0.0,
-        0.0,
-        0.0,
-        0.0
-    };
-
-    const double RQ[8] = {
-        /* 1.00000000000000000000E0,*/
-        4.99563147152651017219E2,
-        1.73785401676374683123E5,
-        4.84409658339962045305E7,
-        1.11855537045356834862E10,
-        2.11277520115489217587E12,
-        3.10518229857422583814E14,
-        3.18121955943204943306E16,
-        1.71086294081043136091E18,
-    };
 
     if( x < 0 )
@@ -165,5 +76,5 @@
 
 	    p = (z - DR1) * (z - DR2);
-	    p = p * polevl( z, RP, 3)/p1evl( z, RQ, 8 );
+	    p = p * polevl( z, RPJ0, 3)/p1evl( z, RQJ0, 8 );
 	    return( p );
 	}
@@ -171,6 +82,6 @@
     w = 5.0/x;
     q = 25.0/(x*x);
-    p = polevl( q, PP, 6)/polevl( q, PQ, 6 );
-    q = polevl( q, QP, 7)/p1evl( q, QQ, 7 );
+    p = polevl( q, PPJ0, 6)/polevl( q, PQJ0, 6 );
+    q = polevl( q, QPJ0, 7)/p1evl( q, QQJ0, 7 );
     xn = x - PIO4;
 
@@ -184,53 +95,9 @@
     double xx, w, z, p, q, xn;
 
-    const double YZ1 =  0.43221455686510834878;
-    const double YZ2 = 22.401876406482861405;
-    const double YZ3 = 64.130620282338755553;
+    //const double YZ1 =  0.43221455686510834878;
+    //const double YZ2 = 22.401876406482861405;
+    //const double YZ3 = 64.130620282338755553;
     const double DR1 =  5.78318596294678452118;
     const double PIO4F = 0.7853981633974483096;
-
-    double MO[8] = {
-        -6.838999669318810E-002,
-        1.864949361379502E-001,
-        -2.145007480346739E-001,
-        1.197549369473540E-001,
-        -3.560281861530129E-003,
-        -4.969382655296620E-002,
-        -3.355424622293709E-006,
-        7.978845717621440E-001
-    };
-
-    double PH[8] = {
-        3.242077816988247E+001,
-        -3.630592630518434E+001,
-        1.756221482109099E+001,
-        -4.974978466280903E+000,
-        1.001973420681837E+000,
-        -1.939906941791308E-001,
-        6.490598792654666E-002,
-        -1.249992184872738E-001
-    };
-
-    double YP[8] = {
-        9.454583683980369E-008,
-        -9.413212653797057E-006,
-        5.344486707214273E-004,
-        -1.584289289821316E-002,
-        1.707584643733568E-001,
-        0.0,
-        0.0,
-        0.0
-    };
-
-    double JP[8] = {
-        -6.068350350393235E-008,
-        6.388945720783375E-006,
-        -3.969646342510940E-004,
-        1.332913422519003E-002,
-        -1.729150680240724E-001,
-        0.0,
-        0.0,
-        0.0
-    };
 
     if( x < 0 )
@@ -244,5 +111,5 @@
 		    return( 1.0 - 0.25*z );
 
-	    p = (z-DR1) * polevl( z, JP, 4);
+	    p = (z-DR1) * polevl( z, JPJ0, 4);
 	    return( p );
 	}
@@ -251,7 +118,7 @@
     w = sqrt(q);
 
-    p = w * polevl( q, MO, 7);
+    p = w * polevl( q, MOJ0, 7);
     w = q*q;
-    xn = q * polevl( w, PH, 7) - PIO4F;
+    xn = q * polevl( w, PHJ0, 7) - PIO4F;
     p = p * cos(xn + xx);
     return(p);
Index: sasmodels/models/lib/j1_cephes.c
===================================================================
--- sasmodels/models/lib/j1_cephes.c	(revision fad5dc1e719d8dec9f7d9592debc76d14942f224)
+++ sasmodels/models/lib/j1_cephes.c	(revision 95ce773c779daaa58a2e556193cd79b2e13d71d8)
@@ -40,99 +40,4 @@
 */
 
-constant double RP[8] = {
-    -8.99971225705559398224E8,
-    4.52228297998194034323E11,
-    -7.27494245221818276015E13,
-    3.68295732863852883286E15,
-    0.0,
-    0.0,
-    0.0,
-    0.0 };
-
-constant double RQ[8] = {
-        6.20836478118054335476E2,
-        2.56987256757748830383E5,
-        8.35146791431949253037E7,
-        2.21511595479792499675E10,
-        4.74914122079991414898E12,
-        7.84369607876235854894E14,
-        8.95222336184627338078E16,
-        5.32278620332680085395E18
-    };
-
-constant double PP[8] = {
-    7.62125616208173112003E-4,
-    7.31397056940917570436E-2,
-    1.12719608129684925192E0,
-    5.11207951146807644818E0,
-    8.42404590141772420927E0,
-    5.21451598682361504063E0,
-    1.00000000000000000254E0,
-    0.0} ;
-
-
-constant double PQ[8] = {
-    5.71323128072548699714E-4,
-    6.88455908754495404082E-2,
-    1.10514232634061696926E0,
-    5.07386386128601488557E0,
-    8.39985554327604159757E0,
-    5.20982848682361821619E0,
-    9.99999999999999997461E-1,
-    0.0 };
-
-constant double QP[8] = {
-    5.10862594750176621635E-2,
-    4.98213872951233449420E0,
-    7.58238284132545283818E1,
-    3.66779609360150777800E2,
-    7.10856304998926107277E2,
-    5.97489612400613639965E2,
-    2.11688757100572135698E2,
-    2.52070205858023719784E1 };
-
-constant double QQ[8] = {
-    7.42373277035675149943E1,
-    1.05644886038262816351E3,
-    4.98641058337653607651E3,
-    9.56231892404756170795E3,
-    7.99704160447350683650E3,
-    2.82619278517639096600E3,
-    3.36093607810698293419E2,
-    0.0 };
-
-constant double JP[8] = {
-        -4.878788132172128E-009,
-        6.009061827883699E-007,
-        -4.541343896997497E-005,
-        1.937383947804541E-003,
-        -3.405537384615824E-002,
-        0.0,
-        0.0,
-        0.0
-    };
-
-constant double MO1[8] = {
-        6.913942741265801E-002,
-        -2.284801500053359E-001,
-        3.138238455499697E-001,
-        -2.102302420403875E-001,
-        5.435364690523026E-003,
-        1.493389585089498E-001,
-        4.976029650847191E-006,
-        7.978845453073848E-001
-    };
-
-constant double PH1[8] = {
-        -4.497014141919556E+001,
-        5.073465654089319E+001,
-        -2.485774108720340E+001,
-        7.222973196770240E+000,
-        -1.544842782180211E+000,
-        3.503787691653334E-001,
-        -1.637986776941202E-001,
-        3.749989509080821E-001
-    };
-
 double J1(double x) {
 
@@ -154,5 +59,5 @@
 	{
 	    z = x * x;
-	    w = polevl( z, RP, 3 ) / p1evl( z, RQ, 8 );
+	    w = polevl( z, RPJ1, 3 ) / p1evl( z, RQJ1, 8 );
 	    w = w * x * (z - Z1) * (z - Z2);
 	    return( w );
@@ -162,6 +67,6 @@
     z = w * w;
 
-    p = polevl( z, PP, 6)/polevl( z, PQ, 6 );
-    q = polevl( z, QP, 7)/p1evl( z, QQ, 7 );
+    p = polevl( z, PPJ1, 6)/polevl( z, PQJ1, 6 );
+    q = polevl( z, QPJ1, 7)/p1evl( z, QQJ1, 7 );
 
     xn = x - THPIO4;
@@ -189,5 +94,5 @@
 	{
 	    z = xx * xx;
-	    p = (z-Z1) * xx * polevl( z, JP, 4 );
+	    p = (z-Z1) * xx * polevl( z, JPJ1, 4 );
 	    return( p );
 	}
@@ -196,7 +101,7 @@
     w = sqrt(q);
 
-    p = w * polevl( q, MO1, 7);
+    p = w * polevl( q, MO1J1, 7);
     w = q*q;
-    xn = q * polevl( w, PH1, 7) - THPIO4F;
+    xn = q * polevl( w, PH1J1, 7) - THPIO4F;
     p = p * cos(xn + xx);
 
@@ -205,6 +110,6 @@
 }
 
-
-/*double J1c(double x) {
-    return
-}*/
+//Finally J1c function that equals 2*J1(x)/x
+double J1c(double x) {
+    return (x != 0.0 ) ? 2.0*J1(x)/x : 1.0;
+}
Index: sasmodels/models/lib/polevl.c
===================================================================
--- sasmodels/models/lib/polevl.c	(revision fad5dc1e719d8dec9f7d9592debc76d14942f224)
+++ sasmodels/models/lib/polevl.c	(revision 95ce773c779daaa58a2e556193cd79b2e13d71d8)
@@ -51,4 +51,221 @@
 */
 
+constant double RPJ1[8] = {
+    -8.99971225705559398224E8,
+    4.52228297998194034323E11,
+    -7.27494245221818276015E13,
+    3.68295732863852883286E15,
+    0.0,
+    0.0,
+    0.0,
+    0.0 };
+
+constant double RQJ1[8] = {
+    6.20836478118054335476E2,
+    2.56987256757748830383E5,
+    8.35146791431949253037E7,
+    2.21511595479792499675E10,
+    4.74914122079991414898E12,
+    7.84369607876235854894E14,
+    8.95222336184627338078E16,
+    5.32278620332680085395E18
+    };
+
+constant double PPJ1[8] = {
+    7.62125616208173112003E-4,
+    7.31397056940917570436E-2,
+    1.12719608129684925192E0,
+    5.11207951146807644818E0,
+    8.42404590141772420927E0,
+    5.21451598682361504063E0,
+    1.00000000000000000254E0,
+    0.0} ;
+
+
+constant double PQJ1[8] = {
+    5.71323128072548699714E-4,
+    6.88455908754495404082E-2,
+    1.10514232634061696926E0,
+    5.07386386128601488557E0,
+    8.39985554327604159757E0,
+    5.20982848682361821619E0,
+    9.99999999999999997461E-1,
+    0.0 };
+
+constant double QPJ1[8] = {
+    5.10862594750176621635E-2,
+    4.98213872951233449420E0,
+    7.58238284132545283818E1,
+    3.66779609360150777800E2,
+    7.10856304998926107277E2,
+    5.97489612400613639965E2,
+    2.11688757100572135698E2,
+    2.52070205858023719784E1 };
+
+constant double QQJ1[8] = {
+    7.42373277035675149943E1,
+    1.05644886038262816351E3,
+    4.98641058337653607651E3,
+    9.56231892404756170795E3,
+    7.99704160447350683650E3,
+    2.82619278517639096600E3,
+    3.36093607810698293419E2,
+    0.0 };
+
+constant double JPJ1[8] = {
+    -4.878788132172128E-009,
+    6.009061827883699E-007,
+    -4.541343896997497E-005,
+    1.937383947804541E-003,
+    -3.405537384615824E-002,
+    0.0,
+    0.0,
+    0.0
+    };
+
+constant double MO1J1[8] = {
+    6.913942741265801E-002,
+    -2.284801500053359E-001,
+    3.138238455499697E-001,
+    -2.102302420403875E-001,
+    5.435364690523026E-003,
+    1.493389585089498E-001,
+    4.976029650847191E-006,
+    7.978845453073848E-001
+    };
+
+constant double PH1J1[8] = {
+    -4.497014141919556E+001,
+    5.073465654089319E+001,
+    -2.485774108720340E+001,
+    7.222973196770240E+000,
+    -1.544842782180211E+000,
+    3.503787691653334E-001,
+    -1.637986776941202E-001,
+    3.749989509080821E-001
+    };
+
+ constant double PPJ0[8] = {
+        7.96936729297347051624E-4,
+        8.28352392107440799803E-2,
+        1.23953371646414299388E0,
+        5.44725003058768775090E0,
+        8.74716500199817011941E0,
+        5.30324038235394892183E0,
+        9.99999999999999997821E-1,
+        0.0
+    };
+
+ constant double PQJ0[8] = {
+        9.24408810558863637013E-4,
+        8.56288474354474431428E-2,
+        1.25352743901058953537E0,
+        5.47097740330417105182E0,
+        8.76190883237069594232E0,
+        5.30605288235394617618E0,
+        1.00000000000000000218E0,
+        0.0
+    };
+
+ constant double QPJ0[8] = {
+        -1.13663838898469149931E-2,
+        -1.28252718670509318512E0,
+        -1.95539544257735972385E1,
+        -9.32060152123768231369E1,
+        -1.77681167980488050595E2,
+        -1.47077505154951170175E2,
+        -5.14105326766599330220E1,
+        -6.05014350600728481186E0,
+    };
+
+ constant double QQJ0[8] = {
+        /*  1.00000000000000000000E0,*/
+        6.43178256118178023184E1,
+        8.56430025976980587198E2,
+        3.88240183605401609683E3,
+        7.24046774195652478189E3,
+        5.93072701187316984827E3,
+        2.06209331660327847417E3,
+        2.42005740240291393179E2,
+    };
+
+ constant double YPJ0[8] = {
+        1.55924367855235737965E4,
+        -1.46639295903971606143E7,
+        5.43526477051876500413E9,
+        -9.82136065717911466409E11,
+        8.75906394395366999549E13,
+        -3.46628303384729719441E15,
+        4.42733268572569800351E16,
+        -1.84950800436986690637E16,
+ };
+
+
+ constant double YQJ0[7] = {
+        /* 1.00000000000000000000E0,*/
+        1.04128353664259848412E3,
+        6.26107330137134956842E5,
+        2.68919633393814121987E8,
+        8.64002487103935000337E10,
+        2.02979612750105546709E13,
+        3.17157752842975028269E15,
+        2.50596256172653059228E17,
+  };
+
+ constant double RPJ0[8] = {
+        -4.79443220978201773821E9,
+        1.95617491946556577543E12,
+        -2.49248344360967716204E14,
+        9.70862251047306323952E15,
+        0.0,
+        0.0,
+        0.0,
+        0.0
+  };
+
+ constant double RQJ0[8] = {
+        /* 1.00000000000000000000E0,*/
+        4.99563147152651017219E2,
+        1.73785401676374683123E5,
+        4.84409658339962045305E7,
+        1.11855537045356834862E10,
+        2.11277520115489217587E12,
+        3.10518229857422583814E14,
+        3.18121955943204943306E16,
+        1.71086294081043136091E18,
+  };
+
+ constant double MOJ0[8] = {
+        -6.838999669318810E-002,
+        1.864949361379502E-001,
+        -2.145007480346739E-001,
+        1.197549369473540E-001,
+        -3.560281861530129E-003,
+        -4.969382655296620E-002,
+        -3.355424622293709E-006,
+        7.978845717621440E-001
+  };
+
+ constant double PHJ0[8] = {
+        3.242077816988247E+001,
+        -3.630592630518434E+001,
+        1.756221482109099E+001,
+        -4.974978466280903E+000,
+        1.001973420681837E+000,
+        -1.939906941791308E-001,
+        6.490598792654666E-002,
+        -1.249992184872738E-001
+  };
+
+ constant double JPJ0[8] = {
+        -6.068350350393235E-008,
+        6.388945720783375E-006,
+        -3.969646342510940E-004,
+        1.332913422519003E-002,
+        -1.729150680240724E-001,
+        0.0,
+        0.0,
+        0.0
+ };
 
 double polevl( double x, constant double *coef, int N ) {
