Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/schemes/elliptic_curves/ell_padic_field.py
4159 views
1
"""
2
Elliptic curves over padic fields
3
"""
4
5
#*****************************************************************************
6
# Copyright (C) 2007 Robert Bradshaw <[email protected]>
7
# William Stein <[email protected]>
8
#
9
# Distributed under the terms of the GNU General Public License (GPL)
10
#
11
# This code is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
# General Public License for more details.
15
#
16
# The full text of the GPL is available at:
17
#
18
# http://www.gnu.org/licenses/
19
#*****************************************************************************
20
21
22
import sage.rings.ring as ring
23
from ell_field import EllipticCurve_field
24
import ell_point
25
from sage.rings.all import PolynomialRing
26
27
# Elliptic curves are very different than genus > 1 hyperelliptic curves,
28
# there is an "is a" relationship here, and common implementation with regard
29
# Coleman integration.
30
from sage.schemes.hyperelliptic_curves.hyperelliptic_padic_field import HyperellipticCurve_padic_field
31
32
import sage.databases.cremona
33
34
35
class EllipticCurve_padic_field(EllipticCurve_field, HyperellipticCurve_padic_field):
36
"""
37
Elliptic curve over a padic field.
38
"""
39
def __init__(self, x, y=None):
40
"""
41
Constructor from [a1,a2,a3,a4,a6] or [a4,a6].
42
EXAMPLES:
43
sage: Qp=pAdicField(17)
44
sage: E=EllipticCurve(Qp,[2,3]); E
45
Elliptic Curve defined by y^2 = x^3 + (2+O(17^20))*x + (3+O(17^20)) over 17-adic Field with capped relative precision 20
46
sage: E == loads(dumps(E))
47
True
48
"""
49
if y is None:
50
if isinstance(x, list):
51
ainvs = x
52
field = ainvs[0].parent()
53
else:
54
if isinstance(y, str):
55
field = x
56
X = sage.databases.cremona.CremonaDatabase()[y]
57
ainvs = [field(a) for a in X.a_invariants()]
58
else:
59
field = x
60
ainvs = y
61
if not (isinstance(field, ring.Ring) and isinstance(ainvs,list)):
62
raise TypeError
63
64
EllipticCurve_field.__init__(self, [field(x) for x in ainvs])
65
66
self._point = ell_point.EllipticCurvePoint_field
67
self._genus = 1
68
69
def frobenius(self, P=None):
70
"""
71
Returns the Frobenius as a function on the group of points of
72
this elliptic curve.
73
74
EXAMPLE:
75
sage: Qp=pAdicField(13)
76
sage: E=EllipticCurve(Qp,[1,1])
77
sage: type(E.frobenius())
78
<type 'function'>
79
sage: point=E(0,1)
80
sage: E.frobenius(point)
81
(0 : 1 + O(13^20) : 1 + O(13^20))
82
"""
83
try:
84
_frob = self._frob
85
except AttributeError:
86
K = self.base_field()
87
p = K.prime()
88
x = PolynomialRing(K, 'x').gen(0)
89
90
a1, a2, a3, a4, a6 = self.a_invariants()
91
if a1 != 0 or a2 != 0:
92
raise NotImplementedError, "Curve must be in weierstrass normal form."
93
94
f = x*x*x + a2*x*x + a4*x + a6
95
h = (f(x**p) - f**p)
96
97
# internal function: I don't know how to doctest it...
98
def _frob(P):
99
x0 = P[0]
100
y0 = P[1]
101
uN = (1 + h(x0)/y0**(2*p)).sqrt()
102
yres=y0**p * uN
103
xres=x0**p
104
if (yres-y0).valuation() == 0:
105
yres=-yres
106
return self.point([xres,yres, K(1)])
107
108
self._frob = _frob
109
110
if P is None:
111
return _frob
112
else:
113
return _frob(P)
114
115