# HG changeset patch
# User Chris Wuthrich
# 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/sage/schemes/elliptic_curves/ell_modular_symbols.py Sun Jun 20 09:21:13 2010 +0100
+++ b/sage/schemes/elliptic_curves/ell_modular_symbols.py Tue Jun 22 18:45:16 2010 +0100
@@ 1,3 +1,4 @@
+# * coding: utf8 *
r"""
Modular symbols
@@ 286,7 +287,7 @@
at0 = self(0)
# print 'modular symbol evaluates to ',at0,' at 0'
if at0 != 0 :
 l1 = self.__lalg(1)
+ l1 = self.__lalg__(1)
if at0 != l1:
verbose('scale modular symbols by %s'%(l1/at0))
self._scaling = l1/at0
@@ 313,11 +314,11 @@
msn = ModularSymbolSage(self._E,sign = 1,normalize = "L_ratio")
sc = msn._scaling
if sc == 0 or self._use_eclib : #
 self.__scale_by_periods_only()
+ self.__scale_by_periods_only__()
else :
self._scaling = sc
else :
 l1 = self.__lalg(D)
+ l1 = self.__lalg__(D)
if at0 != l1:
verbose('scale modular symbols by %s'%(l1/at0))
self._scaling = l1/at0
@@ 337,15 +338,15 @@
j += 1
if j == 9 and at0 == 0: # no more hope for a normalization
# we do at least a scaling with the quotient of the periods
 self.__scale_by_periods_only()
+ self.__scale_by_periods_only__()
else :
 l1 = self.__lalg(D)
+ l1 = self.__lalg__(D)
if at0 != l1:
verbose('scale modular symbols by %s'%(l1/at0))
self._scaling = l1/at0
 def __lalg(self,D):
+ def __lalg__(self,D):
r"""
For positive `D`, this function evaluates the quotient
`L(E_D,1)\cdot \sqrt(D)/\Omega_E` where `E_D` is the twist of
@@ 354,6 +355,16 @@
`L(E_D,1)\cdot \sqrt(D)/\Omega^{}_E`
where `\Omega^{}_E` is the least positive imaginary part of a
nonreal period of `E`.
+
+ EXMAPLES::
+
+ sage: E = EllipticCurve('11a1')
+ sage: m = E.modular_symbol(sign=+1)
+ sage: m.__lalg__(1)
+ 1/5
+ sage: m.__lalg__(3)
+ 5/2
+
"""
from sage.functions.all import sqrt
# the computation of the Lvalue could take a lot of time,
@@ 377,12 +388,29 @@
verbose('real approximation is %s'%q)
return lv/8 * QQ(int(round(q)))
 def __scale_by_periods_only(self):
+ def __scale_by_periods_only__(self):
r"""
If we fail to scale with ``_find_scaling_L_ratio``, we drop here
to try and find the scaling by the quotient of the
periods to the `X_0`optimal curve. The resulting ``_scaling``
is not guaranteed to be correct, but could well be.
+
+ EXAMPLES::
+
+ sage: E = EllipticCurve('11a1')
+ sage: m = E.modular_symbol(sign=+1)
+ sage: m.__scale_by_periods_only__()
+ Warning : Could not normalize the modular symbols, maybe all further results will be multiplied by 1, 2 or 2.
+ sage: m._scaling
+ 1
+
+ sage: E = EllipticCurve('11a3')
+ sage: m = E.modular_symbol(sign=+1, use_eclib=True)
+ sage: m.__scale_by_periods_only__()
+ Warning : Could not normalize the modular symbols, maybe all further results will be multiplied by 1, 2 or 2.
+ sage: m._scaling
+ 1/5
+
"""
# we only do this inside the cremonatables.
try :
diff r c6dd5166f5dc r bb2469df969a sage/schemes/elliptic_curves/ell_torsion.py
 a/sage/schemes/elliptic_curves/ell_torsion.py Sun Jun 20 09:21:13 2010 +0100
+++ b/sage/schemes/elliptic_curves/ell_torsion.py Tue Jun 22 18:45:16 2010 +0100
@@ 1,3 +1,4 @@
+# * coding: utf8 *
r"""
Torsion subgroups of elliptic curves over number fields (including `\QQ`).
@@ 150,6 +151,10 @@
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
sage: type(T)
+
+ sage: T == loads(dumps(T))
+ True
+
"""
self.__E = E
self.__K = E.base_field()
@@ 224,6 +229,23 @@
"""
return "Torsion Subgroup isomorphic to %s associated to the %s" % (groups.AbelianGroup_class._repr_(self), self.__E)
+ def __cmp__(self,other):
+ r"""
+ Compares two torsion groups by simply comparing the elliptic curves.
+
+ EXAMPLES::
+
+ sage: E = EllipticCurve('37a1')
+ sage: tor = E.torsion_subgroup()
+ sage: tor == tor
+ True
+ """
+ c = cmp(type(self), type(other))
+ if c:
+ return c
+ return cmp(self.__E, other.__E)
+
+
def gen(self, i=0):
"""
Return the `i`'th torsion generator.
diff r c6dd5166f5dc r bb2469df969a sage/schemes/elliptic_curves/sha_tate.py
 a/sage/schemes/elliptic_curves/sha_tate.py Sun Jun 20 09:21:13 2010 +0100
+++ b/sage/schemes/elliptic_curves/sha_tate.py Tue Jun 22 18:45:16 2010 +0100
@@ 5,8 +5,48 @@
If `E` is an elliptic curve over a global field `K`, the ShafarevichTate group
is the subgroup of elements in `H^1(K,E)` which map to zero under every globaltolocal
restriction map `H^1(K,E) \to H^1(K_v,E)`, one for each place `v`
of `K`. It is known to be a torsion group and the `m`torsion is finite for all `m>1`.
It is conjectured to be finite.
+of `K`.
+
+The group is usually denoted by the Russian letter Sha.
+
+Sha is known to be an abelian torsion group. It is conjectured that the TateShafarevich group is finite for any elliptic curve over a global field. But it is not known in general.
+
+A theorem of Kolyvagin and GrossZagier using Heegner points shows that if the Lseries of an elliptic curve `E/\mathbb{Q}` does not
+vanish at 1 or has a simple zero there, then Sha is finite.
+
+A 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.
+
+The (`p`adic) conjecture of Birch and SwinnertonDyer predicts the order of Sha from the leading term of the (`p`adic) Lseries of the elliptic curve.
+
+Sage 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.
+
+EXAMPLES::
+
+ sage: E = EllipticCurve('11a1')
+ sage: S = E.sha()
+ sage: S.bound_kato()
+ [2, 3, 5]
+ sage: S.bound_kolyvagin()
+ ([2, 5], 1)
+ sage: S.an_padic(7,3) #long
+ 1 + O(7^5)
+ sage: S.an()
+ 1
+ sage: S.an_numerical()
+ 1.00000000000000
+
+ sage: E = EllipticCurve('389a')
+ sage: S = E.sha(); S
+ ShafarevichTate group for the Elliptic Curve defined by y^2 + y = x^3 + x^2  2*x over Rational Field
+ sage: S.an_numerical()
+ 1.00000000000000
+ sage: S.p_primary_bound(5) #long
+ 0
+ sage: S.an_padic(5) #long
+ 1 + O(5)
+ sage: S.an_padic(5,prec=4) #long
+ 1 + O(5^3)
+
AUTHORS:
@@ 55,19 +95,86 @@
If `E` is an elliptic curve over a global field `K`, the ShafarevichTate group
is the subgroup of elements in `H^1(K,E)` which map to zero under every globaltolocal
restriction map `H^1(K,E) \to H^1(K_v,E)`, one for each place `v`
 of `K`.

+ of `K`.
+
EXAMPLES::
+ sage: E = EllipticCurve('571a1')
+ sage: S = E.sha()
+ sage: S.bound_kato()
+ [2, 3]
+ sage: S.bound_kolyvagin()
+ ([2], 1)
+ sage: S.an_padic(7,3) #long
+ 4 + O(7^5)
+ sage: S.an()
+ 4
+ sage: S.an_numerical()
+ 4.00000000000000
+
sage: E = EllipticCurve('389a')
 sage: E.sha()
+ sage: S = E.sha(); S
ShafarevichTate group for the Elliptic Curve defined by y^2 + y = x^3 + x^2  2*x over Rational Field
+ sage: S.an_numerical()
+ 1.00000000000000
+ sage: S.p_primary_bound(5) #long
+ 0
+ sage: S.an_padic(5) #long
+ 1 + O(5)
+ sage: S.an_padic(5,prec=4) #long
+ 1 + O(5^3)
+
+
"""
def __init__(self, E):
+ r"""
+ The ShafarevichTate group associated to an elliptic curve.
+
+ INPUT:
+ a elliptic curve over `\mathbb{Q}`
+
+ EXAMPLES::
+
+ sage: E = EllipticCurve('11a1')
+ sage: S = E.sha()
+ sage: S
+ ShafarevichTate group for the Elliptic Curve defined by y^2 + y = x^3  x^2  10*x  20 over Rational Field
+
+ sage: S == loads(dumps(S))
+ True
+
+ """
self.E = E

+
+ def __cmp__(self,other):
+ r"""
+ Compares two TateShafarevich groups by simply comparing the elliptic curves.
+
+ EXAMPLES::
+
+ sage: E = EllipticCurve('37a1')
+ sage: S = E.sha()
+ sage: S == S
+ True
+ """
+ c = cmp(type(self), type(other))
+ if c:
+ return c
+ return cmp(self.E, other.E)
+
def __repr__(self):
+ r"""
+ String representation of the TatsShafarevich group.
+
+ EXAMPLES::
+
+ sage: E = EllipticCurve('11a1')
+ sage: S = E.sha()
+ sage: S.__repr__()
+ 'ShafarevichTate group for the Elliptic Curve defined by y^2 + y = x^3  x^2  10*x  20 over Rational Field'
+
+ """
return "ShafarevichTate group for the " + repr(self.E)
########################################################################
@@ 195,7 +302,7 @@
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.
Try increasing descent_second_limit then trying this command again.
 You can increase the `descent_second_limit` (in the above example,
+ You can increase the ``descent_second_limit`` (in the above example,
set to the default, 12) option to try again::
sage: E.sha().an(descent_second_limit=16)
@@ 665,7 +772,8 @@
This returns the 2rank, i.e. the `\mathbb{F}_2`dimension
of the 2torsion part of Sha, provided we can determine the
rank of `E`.
 EXAMPLE::
+
+ EXAMPLES::
sage: sh = EllipticCurve('571a1').sha()
sage: sh.two_selmer_bound()