# 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
|
|
| 2949 | 2949 | |
| 2950 | 2950 | def integral_short_weierstrass_model(self): |
| 2951 | 2951 | 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 |
| 2953 | 2953 | curve with `a,b\in\ZZ`. |
| 2954 | 2954 | |
| 2955 | 2955 | EXAMPLES:: |
| … |
… |
|
| 2969 | 2969 | # deprecated function replaced by integral_short_weierstrass_model, see trac 3974. |
| 2970 | 2970 | def integral_weierstrass_model(self): |
| 2971 | 2971 | 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 |
| 2973 | 2973 | curve with `a,b\in\ZZ`. |
| 2974 | 2974 | |
| 2975 | 2975 | Note that this function is deprecated, and that you should use |
| … |
… |
|
| 5463 | 5463 | def integral_x_coords_in_interval(self,xmin,xmax): |
| 5464 | 5464 | r""" |
| 5465 | 5465 | 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 |
| 5469 | 5497 | |
| 5470 | 5498 | def integral_points(self, mw_base='auto', both_signs=False, verbose=False): |
| 5471 | 5499 | """ |
| … |
… |
|
| 5800 | 5828 | b2_12 = b2/12 |
| 5801 | 5829 | if disc > 0: |
| 5802 | 5830 | ##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()) |
| 5804 | 5832 | if verbose: |
| 5805 | 5833 | print 'x-coords of points on compact component with ',(e1-b2_12).ceil(),'<=x<=',(e2-b2_12).floor() |
| 5806 | 5834 | L = list(x_int_points) # to have the order |