Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagesmc
Path: blob/master/src/sage/schemes/elliptic_curves/ell_padic_field.py
8820 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
43
EXAMPLES::
44
45
sage: Qp=pAdicField(17)
46
sage: E=EllipticCurve(Qp,[2,3]); E
47
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
48
sage: E == loads(dumps(E))
49
True
50
"""
51
if y is None:
52
if isinstance(x, list):
53
ainvs = x
54
field = ainvs[0].parent()
55
else:
56
if isinstance(y, str):
57
field = x
58
X = sage.databases.cremona.CremonaDatabase()[y]
59
ainvs = [field(a) for a in X.a_invariants()]
60
else:
61
field = x
62
ainvs = y
63
if not (isinstance(field, ring.Ring) and isinstance(ainvs,list)):
64
raise TypeError
65
66
EllipticCurve_field.__init__(self, [field(x) for x in ainvs])
67
68
self._point = ell_point.EllipticCurvePoint_field
69
self._genus = 1
70
71
def frobenius(self, P=None):
72
"""
73
Returns the Frobenius as a function on the group of points of
74
this elliptic curve.
75
76
EXAMPLE::
77
78
sage: Qp=pAdicField(13)
79
sage: E=EllipticCurve(Qp,[1,1])
80
sage: type(E.frobenius())
81
<type 'function'>
82
sage: point=E(0,1)
83
sage: E.frobenius(point)
84
(0 : 1 + O(13^20) : 1 + O(13^20))
85
"""
86
try:
87
_frob = self._frob
88
except AttributeError:
89
K = self.base_field()
90
p = K.prime()
91
x = PolynomialRing(K, 'x').gen(0)
92
93
a1, a2, a3, a4, a6 = self.a_invariants()
94
if a1 != 0 or a2 != 0:
95
raise NotImplementedError, "Curve must be in weierstrass normal form."
96
97
f = x*x*x + a2*x*x + a4*x + a6
98
h = (f(x**p) - f**p)
99
100
# internal function: I don't know how to doctest it...
101
def _frob(P):
102
x0 = P[0]
103
y0 = P[1]
104
uN = (1 + h(x0)/y0**(2*p)).sqrt()
105
yres=y0**p * uN
106
xres=x0**p
107
if (yres-y0).valuation() == 0:
108
yres=-yres
109
return self.point([xres,yres, K(1)])
110
111
self._frob = _frob
112
113
if P is None:
114
return _frob
115
else:
116
return _frob(P)
117
118