-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPeriodPolynomialsHMF.m
More file actions
561 lines (466 loc) · 14.6 KB
/
PeriodPolynomialsHMF.m
File metadata and controls
561 lines (466 loc) · 14.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
//Base functions
function Lam(f,s: Precision:=8, Embedding:=1) //the LStar function would probably work just as well
F:=BaseField(Parent(f));
Nd:=Abs(Discriminant(F));
n:=Degree(F);
if Type(f) eq ModFrmHilDElt then L:=LSeriesHil(f: Precision:=Precision, Embedding:=Embedding);
else L:=LSeries(f: Precision:=Precision, Emb:=Embedding);
end if;
C<i>:=ComplexField(Precision);
return Nd^s*(Gamma(s)^n)*(2*Pi(C))^(-n*s)*Evaluate(L,s);
end function;
//Period polynomial functions
function rfx(f: Precision:=8, Embedding:=1)
F:=BaseField(Parent(f));
Nd:=Discriminant(F);
n:=Degree(F);
C<i> := ComplexField(Precision);
if Type(f) eq ModFrmHilDElt then
W:=Weight(f);
if #Set(W) ne 1 then return "Error: only supported for parallel weight"; end if;
k:=Random(Set(W));
else
W:=Weight(Parent(f));
if #Set(W) ne 1 then return "Error: only supported for parallel weight"; end if;
k:=Random(Set(W));
end if;
pol:=0;
PolRing<x>:=PolynomialRing(Rationals());
for m:=0 to k-2 do
pol+:= (-1)^m*i^(n*(k-m-1))*Binomial(k-2,m)*Lam(f,k-m-1: Precision:=Precision, Embedding:=Embedding)*(x)^m;
end for;
return pol;// 1/2*(Evaluate(pol, x)+Evaluate(pol, -x)), 1/2*(Evaluate(pol, x)-Evaluate(pol, -x));
end function;
function L2Dist(L1, L2)
sum:=0;
if #L1 ne #L2 then
print("The sequences don't have the same length");
return -1;
else
for x in [1..#L1] do
sum+:= (L1[x]-L2[x])^2;
end for;
return Real(Sqrt(sum));
end if;
end function;
function CompEmb(f: Bound:=1000)
K:=FieldOfFractions(Parent(Coefficients(f)[4]));
embs:=[**];
for i:=1 to #Conjugates(K!1) do
coeffs := [Conjugates(K!Coefficients(f)[x])[i]: x in [1..Bound]];
Append(~embs, coeffs);
end for;
return embs;
end function;
function CoeffsUpToPrec(f, n)
K:=FieldOfFractions(Parent(Coefficients(f)[4]));
ids:=IdealsUpTo(n, BaseField(Parent(f)));
dict:=Dictionary(f);
coe:=AssociativeArray();
coe[0*Integers(BaseField(Parent(f)))]:=Coefficients(f)[1];
for x in ids do
coe[x]:=Coefficients(f)[dict[x]];
end for;
g:=HMF(HMFSpace(BaseField(Parent(f)), n), Level(f), Weight(f), coe);
return Coefficients(g);
end function;
function CheckRoots(f: Prec:=8, Emb:=1)
C<i>:=ComplexField();
F:=BaseField(Parent(f));
n:=Degree(F);
D:=Abs(Discriminant(F));
print(D);
if Type(f) eq ModFrmHilDElt then
L:=LSeriesHil(f: Precision:=Prec, Embedding:=Emb);
W:=Weight(f);
if #Set(W) ne 1 then return "Error: only supported for parallel weight"; end if;
k:=Random(Set(W));
else
W:=Weight(Parent(f));
L:=LSeries(f: Precision:=Prec, Emb:=Emb);
if #Set(W) ne 1 then return "Error: only supported for parallel weight"; end if;
k:=Random(Set(W));
end if;
m:=(k-2)/2;
//Lis:=[[Evaluate(L,m+1), Evaluate(L, 2*m+1), Evaluate(L,m+1)/Evaluate(L, 2*m+1)]];
s1:=1/2*Gamma(m+1)^(n-2)/Gamma(2*m+1)^(n-1)*(2*Pi(C))^(m*n)/(D^m)*Evaluate(L,m+1)/Evaluate(L, 2*m+1);
for j in [1..m-1] do
//Append(~Lis, [Evaluate(L, 2*m+1-j), Evaluate(L, 2*m+1), Evaluate(L, 2*m+1-j)/Evaluate(L, 2*m+1)]);
s1+:=1/Factorial(j)*(2^n*Pi(C)^n/D)^j*(Gamma(2*m+1-j)/Gamma(2*m+1))^(n-1)*Evaluate(L, 2*m+1-j)/Evaluate(L, 2*m+1);
end for;
return Abs(s1);//Lis
end function;
// function CoeffsUpToPrec(f, n)
// F:=BaseField(Parent(f));
// K:=FieldOfFractions(Parent(Coefficients(f)[1*ZF][1*ZF]));
// ids:=IdealsUpTo(n, BaseField(Parent(f)));
// coe:=[];
// Append(~coe, Coefficients(f)[1*ZF][0*ZF]);
// for x in ids do
// Append(~coe, Coefficients(f)[1*ZF][x]);
// end for;
// return coe;
// end function;
//quadratic case
QuadDiscs:=[5,8,12,13,17,21,24,29,33];
Weights:=[6,5,4,5,4,4,4,4,4];
Precs:=[10,10,10,10,10,10,10,10,10];
//
//loop through spaces; add period polynomials to list and check that roots of the derivative inside the unit disk
PerPolys:=[**]; //Returns list of all period polynomials
RemainingPerPolys:=[**]; //Returns list of period polynomials that still remain to be checked
for j in [1..9] do
printf "Computing period polynomials for field with discriminant %o\n", QuadDiscs[j];
Append(~PerPolys, [**]);
Append(~RemainingPerPolys, [**]);
F:=QuadraticField(QuadDiscs[j]);
ZF:=Integers(F);
prec:=Precs[j];
MaxWeight:=Weights[j];
if j le 9 then ///Can modify if the calculation runs out of memory or it crashes (Windows bug)
for l in [1..MaxWeight] do
print(2*l);
Append(~PerPolys[j], [**]);
Append(~RemainingPerPolys[j], [**]);
if l eq 5 or l eq 6 then
H := HilbertCuspForms(F,1*ZF,[2*l, 2*l]);
S:= NewformDecomposition(NewSubspace(H));
for subspace in S do
g:=Eigenform(subspace);
K:=BaseField(g);
embs:=Conjugates(K!1);
for x in [1..#embs] do
pol:=rfx(g: Precision:=15, Embedding:=x);
Append(~PerPolys[j][l], pol);
s:=CheckRoots(g: Prec:=4, Emb:=x);
if Abs(s) gt 1 then
Append(~RemainingPerPolys[j][l], pol);
end if;
end for;
end for;
end if;
end for;
end if;
end for;
//Cubics
PolRing<x>:= PolynomialRing(Integers());
//First cubic field
//D=49;
t:=Cputime();
F := NumberField(x^3 - x^2 - 2*x + 1);
ZF:=Integers(F);
sizes:=[];
ids:=IdealsUpTo(150, F);
prec := 5000; //Can change precision as you will
M := HMFSpace(F, prec);
H := HeckeCharacterGroup(1*ZF);
Y2:=EisensteinSeries(M, 1*ZF, H!1, H!1, [2,2,2]); // 1 Form of weight 2
Y4:=EisensteinSeries(M, 1*ZF, H!1, H!1, [4,4,4]); // 1 form of weight 4
Y6:=EisensteinSeries(M, 1*ZF, H!1, H!1, [6,6,6]); // 1 form of weight 6
Y8:=EisensteinSeries(M, 1*ZF, H!1, H!1, [8,8,8]); // 1 form of weight 8
/////////Create all the possible weighted monomials from the ones created above
MonBas:=[**];
P<x2, x4, x6, x8> := PolynomialRing(RationalField(), [2,4,6,8]);
for i in [1..4] do
Append(~MonBas, []);
Mons:=MonomialsOfWeightedDegree(P, 2*i);
for j in Mons do
print(j);
factor:=Factorization(j);
mult:=1;
for l in factor do
if l[1] eq x2 then
mult:=mult*Y2^l[2];
end if;
if l[1] eq x4 then
mult:=mult*Y4^l[2];
end if;
if l[1] eq x6 then
mult:=mult*Y6^l[2];
end if;
if l[1] eq x8 then
mult:=mult*Y8^l[2];
end if;
end for;
Append(~MonBas[i], mult);
end for;
end for;
//////// The monomials obtained above give possible non-cusp forms. Refine it to a cusp form basis.
CuspBas:=[**];
for i:=1 to 4 do
print(2*i);
Append(~CuspBas, []);
for j:=1 to #MonBas[i] do
print([2*i,j]);
if i ge 2 then
for j:=1 to #MonBas[i]-1 do
//print([2*i,j]);
for l:=j+1 to #MonBas[i] do
if #CuspBas[i] eq 0 then
Append(~CuspBas[i], MonBas[i][j]-MonBas[i][l]);
print([2*i, j,l,Coefficients(MonBas[i][j]-MonBas[i][l])[4],1]);
else
//print(LinearDependence([CoeffsUpToPrec(x, 100): x in CuspBas[i]] cat [CoeffsUpToPrec(MonBas[i][j]-MonBas[i][l], 100)]));
if #LinearDependence([CoeffsUpToPrec(x, 50): x in CuspBas[i]] cat [CoeffsUpToPrec(MonBas[i][j]-MonBas[i][l], 50)]) eq 0 then
Append(~CuspBas[i], MonBas[i][j]-MonBas[i][l]);
print([2*i, j,l,Coefficients(MonBas[i][j]-MonBas[i][l])[4], 2]);
end if;
end if;
end for;
end for;
end if;
end for;
end for;
// Run Hecke Operators to obtain basis of eigenforms for each weight. For each of them, compute period polynomials
NewBas:=[**];
BasTrack:=[**];
PerPolys:=[**];
for i in [1..#CuspBas] do
if #CuspBas[i] ne 0 then
Mk:=HMFSpace(F, 2000);
Append(~NewBas,[**]);
Append(~BasTrack,[**]);
Append(~PerPolys,[**]);
tempor:=[];
CoeffLi:=[];
HeckeOpAct:=[CoeffsUpToPrec(HeckeOperator(p, ids[2]), 50): p in CuspBas[i]];
LinDeps:=[];
for a in CuspBas[i] do
Lin:=LinearDependence(HeckeOpAct cat [CoeffsUpToPrec(a, 50)]);
Append(~LinDeps, #Lin);
Append(~CoeffLi, [Lin[1][r]/Lin[1][#Lin[1]] : r in [1..#Lin[1]-1]]);
end for;
//print(LinDeps);
H:=Matrix(CoeffLi);
//print(H);
//Determinant(H);
newroots:=[r[1]: r in Factorization(CharacteristicPolynomial(H))];
K:=ext< Rationals() | newroots>;
HeckeMatrix:=Matrix(K, CoeffLi);
print([2*i, #LinDeps]);
Eig:=[t[1] : t in Eigenvalues(HeckeMatrix)];
print "Eigenvalues computed";
print(#Eig);
for e in Eig do
B:= Basis(Kernel(HeckeMatrix-e));
print "Basis of eigenvectors computed for eigenvalue";
print(e);
print(B);
for j in B do
eigvec:=HMFZero(Mk, 1*ZF, [2*i, 2*i, 2*i]);
for l in [1..NumberOfColumns(j)] do
eigvec+:=j[l]*CuspBas[i][l];
end for;
if Coefficients(eigvec)[2] ne 0 then
newf:=1/Coefficients(eigvec)[2]*eigvec;
else
newf:= eigvec;
end if;
if CoefficientField(eigvec) eq Rationals() then
print(1);
Append(~NewBas[i], newf);
Append(~BasTrack[i], newf);
Append(~sizes, CheckRoots(newf: Prec:=6, Emb:=1));
else
Append(~BasTrack[i], newf);
C:=CompEmb(newf: Bound:=30);
print(Degree(Parent(Coefficients(newf)[4])));
for x in [1..#C] do
count:=0;
for y in NewBas[i] do
if Type(y) eq SeqEnum then
if L2Dist(C[x],y) le 0.0001 then
count+:=1;
end if;
end if;
end for;
if count eq 0 then
Append(~NewBas[i], C[x]);
Append(~sizes, CheckRoots(newf: Prec:=6, Emb:=x));
end if;
end for;
end if;
end for;
end for;
else
Append(~NewBas, []);
Append(~BasTrack, []);
Append(~PerPolys, []);
end if;
end for;
Cputime(t);
//D=81;
//Second cubic field
t:=Cputime();
F := NumberField(x^3-3*x-1);
ZF:=Integers(F);
sizes:=[];
ids:=IdealsUpTo(150, F);
prec := 35000;
M := HMFSpace(F, prec);
H := HeckeCharacterGroup(1*ZF);
Y2:=EisensteinSeries(M, 1*ZF, H!1, H!1, [2,2,2]);
Y4:=EisensteinSeries(M, 1*ZF, H!1, H!1, [4,4,4]);
Y6:=EisensteinSeries(M, 1*ZF, H!1, H!1, [6,6,6]);
Y8:=EisensteinSeries(M, 1*ZF, H!1, H!1, [8,8,8]);
XX:=Y2^2;
prec2:=16464;
M2 := HMFSpace(F, prec2);
E2:=EisensteinSeries(M2, 1*ZF, H!1, H!1, [2,2,2]);
H42:=HeckeOperator(E2^2, ids[3]);
Y42:=1/Coefficients(H42)[1]*H42;
H62:=HeckeOperator(E2^3, ids[3]);
Y62:=1/Coefficients(H62)[1]*H62;
prec1:=2058;
M1 := HMFSpace(F, prec1);
Y21:=EisensteinSeries(M1, 1*ZF, H!1, H!1, [2,2,2]);
Y41:=EisensteinSeries(M1, 1*ZF, H!1, H!1, [4,4,4]);
Y61:=EisensteinSeries(M1, 1*ZF, H!1, H!1, [6,6,6]);
Y81:=EisensteinSeries(M1, 1*ZF, H!1, H!1, [8,8,8]);
H82:=HeckeOperator(XX^2, ids[5]);
Y82:=1/Coefficients(H82)[1]*H82;
H83:=HeckeOperator(XX^2, ids[6]);
Y83:=1/Coefficients(H83)[1]*H83;
///Basis of monomials
MonBas:=[**];
P<x21, x41, x42, x61, x62, x81, x82, x83> := PolynomialRing(RationalField(), [2,4,4,6,6,8,8,8]);
for i in [1..4] do
Append(~MonBas, []);
Mons:=MonomialsOfWeightedDegree(P, 2*i);
for j in Mons do
print(j);
factor:=Factorization(j);
mult:=1;
for l in factor do
if l[1] eq x21 then
mult:=mult*Y21^l[2];
end if;
if l[1] eq x41 then
mult:=mult*Y41^l[2];
end if;
if l[1] eq x42 then
mult:=mult*Y42^l[2];
end if;
if l[1] eq x61 then
mult:=mult*Y61^l[2];
end if;
if l[1] eq x62 then
mult:=mult*Y62^l[2];
end if;
if l[1] eq x81 then
mult:=mult*Y81^l[2];
end if;
if l[1] eq x82 then
mult:=mult*Y82^l[2];
end if;
if l[1] eq x83 then
mult:=mult*Y83^l[2];
end if;
end for;
Append(~MonBas[i], mult);
end for;
end for;
//Refine to sup basis
CuspBas:=[**];
for i:=1 to 4 do
print(2*i);
Append(~CuspBas, []);
for j:=1 to #MonBas[i] do
print([2*i,j]);
if i ge 2 then
for j:=1 to #MonBas[i]-1 do
//print([2*i,j]);
for l:=j+1 to #MonBas[i] do
if #CuspBas[i] eq 0 then
Append(~CuspBas[i], MonBas[i][j]-MonBas[i][l]);
print([2*i, j,l,Coefficients(MonBas[i][j]-MonBas[i][l])[4],1]);
else
//print(LinearDependence([CoeffsUpToPrec(x, 100): x in CuspBas[i]] cat [CoeffsUpToPrec(MonBas[i][j]-MonBas[i][l], 100)]));
if #LinearDependence([CoeffsUpToPrec(x, 50): x in CuspBas[i]] cat [CoeffsUpToPrec(MonBas[i][j]-MonBas[i][l], 50)]) eq 0 then
Append(~CuspBas[i], MonBas[i][j]-MonBas[i][l]);
print([2*i, j,l,Coefficients(MonBas[i][j]-MonBas[i][l])[4], 2]);
end if;
end if;
end for;
end for;
end if;
end for;
end for;
//Forther refine to eigenform basis. Compute period polynomials.
NewBas:=[**];
BasTrack:=[**];
PerPolys:=[**];
for i in [1..#CuspBas] do
if #CuspBas[i] ne 0 then
Mk:=HMFSpace(F, 2000);
Append(~NewBas,[**]);
Append(~BasTrack,[**]);
Append(~PerPolys,[**]);
tempor:=[];
CoeffLi:=[];
HeckeOpAct:=[CoeffsUpToPrec(HeckeOperator(p, ids[5]), 50): p in CuspBas[i]];
LinDeps:=[];
for a in CuspBas[i] do
Lin:=LinearDependence(HeckeOpAct cat [CoeffsUpToPrec(a, 50)]);
Append(~LinDeps, #Lin);
Append(~CoeffLi, [Lin[1][r]/Lin[1][#Lin[1]] : r in [1..#Lin[1]-1]]);
end for;
//print(LinDeps);
H:=Matrix(CoeffLi);
//print(H);
//Determinant(H);
newroots:=[r[1]: r in Factorization(CharacteristicPolynomial(H))];
K:=ext< Rationals() | newroots>;
HeckeMatrix:=Matrix(K, CoeffLi);
print([2*i, #LinDeps]);
Eig:=[t[1] : t in Eigenvalues(HeckeMatrix)];
print "Eigenvalues computed";
print(#Eig);
for e in Eig do
B:= Basis(Kernel(HeckeMatrix-e));
print "Basis of eigenvectors computed for eigenvalue";
print(e);
print(B);
for j in B do
eigvec:=HMFZero(Mk, 1*ZF, [2*i, 2*i, 2*i]);
for l in [1..NumberOfColumns(j)] do
eigvec+:=j[l]*CuspBas[i][l];
end for;
if Coefficients(eigvec)[2] ne 0 then
newf:=1/Coefficients(eigvec)[2]*eigvec;
else
newf:= eigvec;
end if;
if CoefficientField(eigvec) eq Rationals() then
print(1);
Append(~NewBas[i], newf);
Append(~BasTrack[i], newf);
Append(~sizes, CheckRoots(newf: Prec:=6, Emb:=1));
else
Append(~BasTrack[i], newf);
C:=CompEmb(newf: Bound:=30);
print(Degree(Parent(Coefficients(newf)[4])));
for x in [1..#C] do
count:=0;
for y in NewBas[i] do
if Type(y) eq SeqEnum then
if L2Dist(C[x],y) le 0.0001 then
count+:=1;
end if;
end if;
end for;
if count eq 0 then
Append(~NewBas[i], C[x]);
Append(~sizes, CheckRoots(newf: Prec:=6, Emb:=x));
end if;
end for;
end if;
end for;
end for;
else
Append(~NewBas, []);
Append(~BasTrack, []);
Append(~PerPolys, []);
end if;
end for;
Cputime(t);