# HG changeset patch
# User John Cremona <john.cremona@gmail.com>
# Date 1245839455 -3600
# Node ID 1693156753fd36ad2fd1d0e75650014789bc9663
# Parent  2e793d2a0e123293b73eed40715e43185fd9ccfe
[mq]: intpts

diff -r 2e793d2a0e12 -r 1693156753fd sage/schemes/elliptic_curves/ell_rational_field.py
--- a/sage/schemes/elliptic_curves/ell_rational_field.py	Thu Jun 18 23:52:34 2009 -0700
+++ b/sage/schemes/elliptic_curves/ell_rational_field.py	Wed Jun 24 11:30:55 2009 +0100
@@ -2949,7 +2949,7 @@
     
     def integral_short_weierstrass_model(self):
         r"""
-        Return a model of the form `y^2 = x^3 + a*x + b` for this
+        Return a model of the form `y^2 = x^3 + ax + b` for this
         curve with `a,b\in\ZZ`.
         
         EXAMPLES::
@@ -2969,7 +2969,7 @@
     # deprecated function replaced by integral_short_weierstrass_model, see trac 3974.
     def integral_weierstrass_model(self):
         r"""
-        Return a model of the form `y^2 = x^3 + a*x + b` for this
+        Return a model of the form `y^2 = x^3 + ax + b` for this
         curve with `a,b\in\ZZ`.
         
         Note that this function is deprecated, and that you should use
@@ -5463,9 +5463,37 @@
     def integral_x_coords_in_interval(self,xmin,xmax):
         r"""
         Returns the set of integers `x` with `xmin\le x\le xmax` which are
-        `x`-coordinates of points on this curve.
-        """
-        return set([x for x  in range(xmin,xmax) if self.is_x_coord(x)])
+        `x`-coordinates of rational points on this curve.
+
+        INPUT:
+
+        - ``xmin``, ``xmax`` (integers) -- two integers.
+
+        OUTPUT:
+
+        (set) The set of integers `x` with `xmin\le x\le xmax` which
+        are `x`-coordinates of rational points on the elliptic curve.
+
+        EXAMPLES::
+
+            sage: E = EllipticCurve([0, 0, 1, -7, 6])
+            sage: xset = E.integral_x_coords_in_interval(-100,100)
+            sage: xlist = list(xset); xlist.sort(); xlist
+            [-3, -2, -1, 0, 1, 2, 3, 4, 8, 11, 14, 21, 37, 52, 93]
+
+        TODO: reimplement this using the much faster point searching
+        implemented in Stoll's ``ratpoints`` program.
+
+        """
+        xmin=Integer(xmin)
+        xmax=Integer(xmax)
+        ans = set([])
+        x = xmin
+        while x<=xmax:
+            if self.is_x_coord(x):
+                ans.add(x)
+            x+=1
+        return ans
 
     def integral_points(self, mw_base='auto', both_signs=False, verbose=False):
         """
@@ -5800,7 +5828,7 @@
         b2_12 = b2/12
         if disc > 0:
             ##Points in egg have X(P) between e1 and e2 [X(P)=x(P)+b2/12]:
-            x_int_points = self.integral_x_coords_in_interval((e1-b2_12).ceil(), (e2-b2_12).floor()+1)
+            x_int_points = self.integral_x_coords_in_interval((e1-b2_12).ceil(), (e2-b2_12).floor())
             if verbose:
                 print 'x-coords of points on compact component with ',(e1-b2_12).ceil(),'<=x<=',(e2-b2_12).floor()
                 L = list(x_int_points) # to have the order 
