Open in CoCalc
1
##################################################
2
## Dirichlet Characters
3
##################################################
4
5
> G<a,b,c> := DirichletGroup(8*13, CyclotomicField(12));
6
> G;
7
Group of Dirichlet characters of modulus 104 over Cyclotomic
8
Field of order 12 and degree 4
9
> // WARNING: The default ring is Q, not Q(zeta_n).
10
> DirichletGroup(8*13);
11
Group of Dirichlet characters of modulus 104 over Rational Field
12
13
> G<a,b,c> := DirichletGroup(8*13, CyclotomicField(12));
14
> [Order(a), Order(b), Order(c)];
15
[ 2, 2, 12 ]
16
> [Conductor(a), Conductor(b), Conductor(c)];
17
[ 4, 8, 13 ]
18
> a(3);
19
-1
20
> b(3);
21
-1
22
> c(3);
23
zeta_12^2 - 1
24
25
> G<a> := DirichletGroup(5,CyclotomicField(4));
26
> H<b> := DirichletGroup(7,RationalField());
27
> Parent(a*b);
28
Group of Dirichlet characters of modulus 35 over Cyclotomic Field
29
of order 4 and degree 2
30
31
> c := a*b;
32
> d := Extend(c,70); // natural extension to character of modulus 70
33
> Parent(d);
34
Group of Dirichlet characters of modulus 70 over Cyclotomic Field
35
of order 4 and degree 2
36
> Conductor(d);
37
35
38
> Modulus(AssociatedPrimitiveCharacter(d));
39
35
40
41
> G := DirichletGroup(35,CyclotomicField(28)); G;
42
Group of Dirichlet characters of modulus 35 over Cyclotomic Field
43
of order 28 and degree 12
44
> e := G!c;
45
> Parent(e);
46
Group of Dirichlet characters of modulus 35 over Cyclotomic Field
47
of order 28 and degree 12
48
> c(3);
49
zeta_4
50
> e(3);
51
zeta_28^7
52
> Parent(MinimalBaseRingCharacter(e));
53
Group of Dirichlet characters of modulus 35 over Cyclotomic Field
54
of order 4 and degree 2
55
56
57
##################################################
58
## What Are Modular Symbols?
59
##################################################
60
61
> G<eps> := DirichletGroup(13, CyclotomicField(4));
62
> eps(-1);
63
-1
64
> Order(eps);
65
4
66
> M := ModularSymbols(eps, 5); // eps determines N !!
67
> M;
68
Full modular symbols space of level 13, weight 5, character eps,
69
and dimension 8 over Cyclotomic Field of order 4 and degree 2
70
71
> [ManinSymbol(x)[1] : x in Basis(M)];
72
[ <X^3, (0 1)>, <X^3, (1 11)>, <X^3, (1 5)>, <X^3, (1 3)>,
73
<X^3, (1 4)>, <X^3, (1 6)>, <X^3, (1 12)>, <X^3, (1 0)>]
74
75
> M.1;
76
X^3*{0, oo}
77
> M.2;
78
(1331*X^3 + 363*X^2*Y + 33*X*Y^2 + Y^3)*{-1/11, 0}
79
80
81
##################################################
82
## Efficiency of Computation of Presentation
83
##################################################
84
85
> time M := ModularSymbols(2004); M; // on my laptop
86
Time: 1.440
87
Full modular symbols space for Gamma_0(2004) of weight 2 and
88
dimension 673 over Rational Field
89
> GetMemoryUsage();
90
9306624 // about 9.3MB
91
> time M := ModularSymbols(10000);
92
Current total memory usage: 419.4MB, failed memory request: 206.0MB
93
System error: Out of memory.
94
> time M := ModularSymbols(10007); M; // prime level, so easier
95
Time: 6.590
96
Full modular symbols space for Gamma_0(10007) of weight 2 and
97
dimension 1669 over Rational Field
98
> time t2 := HeckeOperator(M,2);
99
Time: 3.270
100
101
> G<e> := DirichletGroup(389,CyclotomicField(97));
102
> Order(e);
103
194
104
> time M := ModularSymbols(e^2,2);
105
Time: 0.320
106
> M;
107
Full modular symbols space of level 389, weight 2, character e^2,
108
and dimension 64 over Cyclotomic Field of order 97 and degree 96
109
> G<e> := DirichletGroup(37,CyclotomicField(36));
110
> time M := ModularSymbols(e,7); // weight 7
111
Time: 3.260
112
> M;
113
Full modular symbols space of level 37, weight 7, character e,
114
and dimension 38 over Cyclotomic Field of order 36 and degree 12
115
116
117
##################################################
118
## Efficiency Trick: Work Mod~$p$
119
##################################################
120
121
> G<a,b,c> := DirichletGroup(2000,GF(5));
122
> Conductor(c);
123
5
124
> Order(c);
125
4
126
> time M := ModularSymbols(c,3);
127
Time: 5.070
128
> M;
129
Full modular symbols space of level 2000, weight 3, character c,
130
and dimension 1200 over Finite field of size 5
131
132
> function f(N,k,p)
133
return Dimension(ModularSymbols(N,k,GF(p))) -
134
Dimension(ModularSymbols(N,k));
135
end function;
136
> [N : N in [2..100] | f(N,2,2) gt 0];
137
[ 5, 10, 13, 17, 25, 26, 29, 34, 37, 41, 50, 53, 58, 61, 65, 73,
138
74, 82, 85, 89, 97 ]
139
140
141
##################################################
142
## Hecke Operators on Modular Symbols
143
##################################################
144
145
> HeilbronnMerel(2);
146
[
147
[ 1, 0, 0, 2 ],
148
[ 1, 0, 1, 2 ],
149
[ 2, 0, 0, 1 ],
150
[ 2, 1, 0, 1 ]
151
]
152
> #HeilbronnMerel(29);
153
199
154
> #HeilbronnMerel(10007); // takes a while
155
337977
156
> #HeilbronnCremona(10007); // in some cases these can be used...
157
67698
158
159
> G<eps> := DirichletGroup(13, CyclotomicField(4));
160
> M := ModularSymbols(eps, 5);
161
> T2 := HeckeOperator(M,2);
162
> Nrows(T2);
163
8
164
> T2[1];
165
(zeta_4 + 16 -3/4 1/4 3/4 -3/4 0 2 -3/2)
166
> F := CharacteristicPolynomial(T2);
167
> R<X> := Parent(F);
168
> Factorization(F);
169
[ <X - 16*zeta_4 - 1, 1>,
170
<X - zeta_4 - 16, 1>,
171
<X^3 + (zeta_4 + 1)*X^2 - 23*zeta_4*X - 29*zeta_4 + 29, 2>]
172
173
174
##################################################
175
## Subspaces of Modular Symbols
176
##################################################
177
178
> G<eps> := DirichletGroup(13, CyclotomicField(4));
179
180
> M := ModularSymbols(eps, 5);
181
182
> S := CuspidalSubspace(M); S;
183
Modular symbols space of level 13, weight 5, character eps, and
184
dimension 6 over Cyclotomic Field of order 4 and degree 2
185
186
> Factorization(CharacteristicPolynomial(HeckeOperator(S,2)));
187
[ <X^3 + (zeta_4 + 1)*X^2 - 23*zeta_4*X - 29*zeta_4 + 29, 2> ]
188
189
> M := ModularSymbols(33); M;
190
Full modular symbols space for Gamma_0(33) of weight 2 and
191
dimension 9 over Rational Field
192
193
> NewSubspace(M);
194
Modular symbols space for Gamma_0(33) of weight 2 and dimension 3
195
over Rational Field
196
197
> Complement(NewSubspace(M));
198
Modular symbols space for Gamma_0(33) of weight 2 and dimension 6
199
over Rational Field
200
201
202
##################################################
203
## Decomposition of Modular Symbols Spaces
204
##################################################
205
206
> S := CuspidalSubspace(ModularSymbols(33,2));
207
208
> NewformDecomposition(S);
209
[
210
Modular symbols space for Gamma_0(33) of weight 2 and
211
dimension 2 over Rational Field, // new
212
Modular symbols space for Gamma_0(33) of weight 2 and
213
dimension 4 over Rational Field // old
214
]
215
216
> time M := ModularSymbols(700,2,+1);
217
Time: 0.270
218
> time S := CuspidalSubspace(M);
219
Time: 0.190
220
> time D := NewformDecomposition(S);
221
Time: 10.990
222
> #D;
223
34
224
> D;
225
[
226
Modular symbols space for Gamma_0(700) of weight 2 and
227
dimension 1 over Rational Field,
228
Modular symbols space for Gamma_0(700) of weight 2 and
229
dimension 1 over Rational Field,
230
...
231
Modular symbols space for Gamma_0(700) of weight 2 and
232
dimension 6 over Rational Field
233
]
234
235
% > HeckeBound(M);
236
% 8
237
238
$ ls magma/package/Geometry/ModSym/*.m
239
analytic.m cusps.m inner_twists.m operators.m
240
arith.m decomp.m intersection_pairing.m period.m
241
boundary.m derivative.m linalg.m qexpansion.m
242
calc.m dims.m maps.m representation.m
243
charpolyhecke.m dirichlet.m mestre.m subspace.m
244
compgrp.m eisenstein.m modsym.m tests.m
245
core.m elliptic.m multichar.m verbose.m
246
247
248
##################################################
249
## Computing Modular Forms Using MAGMA
250
##################################################
251
252
> G<eps> := DirichletGroup(13,CyclotomicField(6));
253
> M := ModularSymbols(eps,2, +1);
254
> S := CuspidalSubspace(M);
255
> S;
256
Modular symbols space of level 13, weight 2, character eps, and
257
dimension 1 over Cyclotomic Field of order 6 and degree 2
258
> qExpansionBasis(S,4);
259
[ q + (-zeta_6 - 1)*q^2 + (2*zeta_6 - 2)*q^3 + O(q^4) ]
260
261
> M := ModularSymbols(33,2);
262
> S := CuspidalSubspace(M);
263
264
> qExpansionBasis(S,10);
265
[ q - q^5 - 2*q^6 + 2*q^7 - 2*q^8 - q^9 + O(q^10),
266
q^2 - q^4 - q^5 - q^6 + 2*q^7 - q^8 + q^9 + O(q^10),
267
q^3 - 2*q^6 - q^9 + O(q^10) ]
268
269
> qExpansionBasis(OldSubspace(S),10);
270
[ q - 2*q^2 + 2*q^4 + q^5 - 2*q^7 - 3*q^9 + O(q^10),
271
q^3 - 2*q^6 - q^9 + O(q^10) ]
272
273
> qExpansionBasis(NewSubspace(S),10);
274
[ q + q^2 - q^3 - q^4 - 2*q^5 - q^6 + 4*q^7 - 3*q^8 + q^9 +
275
O(q^10) ]
276
277
> M := ModularSymbols(389,2, 1);
278
> S := CuspidalSubspace(M);
279
> D := Decomposition(S,2);
280
> V := D[3]; V;
281
Modular symbols space for Gamma_0(389) of weight 2 and dimension
282
3 over Rational Field
283
> qExpansionBasis(V,10);
284
[ q - q^5 - 2*q^6 - q^7 + 2*q^8 - q^9 + O(q^10),
285
q^2 - q^3 + O(q^10),
286
q^4 - q^5 - q^6 + q^9 + O(q^10) ]
287
> qEigenform(V,6); // eigenform in span of above q-expansions
288
q + a*q^2 - a*q^3 + (a^2 - 2)*q^4 + (-a^2 + 1)*q^5 + O(q^6)
289
> BaseRing(Modulus(Parent($1)));
290
Univariate Quotient Polynomial Algebra in a over Rational Field
291
with modulus a^3 - 4*a - 2
292
293
> M := ModularForms(33,2); M;
294
Space of modular forms on Gamma_0(33) of weight 2 and
295
dimension 6 over Integer Ring.
296
> Basis(M);
297
[ 1 + O(q^8),
298
q - q^5 + 2*q^7 + O(q^8),
299
q^2 + 2*q^7 + O(q^8),
300
q^3 + O(q^8),
301
q^4 + q^5 + O(q^8),
302
q^6 + O(q^8) ]
303
> SetPrecision(M,15);
304
> Basis(M);
305
[ 1 + 12*q^11 + O(q^15),
306
q - q^5 + 2*q^7 - 2*q^8 + q^9 - 2*q^10 - q^11 + 4*q^12 + 4*q^14 + O(q^15),
307
q^2 + 2*q^7 + q^8 + q^9 + 2*q^10 + q^11 + q^12 + 2*q^14 + O(q^15),
308
q^3 + q^9 - 2*q^11 + 4*q^12 + O(q^15),
309
... ]
310
311
> M := ModularForms(1,12);
312
> Newforms(M);
313
[* [*
314
q - 24*q^2 + 252*q^3 - 1472*q^4 + 4830*q^5 - 6048*q^6 - 16744*q^7
315
+ O(q^8)
316
*], [*
317
691/65520 + q + 2049*q^2 + 177148*q^3 + 4196353*q^4 +
318
48828126*q^5 + 362976252*q^6 + 1977326744*q^7 + O(q^8)
319
*] *]
320
321
> M := ModularForms(23,2);
322
> S := CuspidalSubspace(M);
323
> S;
324
Space of modular forms on Gamma_0(23) of weight 2 and dimension 2
325
over Integer Ring.
326
> Newforms(S);
327
[* [*
328
q + a*q^2 + (-2*a - 1)*q^3 + (-a - 1)*q^4 + 2*a*q^5 + (a - 2)*q^6
329
+ (2*a + 2)*q^7 + O(q^8),
330
q + b*q^2 + (-2*b - 1)*q^3 + (-b - 1)*q^4 + 2*b*q^5 + (b - 2)*q^6
331
+ (2*b + 2)*q^7 + O(q^8)
332
*] *]
333
> Parent($1[1][1]);
334
Space of modular forms on Gamma_0(23) of weight 2 and dimension 2
335
over Number Field with defining polynomial x^2 + x - 1 over the
336
Rational Field.
337
338
> f := Newforms(S)[1][1]; g := Newforms(S)[1][2];
339
> f + g;
340
>> f + g;
341
^
342
Runtime error in '+': Arguments 1 and 2 have incompatible
343
coefficient rings.
344
345
> ComplexEmbeddings(f);
346
[* [* q - 1.618033988749894848204586834365638117720*q^2 + ...
347
q + 0.618033988749894848204586834365638117720*q^2 - ... *] *]
348
> $1[1][1] + $1[1][2];
349
2*q - q^2 - q^4 - 2.0...*q^5 -
350
> pAdicEmbeddings(f,2);
351
[* [* O(2^20) + (1 + O(2^20))*q + ((1 + O(2^20))*a + O(2^20))*q^2 + ...
352
O(2^20) + (1 + O(2^20))*q + ((1 + O(2^20))*b + O(2^20))*q^2 + ... *] *]
353
> pAdicEmbeddings(f,11);
354
[* [* O(11^20) + (1 + O(11^20))*q + (273946294811098331671 + ...
355
*], [* O(11^20) + (1 + O(11^20))*q - (273946294811098331672 + ... *] *]
356
> $1[1][1] + $1[2][1];
357
O(11^20) + (2 + O(11^20))*q - (1 + O(11^20))*q^2 + ...
358
359
> Reductions(f,2);
360
[* [* q + $.1*q^2 + q^3 + $.1^2*q^4 + $.1*q^6 + O(q^8),
361
q + $.1^2*q^2 + q^3 + $.1*q^4 + $.1^2*q^6 + O(q^8) *] *]
362
> Reductions(f,11);
363
[* [* q + 7*q^2 + 7*q^3 + 3*q^4 + 3*q^5 + 5*q^6 + 5*q^7 + O(q^8) *],
364
[* q + 3*q^2 + 4*q^3 + 7*q^4 + 6*q^5 + q^6 + 8*q^7 + O(q^8) *] *]
365
> f11 := Reductions(f,11)[1][1];
366
> Type(f11);
367
ModFrmElt
368
> f11;
369
q + 7*q^2 + 7*q^3 + 3*q^4 + 3*q^5 + 5*q^6 + 5*q^7 + O(q^8)
370
> PowerSeries(f11,15);
371
q + 7*q^2 + 7*q^3 + 3*q^4 + 3*q^5 + 5*q^6 + 5*q^7 + 7*q^8 + 2*q^9
372
+ 10*q^10 + 4*q^11 + 10*q^12 + 3*q^13 + 2*q^14 + O(q^15)
373
374
> G<eps> := DirichletGroup(13, CyclotomicField(6));
375
> M := ModularForms(eps);
376
> BaseRing(M);
377
Integer Ring
378
> S := CuspidalSubspace(M);
379
> S;
380
Space of modular forms on Gamma_1(13) with character all
381
conjugates of [eps], weight 2, and dimension 2 over Integer Ring.
382
> Basis(S);
383
[
384
q - 4*q^3 - q^4 + 3*q^5 + 6*q^6 + O(q^8),
385
q^2 - 2*q^3 - q^4 + 2*q^5 + 2*q^6 + O(q^8)
386
]
387
388
%> Newforms(S);
389
% [* [*
390
% q + (-a - 1)*q^2 + (2*a - 2)*q^3 + a*q^4 + (-2*a + 1)*q^5 + (-2*a
391
% + 4)*q^6 + O(q^8),
392
% q + (-b - 1)*q^2 + (2*b - 2)*q^3 + b*q^4 + (-2*b + 1)*q^5 + (-2*b
393
% + 4)*q^6 + O(q^8)
394
% *] *]
395
396
$ ls magma/package/Geometry/ModFrm/*.m
397
abelian_varieties.m eisenstein.m modular_symbols.m relations.m
398
arithmetic.m elliptic_curve.m newforms.m subspaces.m
399
bases.m hecke_algebras.m operators.m tests.m
400
categories.m input_output.m p-adic.m verbose.m
401
congruences.m l_series.m predicates.m weight1table.m
402
creation.m level1.m q-expansions.m
403
degeneracy_maps.m misc.m qexp_mappings.m
404
405
406
##################################################
407
## Modular Abelian Varieties and Modular Symbols
408
##################################################
409
410
> M := ModularSymbols(389);
411
> S := CuspidalSubspace(M);
412
> D := NewformDecomposition(S);
413
> [Dimension(A)/2 : A in D]; // dimensions of abvars A_f
414
[ 1, 2, 3, 6, 20 ]
415
> [ModularDegree(D[i]) : i in [1..#D]];
416
[ 40, 144, 992, 17856, 20480 ]
417
> [LRatio(D[i],1) : i in [1..#D]]; // BSD Ratios L(A_f,1)/Omega
418
[ 0, 0, 0, 0, 51200/97 ]
419
> Factorization(51200);
420
[ <2, 11>, <5, 2> ]
421
> LSeriesLeadingCoefficient(D[1],1,100);
422
0.75931650029224679065762600319 2
423
> E := EllipticCurve(A); AnalyticRank(E); // Watkin's new code
424
2 0.7593000000
425
> LSeriesLeadingCoefficient(D[2],1,100);
426
1.487184621319346836916654326667 1
427
428
> TamagawaNumber(D[1],389); // c_{389} = 1 for elliptic curve
429
1
430
> TamagawaNumber(D[5],389); // c_{389} = 97 for 20-dim quotient
431
97
432
> TorsionBound(D[5],13); // multiple of order of torsion
433
97
434
> #RationalCuspidalSubgroup(D[5]); // divisor of order of torsion
435
97
436
> Invariants(IntersectionGroup(D[1],D[2]));
437
[ 2, 2 ]
438
> Invariants(IntersectionGroup(D[1],D[5]));
439
[ 20, 20 ]
440
441
442
##################################################
443
## The Modular Abelian Varieties Package
444
##################################################
445
446
> J := JZero(389); J;
447
Modular abelian variety JZero(389) of dimension 32 and level 389
448
over Q
449
> D := Decomposition(J);
450
> [Dimension(A) : A in D];
451
[ 1, 2, 3, 6, 20 ]
452
> [ModularDegree(A) : A in D];
453
[ 40, 144, 992, 17856, 20480 ]
454
> [LRatio(A,1) : A in D];
455
[ 0, 0, 0, 0, 51200/97 ]
456
> L := LSeries(D[1]); L;
457
L(389A,s): L-series of Modular abelian variety 389A of dimension
458
1, level 389 and conductor 389 over Q
459
> LeadingCoefficient(L,1,200); // slow, since doesn't use Watkins (but *general*)
460
0.75931650029224679065762600319 2
461
> TamagawaNumber(D[1],389);
462
1 1 true
463
464
> TamagawaNumber(D[5],389);
465
97 97 true
466
> TorsionLowerBound(D[5]);
467
97
468
> TorsionMultiple(D[5]);
469
97
470
> G := RationalCuspidalSubgroup(D[5]); G;
471
Finitely generated subgroup ... with invariants [ 97 ]
472
> B := D[5]/G; B; // quotients by anything are defined.
473
Modular abelian variety of dimension 20 and level 389 over Q
474
> H := D[1] meet D[5]; H; // takes a while
475
Finitely generated subgroup ... with invariants [ 20, 20 ]
476
477
> J := JZero(22);
478
> [Matrix(phi) : phi in Basis(End(J))];
479
...
480
481
> function f(N)
482
J := JZero(N);
483
T := HeckeAlgebra(J);
484
return Index(Saturation(T),T);
485
end function;
486
> for N in [1..120] do print N, f(N); end for;
487
...
488
489
$ ls magma/package/Geometry/ModAbVar/*.m
490
arithabvar.m elt.m homspace.m misc.m periods.m
491
compgrp.m endo_alg.m inner_twists.m modabvar.m rings.m
492
complements.m fields.m linalg.m morphisms.m subgrp.m
493
decomp.m heegner.m lser.m new_old.m test.m
494
ellcrv.m homology.m map.m operators.m torsion.m
495
496
497
498
##########################################################
499
# The following are all the examples not in functions. #
500
##########################################################
501
502
def examples():
503
"""
504
505
"""
506
507
508
if __name__ == '__main__':
509
import doctest, sys
510
doctest.testmod(sys.modules[__name__])
511