Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagesmc
Path: blob/master/src/sage/schemes/elliptic_curves/ec_database.py
8820 views
1
r"""
2
Tables of elliptic curves of given rank
3
4
The default database of curves contains the following data:
5
6
+------+------------------+--------------------+
7
| Rank | Number of curves | Maximal conductor |
8
+======+==================+====================+
9
| 0 | 30427 | 9999 |
10
+------+------------------+--------------------+
11
| 1 | 31871 | 9999 |
12
+------+------------------+--------------------+
13
| 2 | 2388 | 9999 |
14
+------+------------------+--------------------+
15
| 3 | 836 | 119888 |
16
+------+------------------+--------------------+
17
| 4 | 1 | 234446 |
18
+------+------------------+--------------------+
19
| 5 | 1 | 19047851 |
20
+------+------------------+--------------------+
21
| 6 | 1 | 5187563742 |
22
+------+------------------+--------------------+
23
| 7 | 1 | 382623908456 |
24
+------+------------------+--------------------+
25
| 8 | 1 | 457532830151317 |
26
+------+------------------+--------------------+
27
28
AUTHOR:
29
- William Stein (2007-10-07): initial version
30
31
See also the functions cremona_curves() and cremona_optimal_curves()
32
which enable easy looping through the Cremona elliptic curve database.
33
34
"""
35
36
import os
37
38
from ell_rational_field import (EllipticCurve_rational_field)
39
40
class EllipticCurves:
41
def rank(self, rank, tors=0, n=10, labels=False):
42
r"""
43
Return a list of at most `n` non-isogenous curves with given
44
rank and torsion order.
45
46
INPUT:
47
48
- ``rank`` (int) -- the desired rank
49
50
- ``tors`` (int, default 0) -- the desired torsion order (ignored if 0)
51
52
- ``n`` (int, default 10) -- the maximum number of curves returned.
53
54
- ``labels`` (bool, default False) -- if True, return Cremona
55
labels instead of curves.
56
57
OUTPUT:
58
59
(list) A list at most `n` of elliptic curves of required rank.
60
61
EXAMPLES::
62
63
sage: elliptic_curves.rank(n=5, rank=3, tors=2, labels=True)
64
['59450i1', '59450i2', '61376c1', '61376c2', '65481c1']
65
66
::
67
68
sage: elliptic_curves.rank(n=5, rank=0, tors=5, labels=True)
69
['11a1', '11a3', '38b1', '50b1', '50b2']
70
71
::
72
73
sage: elliptic_curves.rank(n=5, rank=1, tors=7, labels=True)
74
['574i1', '4730k1', '6378c1']
75
76
::
77
78
sage: e = elliptic_curves.rank(6)[0]; e.ainvs(), e.conductor()
79
((1, 1, 0, -2582, 48720), 5187563742)
80
sage: e = elliptic_curves.rank(7)[0]; e.ainvs(), e.conductor()
81
((0, 0, 0, -10012, 346900), 382623908456)
82
sage: e = elliptic_curves.rank(8)[0]; e.ainvs(), e.conductor()
83
((0, 0, 1, -23737, 960366), 457532830151317)
84
85
"""
86
from sage.misc.misc import SAGE_SHARE
87
db = os.path.join(SAGE_SHARE,'ellcurves')
88
data = os.path.join(db,'rank%s'%rank)
89
if not os.path.exists(data):
90
return []
91
v = []
92
tors = int(tors)
93
for w in open(data).readlines():
94
N,iso,num,ainvs,r,t = w.split()
95
if tors and tors != int(t):
96
continue
97
label = '%s%s%s'%(N,iso,num)
98
if labels:
99
v.append(label)
100
else:
101
E = EllipticCurve_rational_field(eval(ainvs))
102
E._set_rank(r)
103
E._set_torsion_order(t)
104
E._set_conductor(N)
105
E._set_cremona_label(label)
106
v.append(E)
107
if len(v) >= n:
108
break
109
return v
110
111
elliptic_curves = EllipticCurves()
112
113
114
115