Ticket #8184: trac_8184-eclib.patch

File trac_8184-eclib.patch, 17.4 KB (added by John Cremona, 13 years ago)

Applies to 4.3.2.alpha1

  • sage/libs/mwrank/interface.py

    # HG changeset patch
    # User John Cremona <john.cremona@gmail.com>
    # Date 1265299155 0
    # Node ID da1d714ce6c643ada7230478729c24fd2ba373b8
    # Parent  bf84525b72903999beae77685f41a227396f87ad
    #8184: patch interface for eclib/mwrank for eclib-20080310.p9.spkg
    
    diff -r bf84525b7290 -r da1d714ce6c6 sage/libs/mwrank/interface.py
    a b  
    243243    def rank(self):
    244244        """
    245245        Returns the rank of this curve, computed using 2-descent.
     246
     247        In general this may only be a lower bound for the rank; an
     248        upper bound may be obtained using the function rank_bound().
     249        To test whether the value has been proved to be correct, use
     250        the method \method{certain}.
     251
     252        EXAMPLES::
     253
     254            sage: E = mwrank_EllipticCurve([0, -1, 0, -900, -10098])
     255            sage: E.rank()
     256            0
     257            sage: E.certain()
     258            True
     259
     260        ::
     261
     262            sage: E = mwrank_EllipticCurve([0, -1, 1, -929, -10595])
     263            sage: E.rank()                                         
     264            0
     265            sage: E.certain()                                       
     266            False
     267
    246268        """
    247269        return self.__two_descent_data().getrank()
    248270
    249     def selmer_rank_bound(self):
    250         r"""
    251         Bound on the rank of the curve, computed using the 2-selmer
    252         group.  This is the rank of the curve minus the rank of the
    253         2-torsion, minus a number determined by whatever mwrank was
    254         able to determine related to $\Sha(E)[2]$ (e.g., using a
    255         second descent or if there is a rational $2$-torsion point,
    256         then there may be an isogeny to a curve with trivial
    257         $\Sha(E)$).  In many cases, this is the actual rank of the
    258         curve, but in general it is just $\geq$ the true rank.
     271    def rank_bound(self):
     272        """
     273        Returns an upper bound for the rank of this curve, computed
     274        using 2-descent.
     275
     276        If the curve has no 2-torsion, this is equal to the 2-Selmer
     277        rank.  If the curve has 2-torsion, the upper bound may be
     278        smaller than the bound obtained from the 2-Selmer rank minus
     279        the 2-rank of the torsion, since more information is gained
     280        from the 2-isogenous curve or curves.
    259281
    260282        EXAMPLES:
     283
    261284        The following is the curve 960D1, which has rank 0,
    262         but Sha of order 4.
     285        but Sha of order 4::
    263286       
    264287            sage: E = mwrank_EllipticCurve([0, -1, 0, -900, -10098])
    265             sage: E.selmer_rank_bound()
     288            sage: E.rank_bound()
     289            0
     290            sage: E.rank()
    266291            0
    267292
    268         In this case this was resolved using a second descent.
     293        In this case the rank was computed using a second descent,
     294        which is able to determine (by considering a 2-isogenous
     295        curve) that Sha is nontrivial.  If we deliberately stop the
     296        second descent, the rank bound is larger::
    269297
    270298            sage: E = mwrank_EllipticCurve([0, -1, 0, -900, -10098])
    271299            sage: E.two_descent(second_descent = False, verbose=False)
    272             sage: E.selmer_rank_bound()
     300            sage: E.rank_bound()
    273301            2
    274302           
    275         Above, the \method{selmer_rank_bound} gives 0 instead of 2,
    276         because it knows Sha is nontrivial.  In contrast, for the
    277         curve 571A, also with rank 0 and $\Sha$ of order 4, we obtain
    278         a worse bound:
     303        In contrast, for the curve 571A, also with rank 0 and Sha
     304        of order 4, we only obtain an upper bound of 2:
    279305       
    280306            sage: E = mwrank_EllipticCurve([0, -1, 1, -929, -10595])
    281             sage: E.selmer_rank_bound()
     307            sage: E.rank_bound()
    282308            2
     309
     310        In this case the value returned by \method{rank} is only a
     311        lower bound in general (though in this is correct)::
     312
    283313            sage: E.rank()
    284314            0
     315            sage: E.certain()
     316            False
     317        """
     318        return self.__two_descent_data().getrankbound()
     319
     320    def selmer_rank(self):
     321        r"""
     322        Returns the rank of the 2-Selmer group of the curve.
     323       
     324        EXAMPLES:
     325
     326        The following is the curve 960D1, which has rank 0, but Sha of
     327        order 4.  The 2-torsion has rank 2, and the Selmer rank is 3::
     328       
     329            sage: E = mwrank_EllipticCurve([0, -1, 0, -900, -10098])
     330            sage: E.selmer_rank()
     331            3
     332
     333        Nevertheless, we can obtain a tight upper bound on the rank
     334        since a second descent is performed which establishes the
     335        2-rank of Sha::
     336
     337            sage: E.rank_bound()
     338            0
     339
     340        To show that this was resolved using a second descent, we do
     341        the computation again but turn off the second descent::
     342
     343            sage: E = mwrank_EllipticCurve([0, -1, 0, -900, -10098])
     344            sage: E.two_descent(second_descent = False, verbose=False)
     345            sage: E.rank_bound()
     346            2
     347           
     348        For the curve 571A, also with rank 0 and $\Sha$ of order 4,
     349        but with no 2-torsion, the selmer rank is strictly greater
     350        than the rank::
     351       
     352            sage: E = mwrank_EllipticCurve([0, -1, 1, -929, -10595])
     353            sage: E.selmer_rank()
     354            2
     355            sage: E.rank_bound()
     356            2
     357
     358        In cases like this with no 2-torsion, the rank upper bound is
     359        always equal to the 2-Selmer rank.  If we ask for the rank,
     360        all we get is a lower bound::
     361           
     362            sage: E.rank()
     363            0
     364            sage: E.certain()
     365            False
     366
    285367        """
    286368        return self.__two_descent_data().getselmer()
    287369
     
    328410        computed the rank.  If \method{two_descent} hasn't been
    329411        called, then it is first called by \method{certain}
    330412        using the default parameters.
     413
     414        The result is true if and only if the results of the methods
     415        \method{rank} and \method{rank_bound} are equal.
    331416       
    332417        EXAMPLES:
     418       
    333419        A $2$-descent does not determine $E(\Q)$ with certainty
    334420        for the curve $y^2 + y = x^3 - x^2 - 120x - 2183$.
    335421       
     
    341427            sage: E.rank()   
    342428            0
    343429
    344         The rank of $E$is actually 0 (as one could see by computing
    345         the L-function), but $\Sha$ has order 4 and the $2$-torsion is
    346         trivial, so mwrank does not conclusively determine the rank.
     430        The previous value is only a lower bound; the upper bound is greater::
    347431
    348             sage: E.selmer_rank_bound()
     432            sage: E.rank_bound()   
    349433            2
     434
     435        In fact the rank of $E$is actually 0 (as one could see by
     436        computing the L-function), but $\Sha$ has order 4 and the
     437        $2$-torsion is trivial, so mwrank cannot conclusively
     438        determine the rank in this case.
    350439        """
    351440        return bool(self.__two_descent_data().getcertain())
    352441                       
  • sage/libs/mwrank/mwrank.pyx

    diff -r bf84525b7290 -r da1d714ce6c6 sage/libs/mwrank/mwrank.pyx
    a b  
    7373
    7474    void two_descent_del(two_descent* t)
    7575    int two_descent_ok(two_descent* t)
    76     long two_descent_getcertain(two_descent* t)
    77     char* two_descent_getbasis(two_descent* t)
     76    long two_descent_get_certain(two_descent* t)
     77    char* two_descent_get_basis(two_descent* t)
    7878    char* two_descent_regulator(two_descent* t)
    79     long two_descent_getrank(two_descent* t)
    80     long two_descent_getselmer(two_descent* t)
     79    long two_descent_get_rank(two_descent* t)
     80    long two_descent_get_rank_bound(two_descent* t)
     81    long two_descent_get_selmer_rank(two_descent* t)
    8182    void two_descent_saturate(two_descent* t, long sat_bd)
    8283
    8384
     
    296297    def getrank(self):
    297298        cdef int r
    298299        _sig_on
    299         r = two_descent_getrank(self.x)
     300        r = two_descent_get_rank(self.x)
     301        _sig_off
     302        return r
     303
     304    def getrankbound(self):
     305        cdef int r
     306        _sig_on
     307        r = two_descent_get_rank_bound(self.x)
    300308        _sig_off
    301309        return r
    302310
    303311    def getselmer(self):
    304312        _sig_on
    305         r = two_descent_getselmer(self.x)
     313        r = two_descent_get_selmer_rank(self.x)
    306314        _sig_off
    307315        return r
    308316
     
    310318        return two_descent_ok(self.x)
    311319
    312320    def getcertain(self):
    313         return two_descent_getcertain(self.x)
     321        return two_descent_get_certain(self.x)
    314322
    315323    def saturate(self, saturation_bound=0):
    316324        _sig_on
     
    319327
    320328    def getbasis(self):
    321329        _sig_on
    322         return string_sigoff(two_descent_getbasis(self.x))
     330        return string_sigoff(two_descent_get_basis(self.x))
    323331
    324332    def regulator(self):
    325333        _sig_on
  • sage/libs/mwrank/wrap.cc

    diff -r bf84525b7290 -r da1d714ce6c6 sage/libs/mwrank/wrap.cc
    a b  
    244244  delete t;
    245245}
    246246
    247 long two_descent_getrank(struct two_descent* t)
     247long two_descent_get_rank(struct two_descent* t)
    248248{
    249249  return t->getrank();
    250250}
    251251
    252 long two_descent_getselmer(struct two_descent* t)
     252long two_descent_get_rank_bound(struct two_descent* t)
     253{
     254  return t->getrankbound();
     255}
     256
     257long two_descent_get_selmer_rank(struct two_descent* t)
    253258{
    254259  return t->getselmer();
    255260}
    256261
    257 char* two_descent_getbasis(struct two_descent* t)
     262char* two_descent_get_basis(struct two_descent* t)
    258263{
    259264  return p2point_vector_to_str(t->getbasis());
    260265}
     
    264269  return t->ok();
    265270}
    266271
    267 long two_descent_getcertain(const struct two_descent* t)
     272long two_descent_get_certain(const struct two_descent* t)
    268273{
    269274  return t->getcertain();
    270275}
  • sage/libs/mwrank/wrap.h

    diff -r bf84525b7290 -r da1d714ce6c6 sage/libs/mwrank/wrap.h
    a b  
    104104
    105105EXTERN void two_descent_del(struct two_descent* t);
    106106
    107 EXTERN long two_descent_getrank(struct two_descent* t);
     107EXTERN long two_descent_get_rank(struct two_descent* t);
    108108
    109 EXTERN long two_descent_getselmer(struct two_descent* t);
     109EXTERN long two_descent_get_rank_bound(struct two_descent* t);
    110110
    111 EXTERN char* two_descent_getbasis(struct two_descent* t);
     111EXTERN long two_descent_get_selmer_rank(struct two_descent* t);
     112
     113EXTERN char* two_descent_get_basis(struct two_descent* t);
    112114
    113115EXTERN int two_descent_ok(const struct two_descent* t);
    114116
    115 EXTERN long two_descent_getcertain(const struct two_descent* t);
     117EXTERN long two_descent_get_certain(const struct two_descent* t);
    116118
    117119EXTERN void two_descent_saturate(struct two_descent* t, long sat_bd); // = 0 for unbounded
    118120
  • sage/schemes/elliptic_curves/ell_rational_field.py

    diff -r bf84525b7290 -r da1d714ce6c6 sage/schemes/elliptic_curves/ell_rational_field.py
    a b  
    24462446        else:
    24472447            return rings.Integer(0)
    24482448
    2449     def selmer_rank_bound(self):
    2450         """
    2451         Bound on the rank of the curve, computed using the 2-selmer group.
    2452         This is the rank of the curve minus the rank of the 2-torsion,
    2453         minus a number determined by whatever mwrank was able to determine
    2454         related to Sha[2]. Thus in many cases, this is the actual rank of
    2455         the curve.
     2449    def selmer_rank(self):
     2450        """
     2451        The rank of the 2-Selmer group of the curve.
    24562452       
    24572453        EXAMPLE: The following is the curve 960D1, which has rank 0, but
    24582454        Sha of order 4.
     
    24602456        ::
    24612457       
    24622458            sage: E = EllipticCurve([0, -1, 0, -900, -10098])
    2463             sage: E.selmer_rank_bound()
     2459            sage: E.selmer_rank()
     2460            3
     2461       
     2462        Here the Selmer rank is equal to the 2-torsion rank (=1) plus
     2463        the 2-rank of Sha (=2), and the rank itself is zero::
     2464
     2465            sage: E.rank()
     2466            0
     2467       
     2468        In contrast, for the curve 571A, also with rank 0 and Sha of
     2469        order 4, we get a worse bound::
     2470       
     2471            sage: E = EllipticCurve([0, -1, 1, -929, -10595])
     2472            sage: E.selmer_rank()
     2473            2
     2474            sage: E.rank_bound()
     2475            2
     2476
     2477        To establish that the rank is in fact 0 in this case, we would
     2478        need to carry out a higher descent::
     2479
     2480            sage: E.three_selmer_rank() # optional: magma
     2481            0
     2482
     2483        Or use the L-function to compute the analytic rank::   
     2484           
     2485            sage: E.rank(only_use_mwrank=False)
     2486            0
     2487        """
     2488        try:
     2489            return self.__selmer_rank
     2490        except AttributeError:
     2491            C = self.mwrank_curve()
     2492            self.__selmer_rank = C.selmer_rank()
     2493            return self.__selmer_rank
     2494   
     2495           
     2496    def rank_bound(self):
     2497        """
     2498        Upper bound on the rank of the curve, computed using
     2499        2-descent.  In many cases, this is the actual rank of the
     2500        curve.  If the curve has no 2-torsion it is the same as the
     2501        2-selmer rank.
     2502       
     2503        EXAMPLE: The following is the curve 960D1, which has rank 0, but
     2504        Sha of order 4.
     2505       
     2506        ::
     2507       
     2508            sage: E = EllipticCurve([0, -1, 0, -900, -10098])
     2509            sage: E.rank_bound()
    24642510            0
    24652511       
    24662512        It gives 0 instead of 2, because it knows Sha is nontrivial. In
     
    24682514        we get a worse bound::
    24692515       
    24702516            sage: E = EllipticCurve([0, -1, 1, -929, -10595])
    2471             sage: E.selmer_rank_bound()
     2517            sage: E.rank_bound()
    24722518            2
    24732519            sage: E.rank(only_use_mwrank=False)   # uses L-function
    24742520            0
    24752521        """
    24762522        try:
    2477             return self.__selmer_rank_bound
     2523            return self.__rank_bound
    24782524        except AttributeError:
    24792525            C = self.mwrank_curve()
    2480             self.__selmer_rank_bound = C.selmer_rank_bound()
    2481             return self.__selmer_rank_bound
     2526            self.__rank_bound = C.rank_bound()
     2527            return self.__rank_bound
    24822528   
    24832529           
    24842530    def an(self, n):
     
    55555601        A curve for which 3 divides the order of the Shafarevich-Tate group::
    55565602
    55575603            sage: E = EllipticCurve('681b')                       
    5558             sage: E.prove_BSD(verbosity=2)               # long time
     5604            sage: E.prove_BSD(verbosity=2)
    55595605            p = 2: Unverified since it is difficult to access the rank bound for Sha[2] computed by MWrank
    55605606            True for p not in {2, 3} by Kolyvagin.
    55615607            ALERT: p = 3 left in Kolyvagin bound
     
    55805626       
    55815627            sage: E = EllipticCurve('438e1')
    55825628            sage: E.prove_BSD(verbosity=1)
    5583             p = 2: mwrank did not achieve a tight bound on the Selmer rank.
     5629            p = 2: Unverified since it is difficult to access the rank bound for Sha[2] computed by MWrank
    55845630            True for p not in {2} by Kolyvagin.
    55855631            [2]
    55865632       
    55875633        ::
    55885634       
    55895635            sage: E = EllipticCurve('960d1')
    5590             sage: E.prove_BSD(verbosity=1)
     5636            sage: E.prove_BSD(verbosity=1) # long time
    55915637            p = 2: Unverified since it is difficult to access the rank bound for Sha[2] computed by MWrank
    55925638            Timeout stopped Heegner index computation...
    55935639            Proceeding to use heegner_index_bound instead.
     
    56125658            else:
    56135659                raise RuntimeError("Rank can't be computed precisely using Simon's program.")
    56145660        else:
    5615             two_sel_rk_bd = self.mwrank_curve().selmer_rank_bound()
     5661            two_sel_rk_bd = self.rank_bound()
    56165662            rank = self.rank()
    56175663        if rank > 1:
    56185664            # We do not know BSD(E,p) for even a single p, since it's
     
    56375683                print 'p = 2: mwrank did not achieve a tight bound on the Selmer rank.'
    56385684            two_proven = False
    56395685        elif two_sel_rk_bd < rank:
    5640             raise RuntimeError("MWrank seems to have computed an incorrect lower bound of %d on the rank."%two_sel_rk_bd)
     5686            raise RuntimeError("MWrank seems to have computed an incorrect upper bound of %d on the rank."%two_sel_rk_bd)
    56415687        else:
    56425688            # until we can easily access the computed rank of Sha[2]:
    56435689            two_proven = False
  • sage/schemes/elliptic_curves/sha_tate.py

    diff -r bf84525b7290 -r da1d714ce6c6 sage/schemes/elliptic_curves/sha_tate.py
    a b  
    640640
    641641    def two_selmer_bound(self):
    642642        r"""
    643         This returns a lower bound on the `\mathbb{F}_2`-dimension
     643        This returns the 2-rank, i.e. the `\mathbb{F}_2`-dimension
    644644        of the 2-torsion part of Sha, provided we can determine the
    645         rank of `E`. But it is not the best possible bound.
    646 
    647         TO DO: This should be rewritten, to give the exact order
    648         of Sha[2], or if we can not find sufficiently many points
    649         it should give a lower bound.
    650 
     645        rank of `E`.
    651646        EXAMPLE::
    652647
    653648            sage: sh = EllipticCurve('571a1').sha()
     
    664659
    665660            sage: sh = EllipticCurve('960d1').sha()
    666661            sage: sh.two_selmer_bound()
    667             0
     662            2
    668663            sage: sh.an()
    669664            4
    670665        """
    671         S = self.E.selmer_rank_bound()
     666        S = self.E.selmer_rank()
    672667        r = self.E.rank()
    673668        t = self.E.two_torsion_rank()
    674669        b = S - r - t
    675         # the following is not true, selmer_rank_bound also
    676         # uses descent by two-isogeny, so b need not be even.
    677         # e.g. for 66a1, we find b = -1.
    678         #if b % 2 != 0:
    679         #    raise ArithmeticError, "There is a bug in two_selmer_bound since it's %s, but it must be even."%b
    680670        if  b < 0 :
    681671            b = 0
    682672        return b