Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
241852 views
1
#################################################################################
2
#
3
# (c) Copyright 2011 William Stein
4
#
5
# This file is part of PSAGE
6
#
7
# PSAGE is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# PSAGE is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
19
#
20
#################################################################################
21
22
from sage.all import EllipticCurve
23
24
from psage.modform.hilbert.sqrt5.sqrt5 import F
25
26
def r_an(ainvs, eps=1e-4):
27
E = EllipticCurve(F, ainvs)
28
L = E.lseries()
29
D = L.dokchitser(30)
30
f = D.taylor_series(1)
31
r = 0
32
while abs(f[r]) < eps:
33
r += 1
34
if D.eps == 1:
35
assert r%2 == 0
36
else:
37
assert r%2 == 1
38
return r
39
40
def r_alg(a_invs):
41
return EllipticCurve(F, a_invs).rank()
42
43
from sage.all import fork
44
@fork
45
def rank(a_invs):
46
try:
47
return r_alg(a_invs)
48
except ValueError:
49
return r_an(a_invs)
50
51
def compute_conjectural_ranks(level_norms, address='localhost:29000'):
52
"""
53
For each level norm in the input list, compute the
54
*conjectural* rank of the elliptic curve, and put
55
that data in a field "r?" in the database.
56
This uses Simon 2-descent if it works, and otherwise
57
uses Dokchitser. This should not be considered
58
super-reliable!
59
"""
60
from sage.all import sage_eval
61
62
import util
63
C = util.ellcurves_sqrt5(address)
64
for N in level_norms:
65
for E in C.find({'Nlevel':int(N), 'r?':{'$exists':False}, 'weq':{'$exists':True}}):
66
print E
67
weq = sage_eval(E['weq'], {'a':F.gen()})
68
E['r?'] = int(rank(weq))
69
print E
70
C.update({'_id':E['_id']}, E, safe=True)
71
72
73
74
75
76