Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
AndrewVSutherland
GitHub Repository: AndrewVSutherland/lmfdb
Path: blob/main/scripts/hmf/hmf-dump-fldpoly.sage
1457 views
1
'''
2
script written just for use at June 2017 LMFDB workshop at Warwick. Output is text files including:
3
label, AL eigenvalues, AL fixed, base change, CM, with a_PP for bad primes appended.
4
'''
5
from pymongo.mongo_client import MongoClient
6
import pymongo
7
C = MongoClient(port=int(37010))
8
C['admin'].authenticate('lmfdb','lmfdb') # for read access.
9
hmfs = C.hmfs
10
fields = hmfs.fields
11
#fieldlabels = fields.distinct('label')
12
fields = C.numberfields.fields
13
14
def clean(A):
15
st = str(A)
16
return st.replace(' ','').replace('u\'','').replace('\'','')
17
fieldlabels = [
18
'4.4.1600.1',
19
'4.4.2304.1',
20
'4.4.4225.1',
21
'4.4.7056.1',
22
'4.4.7168.1',
23
'4.4.7225.1',
24
'4.4.9248.1',
25
'4.4.11025.1',
26
'4.4.12400.1',
27
'4.4.12544.1',
28
'4.4.13824.1',
29
'4.4.14336.1',
30
'4.4.17424.1',
31
'5.5.180769.1',
32
'6.6.1134389.1',
33
'4.4.19600.1',
34
'6.6.1528713.1',
35
'6.6.905177.1'
36
]
37
for Flabel in fieldlabels:
38
# sample Flabel 4.4.16448.2
39
query = {'label':Flabel}
40
coeffs = '['+fields.find_one(query)['coeffs']+']'
41
#sage: fields.find_one()['coeffs']
42
#u'-2625040,6270,0,1'
43
K = NumberField(PolynomialRing(QQ,'x')(sage_eval(coeffs)),'w')
44
vars = {'w':K.0}
45
degree = Flabel.split('.')[0]
46
assert degree == str(K.degree())
47
with open('data/'+degree+'/'+Flabel+'-extra.txt','r') as infile:
48
with open('data/'+degree+'/'+Flabel+'-extra-plus.txt','w') as outfile:
49
for line in infile:
50
# sample 3.3.1016.1-2.1-a:[2,2,w]:no:no:[[[2,2,w],-1]]:done
51
Ndata = sage_eval(line.split(':')[1].replace('^','**'), locals = vars)
52
N = K.ideal(Ndata)
53
ALdata_list = sage_eval(line.split(':')[4].replace('^','**'), locals = vars)
54
change_ap = []
55
for ALdata in ALdata_list:
56
pp = K.ideal(ALdata[0])
57
if N.valuation(pp) == 1:
58
# Need to change a_pp !!!
59
# should be (-1)*AL_eval
60
change_ap.append([ALdata[0],-ALdata[1]])
61
alldata = [line.rstrip()] + [clean(a) for a in change_ap]
62
newdata = ':'.join(alldata)
63
outfile.write(newdata+'\n')
64
65