Ticket #9287: trac_9287.coverage_for_elliptic_curves_part2.patch

File trac_9287.coverage_for_elliptic_curves_part2.patch, 11.4 KB (added by wuthrich, 12 years ago)

also exported against 4.4.4.alpha0

  • sage/schemes/elliptic_curves/ell_modular_symbols.py

    # HG changeset patch
    # User Chris Wuthrich <christian.wuthrich@gmail.com>
    # Date 1277228716 -3600
    # Node ID bb2469df969a7b4d23b9dda574776fd41f4d58fe
    # Parent  c6dd5166f5dce35f2ec7f819051f75d2812807f8
    trac 9287: doctest coverage for elliptic curves, part II
    
    diff -r c6dd5166f5dc -r bb2469df969a sage/schemes/elliptic_curves/ell_modular_symbols.py
    a b  
     1# -*- coding: utf-8 -*-
    12r"""
    23Modular symbols
    34
     
    286287            at0 = self(0)
    287288            # print 'modular symbol evaluates to ',at0,' at 0'
    288289            if at0 != 0 :
    289                 l1 = self.__lalg(1)
     290                l1 = self.__lalg__(1)
    290291                if at0 != l1:
    291292                    verbose('scale modular symbols by %s'%(l1/at0))
    292293                    self._scaling = l1/at0
     
    313314                        msn = ModularSymbolSage(self._E,sign = -1,normalize = "L_ratio")         
    314315                        sc = msn._scaling
    315316                    if sc == 0 or self._use_eclib : #
    316                         self.__scale_by_periods_only()
     317                        self.__scale_by_periods_only__()
    317318                    else :
    318319                        self._scaling = sc
    319320                else :
    320                     l1 = self.__lalg(D)
     321                    l1 = self.__lalg__(D)
    321322                    if at0 != l1:
    322323                        verbose('scale modular symbols by %s'%(l1/at0))
    323324                        self._scaling = l1/at0
     
    337338                j += 1
    338339            if j == 9 and at0 == 0: # no more hope for a normalization
    339340                # we do at least a scaling with the quotient of the periods
    340                 self.__scale_by_periods_only()
     341                self.__scale_by_periods_only__()
    341342            else :
    342                 l1 = self.__lalg(D)
     343                l1 = self.__lalg__(D)
    343344                if at0 != l1:
    344345                    verbose('scale modular symbols by %s'%(l1/at0))
    345346                    self._scaling = l1/at0
    346347                 
    347348
    348     def __lalg(self,D):
     349    def __lalg__(self,D):
    349350        r"""
    350351        For positive `D`, this function evaluates the quotient
    351352        `L(E_D,1)\cdot \sqrt(D)/\Omega_E` where `E_D` is the twist of
     
    354355        `L(E_D,1)\cdot \sqrt(-D)/\Omega^{-}_E`
    355356        where `\Omega^{-}_E` is the least positive imaginary part of a
    356357        non-real period of `E`.
     358
     359        EXMAPLES::
     360
     361            sage: E = EllipticCurve('11a1')
     362            sage: m = E.modular_symbol(sign=+1)
     363            sage: m.__lalg__(1)
     364            1/5
     365            sage: m.__lalg__(3)
     366            5/2
     367
    357368        """
    358369        from sage.functions.all import sqrt
    359370        # the computation of the L-value could take a lot of time,
     
    377388        verbose('real approximation is %s'%q)
    378389        return lv/8 * QQ(int(round(q)))
    379390
    380     def __scale_by_periods_only(self):
     391    def __scale_by_periods_only__(self):
    381392        r"""
    382393        If we fail to scale with ``_find_scaling_L_ratio``, we drop here
    383394        to try and find the scaling by the quotient of the
    384395        periods to the `X_0`-optimal curve. The resulting ``_scaling``
    385396        is not guaranteed to be correct, but could well be.
     397
     398        EXAMPLES::
     399
     400            sage: E = EllipticCurve('11a1')
     401            sage: m = E.modular_symbol(sign=+1)
     402            sage: m.__scale_by_periods_only__()
     403            Warning : Could not normalize the modular symbols, maybe all further results will be multiplied by -1, 2 or -2.
     404            sage: m._scaling
     405            1
     406
     407            sage: E = EllipticCurve('11a3')
     408            sage: m = E.modular_symbol(sign=+1, use_eclib=True)
     409            sage: m.__scale_by_periods_only__()
     410            Warning : Could not normalize the modular symbols, maybe all further results will be multiplied by -1, 2 or -2.
     411            sage: m._scaling
     412            1/5
     413
    386414        """
    387415        # we only do this inside the cremona-tables.
    388416        try :
  • sage/schemes/elliptic_curves/ell_torsion.py

    diff -r c6dd5166f5dc -r bb2469df969a sage/schemes/elliptic_curves/ell_torsion.py
    a b  
     1# -*- coding: utf-8 -*-
    12r"""
    23Torsion subgroups of elliptic curves over number fields (including `\QQ`).
    34
     
    150151            Torsion Subgroup isomorphic to Multiplicative Abelian Group isomorphic to C5 associated to the Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in i with defining polynomial x^2 + 1
    151152            sage: type(T)
    152153            <class 'sage.schemes.elliptic_curves.ell_torsion.EllipticCurveTorsionSubgroup_with_category'>
     154
     155            sage: T == loads(dumps(T))
     156            True
     157
    153158        """
    154159        self.__E = E
    155160        self.__K = E.base_field()
     
    224229        """
    225230        return "Torsion Subgroup isomorphic to %s associated to the %s" % (groups.AbelianGroup_class._repr_(self), self.__E)
    226231
     232    def __cmp__(self,other):
     233        r"""
     234        Compares two torsion groups by simply comparing the elliptic curves.
     235
     236        EXAMPLES::
     237
     238            sage: E = EllipticCurve('37a1')
     239            sage: tor  = E.torsion_subgroup()
     240            sage: tor == tor
     241            True
     242        """
     243        c = cmp(type(self), type(other))
     244        if c:
     245            return c
     246        return cmp(self.__E, other.__E)               
     247
     248
    227249    def gen(self, i=0):
    228250        """
    229251        Return the `i`'th torsion generator.
  • sage/schemes/elliptic_curves/sha_tate.py

    diff -r c6dd5166f5dc -r bb2469df969a sage/schemes/elliptic_curves/sha_tate.py
    a b  
    55If `E` is an elliptic curve over a global field `K`, the Shafarevich-Tate group
    66is the subgroup of elements in `H^1(K,E)` which map to zero under every global-to-local
    77restriction map `H^1(K,E) \to H^1(K_v,E)`, one for each place `v`
    8 of `K`. It is known to be a torsion group and the `m`-torsion is finite for all `m>1`.
    9 It is conjectured to be finite.
     8of `K`.
     9
     10The group is usually denoted by the Russian letter Sha.
     11   
     12Sha is known to be an abelian torsion group. It is conjectured that the Tate-Shafarevich group is finite for any elliptic curve over a global field. But it is not known in general.
     13
     14A theorem of Kolyvagin and Gross-Zagier using Heegner points shows that if the L-series of an elliptic curve `E/\mathbb{Q}` does not
     15vanish at 1 or has a simple zero there, then Sha is finite.
     16
     17A theorem of Kato, together with theorems from Iwasawa theory, allow for certain primes `p` to show that the `p`-primary part of Sha is finite and gives an effective upper bound for it.
     18
     19The (`p`-adic) conjecture of Birch and Swinnerton-Dyer predicts the order of Sha from the leading term of the (`p`-adic) L-series of the elliptic curve.
     20
     21Sage can compute a few things about Sha. The commands ``an``, ``an_numerical`` and ``an_padic`` compute the conjectural order of Sha as a real or `p`-adic number. With ``p_primary_bound`` one can find an upper bound of the size of the `p`-primary part of Sha. Finally, if the analytic rank is at most 1, then ``bound_kato`` and ``bound_kolyvagin`` find all primes for which we the theorems of Kato and Kolyvagin respectively do not prove the triviality the `p`-primary part of Sha.
     22
     23EXAMPLES::
     24
     25    sage: E = EllipticCurve('11a1')
     26    sage: S = E.sha()
     27    sage: S.bound_kato()
     28    [2, 3, 5]
     29    sage: S.bound_kolyvagin()
     30    ([2, 5], 1)
     31    sage: S.an_padic(7,3)  #long
     32    1 + O(7^5)
     33    sage: S.an()
     34    1
     35    sage: S.an_numerical()
     36    1.00000000000000
     37
     38    sage: E = EllipticCurve('389a')
     39    sage: S = E.sha(); S
     40    Shafarevich-Tate group for the Elliptic Curve defined by y^2 + y = x^3 + x^2 - 2*x over Rational Field
     41    sage: S.an_numerical()
     42    1.00000000000000
     43    sage: S.p_primary_bound(5) #long
     44    0
     45    sage: S.an_padic(5)  #long
     46    1 + O(5)
     47    sage: S.an_padic(5,prec=4) #long
     48    1 + O(5^3)
     49
    1050
    1151AUTHORS:
    1252
     
    5595    If `E` is an elliptic curve over a global field `K`, the Shafarevich-Tate group
    5696    is the subgroup of elements in `H^1(K,E)` which map to zero under every global-to-local
    5797    restriction map `H^1(K,E) \to H^1(K_v,E)`, one for each place `v`
    58     of `K`.
    59    
     98    of `K`. 
     99
    60100    EXAMPLES::
    61101
     102        sage: E = EllipticCurve('571a1')
     103        sage: S = E.sha()
     104        sage: S.bound_kato()
     105        [2, 3]
     106        sage: S.bound_kolyvagin()
     107        ([2], 1)
     108        sage: S.an_padic(7,3)  #long
     109        4 + O(7^5)
     110        sage: S.an()
     111        4
     112        sage: S.an_numerical()
     113        4.00000000000000
     114
    62115        sage: E = EllipticCurve('389a')
    63         sage: E.sha()
     116        sage: S = E.sha(); S
    64117        Shafarevich-Tate group for the Elliptic Curve defined by y^2 + y = x^3 + x^2 - 2*x over Rational Field
     118        sage: S.an_numerical()
     119        1.00000000000000
     120        sage: S.p_primary_bound(5) #long
     121        0
     122        sage: S.an_padic(5)  #long
     123        1 + O(5)
     124        sage: S.an_padic(5,prec=4) #long
     125        1 + O(5^3)
     126
     127
    65128
    66129    """
    67130    def __init__(self, E):
     131        r"""
     132        The Shafarevich-Tate group associated to an elliptic curve.
     133     
     134        INPUT:
     135        a elliptic curve over `\mathbb{Q}`
     136       
     137        EXAMPLES::
     138       
     139            sage: E = EllipticCurve('11a1')
     140            sage: S = E.sha()
     141            sage: S
     142            Shafarevich-Tate group for the Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field
     143
     144            sage: S == loads(dumps(S))
     145            True
     146
     147        """
    68148        self.E = E
    69    
     149
     150    def __cmp__(self,other):
     151        r"""
     152        Compares two Tate-Shafarevich groups by simply comparing the elliptic curves.
     153
     154        EXAMPLES::
     155
     156            sage: E = EllipticCurve('37a1')
     157            sage: S = E.sha()
     158            sage: S == S
     159            True
     160        """
     161        c = cmp(type(self), type(other))
     162        if c:
     163            return c
     164        return cmp(self.E, other.E)               
     165
    70166    def __repr__(self):
     167        r"""
     168        String representation of the Tats-Shafarevich group.
     169
     170        EXAMPLES::
     171
     172            sage: E = EllipticCurve('11a1')
     173            sage: S = E.sha()
     174            sage: S.__repr__()
     175            'Shafarevich-Tate group for the Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field'
     176
     177        """
    71178        return "Shafarevich-Tate group for the " + repr(self.E)
    72179
    73180    ########################################################################
     
    195302            RuntimeError: Unable to compute the rank, hence generators, with certainty (lower bound=0, generators found=[]).  This could be because Sha(E/Q)[2] is nontrivial.
    196303            Try increasing descent_second_limit then trying this command again.
    197304
    198         You can increase the `descent_second_limit` (in the above example,
     305        You can increase the ``descent_second_limit`` (in the above example,
    199306        set to the default, 12) option to try again::
    200307
    201308            sage: E.sha().an(descent_second_limit=16)
     
    665772        This returns the 2-rank, i.e. the `\mathbb{F}_2`-dimension
    666773        of the 2-torsion part of Sha, provided we can determine the
    667774        rank of `E`.
    668         EXAMPLE::
     775
     776        EXAMPLES::
    669777
    670778            sage: sh = EllipticCurve('571a1').sha()
    671779            sage: sh.two_selmer_bound()