Sharedwww / talks / mazur-explicit-formula / explicit.sageOpen in CoCalc
Author: William A. Stein
1
from sage.all import EllipticCurve, pi, latex, parallel, save
2
import os
3
4
curves = ["11a", "14a", "37a", "43a", "389a", "433a", "5077a", "11197a"]
5
means = [('11a', 0.6474706006966815, 0.5979459030113199, 0.15543478452293413),
6
('14a', 0.7521823115223413, 0.5541743260941198, 0.11443069533660696),
7
('37a', -1.4116143718516094, -1.9670347032628086, -0.8160519544427207),
8
('43a', -0.3659895692713372, -1.9059869298758216, -0.792188062142615),
9
('389a', -2.6577327851232084, -4.292846440582865, -1.6630873161756692),
10
('433a', -4.054771989404445, -4.166734867770748, -1.6174451331282922),
11
('5077a', -5.228033507844708, -6.59770992518664, -2.5074196009380243),
12
('11197a', -4.428204654385869, -6.288709783782257, -2.360221866060336)]
13
14
15
def raw(E):
16
r = E.rank()
17
raise NotImplementedError
18
19
def conj_medium(E):
20
return 1-2*E.rank()
21
22
def conj_well(E):
23
return -E.rank()
24
25
def example_table():
26
res = ''
27
for lbl,raw_mean,medium_mean,well_mean in means:
28
E = EllipticCurve(lbl)
29
row = [lbl, E.rank(), '%.3f'%raw_mean, '%.3f'%medium_mean, conj_medium(E), '%.3f'%well_mean, conj_well(E)]
30
res += '<tr id="curve-%s">'%lbl + ''.join(["<td>%s</td>"%x for x in row]) + '</tr>\n'
31
return res
32
33
34
@parallel(len(curves))
35
def compute_aplists_and_zeros(i):
36
num_ap = 10^9
37
num_zeros = 10^4
38
if not os.path.exists('data'):
39
os.makedirs('data')
40
lbl = curves[i]
41
E = EllipticCurve(lbl)
42
aplist_sobj = 'data/%s-aplist-%s.sobj'%(lbl, num_ap)
43
zeros_sobj = 'data/%s-zeros-%s.sobj'%(lbl, num_zeros)
44
if not os.path.exists(aplist_sobj):
45
v = E.aplist(num_ap)
46
v = [int(ap) for ap in v]
47
save(v, aplist_sobj)
48
if not os.path.exists(zeros_sobj):
49
zeros = [float(y) for y in E.lseries().zeros(num_zeros)]
50
save(zeros, zeros_sobj)
51
52
def compute_all_aplists_and_zeros():
53
for X in compute_aplists_and_zeros(range(len(curves))):
54
print X
55