Ticket #6381: trac_6381.patch

File trac_6381.patch, 3.0 KB (added by cremona, 9 months ago)

Applies to 4.0.2

  • sage/schemes/elliptic_curves/ell_rational_field.py

    # 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 b  
    29492949     
    29502950    def integral_short_weierstrass_model(self): 
    29512951        r""" 
    2952         Return a model of the form `y^2 = x^3 + a*x + b` for this 
     2952        Return a model of the form `y^2 = x^3 + ax + b` for this 
    29532953        curve with `a,b\in\ZZ`. 
    29542954         
    29552955        EXAMPLES:: 
     
    29692969    # deprecated function replaced by integral_short_weierstrass_model, see trac 3974. 
    29702970    def integral_weierstrass_model(self): 
    29712971        r""" 
    2972         Return a model of the form `y^2 = x^3 + a*x + b` for this 
     2972        Return a model of the form `y^2 = x^3 + ax + b` for this 
    29732973        curve with `a,b\in\ZZ`. 
    29742974         
    29752975        Note that this function is deprecated, and that you should use 
     
    54635463    def integral_x_coords_in_interval(self,xmin,xmax): 
    54645464        r""" 
    54655465        Returns the set of integers `x` with `xmin\le x\le xmax` which are 
    5466         `x`-coordinates of points on this curve. 
    5467         """ 
    5468         return set([x for x  in range(xmin,xmax) if self.is_x_coord(x)]) 
     5466        `x`-coordinates of rational points on this curve. 
     5467 
     5468        INPUT: 
     5469 
     5470        - ``xmin``, ``xmax`` (integers) -- two integers. 
     5471 
     5472        OUTPUT: 
     5473 
     5474        (set) The set of integers `x` with `xmin\le x\le xmax` which 
     5475        are `x`-coordinates of rational points on the elliptic curve. 
     5476 
     5477        EXAMPLES:: 
     5478 
     5479            sage: E = EllipticCurve([0, 0, 1, -7, 6]) 
     5480            sage: xset = E.integral_x_coords_in_interval(-100,100) 
     5481            sage: xlist = list(xset); xlist.sort(); xlist 
     5482            [-3, -2, -1, 0, 1, 2, 3, 4, 8, 11, 14, 21, 37, 52, 93] 
     5483 
     5484        TODO: reimplement this using the much faster point searching 
     5485        implemented in Stoll's ``ratpoints`` program. 
     5486 
     5487        """ 
     5488        xmin=Integer(xmin) 
     5489        xmax=Integer(xmax) 
     5490        ans = set([]) 
     5491        x = xmin 
     5492        while x<=xmax: 
     5493            if self.is_x_coord(x): 
     5494                ans.add(x) 
     5495            x+=1 
     5496        return ans 
    54695497 
    54705498    def integral_points(self, mw_base='auto', both_signs=False, verbose=False): 
    54715499        """ 
     
    58005828        b2_12 = b2/12 
    58015829        if disc > 0: 
    58025830            ##Points in egg have X(P) between e1 and e2 [X(P)=x(P)+b2/12]: 
    5803             x_int_points = self.integral_x_coords_in_interval((e1-b2_12).ceil(), (e2-b2_12).floor()+1) 
     5831            x_int_points = self.integral_x_coords_in_interval((e1-b2_12).ceil(), (e2-b2_12).floor()) 
    58045832            if verbose: 
    58055833                print 'x-coords of points on compact component with ',(e1-b2_12).ceil(),'<=x<=',(e2-b2_12).floor() 
    58065834                L = list(x_int_points) # to have the order