Open in CoCalc
1##################################################
2## Dirichlet Characters
3##################################################
4
5> G<a,b,c> := DirichletGroup(8*13, CyclotomicField(12));
6> G;
7Group of Dirichlet characters of modulus 104 over Cyclotomic
8Field of order 12 and degree 4
9> // WARNING: The default ring is Q, not Q(zeta_n).
10> DirichletGroup(8*13);
11Group 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);
23zeta_12^2 - 1
24
25> G<a> := DirichletGroup(5,CyclotomicField(4));
26> H<b> := DirichletGroup(7,RationalField());
27> Parent(a*b);
28Group of Dirichlet characters of modulus 35 over Cyclotomic Field
29of 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);
34Group of Dirichlet characters of modulus 70 over Cyclotomic Field
35of order 4 and degree 2
36> Conductor(d);
3735
38> Modulus(AssociatedPrimitiveCharacter(d));
3935
40
41> G := DirichletGroup(35,CyclotomicField(28));  G;
42Group of Dirichlet characters of modulus 35 over Cyclotomic Field
43of order 28 and degree 12
44> e := G!c;
45> Parent(e);
46Group of Dirichlet characters of modulus 35 over Cyclotomic Field
47of order 28 and degree 12
48> c(3);
49zeta_4
50> e(3);
51zeta_28^7
52> Parent(MinimalBaseRingCharacter(e));
53Group of Dirichlet characters of modulus 35 over Cyclotomic Field
54of 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);
654
66> M := ModularSymbols(eps, 5);   // eps determines N  !!
67> M;
68Full modular symbols space of level 13, weight 5, character eps,
69and 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;
76X^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
86Time: 1.440
87Full modular symbols space for Gamma_0(2004) of weight 2 and
88dimension 673 over Rational Field
89> GetMemoryUsage();
91> time M := ModularSymbols(10000);
92Current total memory usage: 419.4MB, failed memory request: 206.0MB
93System error: Out of memory.
94> time M := ModularSymbols(10007);  M;   // prime level, so easier
95Time: 6.590
96Full modular symbols space for Gamma_0(10007) of weight 2 and
97dimension 1669 over Rational Field
98> time t2 := HeckeOperator(M,2);
99Time: 3.270
100
101> G<e> := DirichletGroup(389,CyclotomicField(97));
102> Order(e);
103194
104> time M := ModularSymbols(e^2,2);
105Time: 0.320
106> M;
107Full modular symbols space of level 389, weight 2, character e^2,
108and 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
111Time: 3.260
112> M;
113Full modular symbols space of level 37, weight 7, character e,
114and 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);
1235
124> Order(c);
1254
126> time M := ModularSymbols(c,3);
127Time: 5.070
128> M;
129Full modular symbols space of level 2000, weight 3, character c,
130and 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);
153199
154> #HeilbronnMerel(10007);   // takes a while
155337977
156> #HeilbronnCremona(10007);   // in some cases these can be used...
15767698
158
159> G<eps> := DirichletGroup(13, CyclotomicField(4));
160> M := ModularSymbols(eps, 5);
161> T2 := HeckeOperator(M,2);
162> Nrows(T2);
1638
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;
183Modular symbols space of level 13, weight 5, character eps, and
184dimension 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;
190Full modular symbols space for Gamma_0(33) of weight 2 and
191dimension 9 over Rational Field
192
193> NewSubspace(M);
194Modular symbols space for Gamma_0(33) of weight 2 and dimension 3
195over Rational Field
196
197> Complement(NewSubspace(M));
198Modular symbols space for Gamma_0(33) of weight 2 and dimension 6
199over 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);
217Time: 0.270
218> time S := CuspidalSubspace(M);
219Time: 0.190
220> time D := NewformDecomposition(S);
221Time: 10.990
222> #D;
22334
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 239analytic.m cusps.m inner_twists.m operators.m 240arith.m decomp.m intersection_pairing.m period.m 241boundary.m derivative.m linalg.m qexpansion.m 242calc.m dims.m maps.m representation.m 243charpolyhecke.m dirichlet.m mestre.m subspace.m 244compgrp.m eisenstein.m modsym.m tests.m 245core.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; 256Modular symbols space of level 13, weight 2, character eps, and 257dimension 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; 281Modular symbols space for Gamma_0(389) of weight 2 and dimension 2823 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 288q + a*q^2 - a*q^3 + (a^2 - 2)*q^4 + (-a^2 + 1)*q^5 + O(q^6) 289> BaseRing(Modulus(Parent($1)));
290Univariate Quotient Polynomial Algebra in a over Rational Field
291with modulus a^3 - 4*a - 2
292
293> M := ModularForms(33,2); M;
294Space of modular forms on Gamma_0(33) of weight 2 and
295dimension 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[* [*
314q - 24*q^2 + 252*q^3 - 1472*q^4 + 4830*q^5 - 6048*q^6 - 16744*q^7
315+ O(q^8)
316*], [*
317691/65520 + q + 2049*q^2 + 177148*q^3 + 4196353*q^4 +
31848828126*q^5 + 362976252*q^6 + 1977326744*q^7 + O(q^8)
319*] *]
320
321> M := ModularForms(23,2);
322> S := CuspidalSubspace(M);
323> S;
324Space of modular forms on Gamma_0(23) of weight 2 and dimension 2
325over Integer Ring.
326> Newforms(S);
327[* [*
328q + 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),
330q + 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]); 334Space of modular forms on Gamma_0(23) of weight 2 and dimension 2 335over Number Field with defining polynomial x^2 + x - 1 over the 336Rational Field. 337 338> f := Newforms(S)[1][1]; g := Newforms(S)[1][2]; 339> f + g; 340>> f + g; 341 ^ 342Runtime error in '+': Arguments 1 and 2 have incompatible 343coefficient rings. 344 345> ComplexEmbeddings(f); 346[* [* q - 1.618033988749894848204586834365638117720*q^2 + ... 347 q + 0.618033988749894848204586834365638117720*q^2 - ... *] *] 348>$1[1][1] + $1[1][2]; 3492*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]; 357O(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); 367ModFrmElt 368> f11; 369q + 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); 371q + 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); 377Integer Ring 378> S := CuspidalSubspace(M); 379> S; 380Space of modular forms on Gamma_1(13) with character all 381conjugates 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
397abelian_varieties.m  eisenstein.m      modular_symbols.m  relations.m
398arithmetic.m         elliptic_curve.m  newforms.m         subspaces.m
399bases.m              hecke_algebras.m  operators.m        tests.m
401congruences.m        l_series.m        predicates.m       weight1table.m
402creation.m           level1.m          q-expansions.m
403degeneracy_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> ]
4220.75931650029224679065762600319 2
423> E := EllipticCurve(A);  AnalyticRank(E);   // Watkin's new code
4242 0.7593000000
4261.487184621319346836916654326667 1
427
428> TamagawaNumber(D[1],389);          // c_{389} = 1 for elliptic curve
4291
430> TamagawaNumber(D[5],389);          // c_{389} = 97 for 20-dim quotient
43197
432> TorsionBound(D[5],13);             // multiple of order of torsion
43397
434> #RationalCuspidalSubgroup(D[5]);   // divisor of order of torsion
43597
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;
447Modular abelian variety JZero(389) of dimension 32 and level 389
448over 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;
457L(389A,s): L-series of Modular abelian variety 389A of dimension
4581, level 389 and conductor 389 over Q
459> LeadingCoefficient(L,1,200);    // slow, since doesn't use Watkins (but *general*)
4600.75931650029224679065762600319 2
461> TamagawaNumber(D[1],389);
4621 1 true
463
464> TamagawaNumber(D[5],389);
46597 97 true
466> TorsionLowerBound(D[5]);
46797
468> TorsionMultiple(D[5]);
46997
470> G := RationalCuspidalSubgroup(D[5]); G;
471Finitely generated subgroup ... with invariants [ 97 ]
472> B := D[5]/G; B;     // quotients by anything are defined.
473Modular abelian variety of dimension 20 and level 389 over Q
474> H := D[1] meet D[5];  H; // takes a while
475Finitely 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
490arithabvar.m   elt.m       homspace.m      misc.m       periods.m
491compgrp.m      endo_alg.m  inner_twists.m  modabvar.m   rings.m
492complements.m  fields.m    linalg.m        morphisms.m  subgrp.m
493decomp.m       heegner.m   lser.m          new_old.m    test.m
494ellcrv.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
502def examples():
503    """
504
505    """
506
507
508if __name__ ==  '__main__':
509    import doctest, sys
510    doctest.testmod(sys.modules[__name__])
511