Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/modular/modform/ambient_eps.py
4057 views
1
# -*- coding: utf-8 -*-
2
r"""
3
Modular Forms with Character
4
5
EXAMPLES::
6
7
sage: eps = DirichletGroup(13).0
8
sage: M = ModularForms(eps^2, 2); M
9
Modular Forms space of dimension 3, character [zeta6] and weight 2 over Cyclotomic Field of order 6 and degree 2
10
11
sage: S = M.cuspidal_submodule(); S
12
Cuspidal subspace of dimension 1 of Modular Forms space of dimension 3, character [zeta6] and weight 2 over Cyclotomic Field of order 6 and degree 2
13
sage: S.modular_symbols()
14
Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 4 and level 13, weight 2, character [zeta6], sign 0, over Cyclotomic Field of order 6 and degree 2
15
16
We create a spaces associated to Dirichlet characters of modulus 225::
17
18
sage: e = DirichletGroup(225).0
19
sage: e.order()
20
6
21
sage: e.base_ring()
22
Cyclotomic Field of order 60 and degree 16
23
sage: M = ModularForms(e,3)
24
25
Notice that the base ring is "minimized"::
26
27
sage: M
28
Modular Forms space of dimension 66, character [zeta6, 1] and weight 3
29
over Cyclotomic Field of order 6 and degree 2
30
31
If we don't want the base ring to change, we can explicitly specify it::
32
33
sage: ModularForms(e, 3, e.base_ring())
34
Modular Forms space of dimension 66, character [zeta6, 1] and weight 3
35
over Cyclotomic Field of order 60 and degree 16
36
37
Next we create a space associated to a Dirichlet character of order 20::
38
39
sage: e = DirichletGroup(225).1
40
sage: e.order()
41
20
42
sage: e.base_ring()
43
Cyclotomic Field of order 60 and degree 16
44
sage: M = ModularForms(e,17); M
45
Modular Forms space of dimension 484, character [1, zeta20] and
46
weight 17 over Cyclotomic Field of order 20 and degree 8
47
48
We compute the Eisenstein subspace, which is fast even though
49
the dimension of the space is large (since an explicit basis
50
of `q`-expansions has not been computed yet).
51
52
::
53
54
sage: M.eisenstein_submodule()
55
Eisenstein subspace of dimension 8 of Modular Forms space of
56
dimension 484, character [1, zeta20] and weight 17 over Cyclotomic Field of order 20 and degree 8
57
58
sage: M.cuspidal_submodule()
59
Cuspidal subspace of dimension 476 of Modular Forms space of dimension 484, character [1, zeta20] and weight 17 over Cyclotomic Field of order 20 and degree 8
60
61
TESTS::
62
63
sage: m = ModularForms(DirichletGroup(20).1,5)
64
sage: m == loads(dumps(m))
65
True
66
sage: type(m)
67
<class 'sage.modular.modform.ambient_eps.ModularFormsAmbient_eps_with_category'>
68
"""
69
70
#########################################################################
71
# Copyright (C) 2006 William Stein <[email protected]>
72
#
73
# Distributed under the terms of the GNU General Public License (GPL)
74
#
75
# http://www.gnu.org/licenses/
76
#########################################################################
77
78
import sage.rings.all as rings
79
80
import sage.modular.arithgroup.all as arithgroup
81
import sage.modular.dirichlet as dirichlet
82
import sage.modular.modsym.modsym as modsym
83
84
import ambient
85
import ambient_R
86
import cuspidal_submodule
87
import eisenstein_submodule
88
89
class ModularFormsAmbient_eps(ambient.ModularFormsAmbient):
90
"""
91
A space of modular forms with character.
92
"""
93
def __init__(self, character, weight=2, base_ring=None):
94
"""
95
Create an ambient modular forms space with character.
96
97
.. note::
98
99
The base ring must be of characteristic 0. The ambient_R
100
Python module is used for computing in characteristic p,
101
which we view as the reduction of characteristic 0.
102
103
INPUT:
104
105
- ``weight`` - int
106
107
- ``character`` - dirichlet.DirichletCharacter
108
109
- ``base_ring`` - base field
110
111
EXAMPLES::
112
113
sage: m = ModularForms(DirichletGroup(11).0,3); m
114
Modular Forms space of dimension 3, character [zeta10] and weight 3 over Cyclotomic Field of order 10 and degree 4
115
sage: type(m)
116
<class 'sage.modular.modform.ambient_eps.ModularFormsAmbient_eps_with_category'>
117
"""
118
if not dirichlet.is_DirichletCharacter(character):
119
raise TypeError, "character (=%s) must be a Dirichlet character"%character
120
if base_ring==None: base_ring=character.base_ring()
121
if character.base_ring() != base_ring:
122
character = character.change_ring(base_ring)
123
if base_ring.characteristic() != 0:
124
raise ValueError, "the base ring must have characteristic 0."
125
group = arithgroup.Gamma1(character.modulus())
126
base_ring = character.base_ring()
127
ambient.ModularFormsAmbient.__init__(self, group, weight, base_ring, character)
128
129
def _repr_(self):
130
"""
131
String representation of this space with character.
132
133
EXAMPLES::
134
135
sage: m = ModularForms(DirichletGroup(8).1,2)
136
sage: m._repr_()
137
'Modular Forms space of dimension 2, character [1, -1] and weight 2 over Rational Field'
138
139
You can rename the space with the rename command.
140
141
::
142
143
sage: m.rename('Modforms of level 8')
144
sage: m
145
Modforms of level 8
146
"""
147
try:
148
d = self.dimension()
149
except NotImplementedError:
150
d = "(unknown)"
151
return "Modular Forms space of dimension %s, character %s and weight %s over %s"%(
152
d, self.character()._repr_short_(), self.weight(), self.base_ring())
153
154
def cuspidal_submodule(self):
155
"""
156
Return the cuspidal submodule of this ambient space of modular forms.
157
158
EXAMPLES::
159
160
sage: eps = DirichletGroup(4).0
161
sage: M = ModularForms(eps, 5); M
162
Modular Forms space of dimension 3, character [-1] and weight 5 over Rational Field
163
sage: M.cuspidal_submodule()
164
Cuspidal subspace of dimension 1 of Modular Forms space of dimension 3, character [-1] and weight 5 over Rational Field
165
"""
166
try:
167
return self.__cuspidal_submodule
168
except AttributeError:
169
self.__cuspidal_submodule = cuspidal_submodule.CuspidalSubmodule_eps(self)
170
return self.__cuspidal_submodule
171
172
def change_ring(self, base_ring):
173
"""
174
Return space with same defining parameters as this ambient
175
space of modular symbols, but defined over a different base
176
ring.
177
178
EXAMPLES::
179
180
sage: m = ModularForms(DirichletGroup(13).0^2,2); m
181
Modular Forms space of dimension 3, character [zeta6] and weight 2 over Cyclotomic Field of order 6 and degree 2
182
sage: m.change_ring(CyclotomicField(12))
183
Modular Forms space of dimension 3, character [zeta6] and weight 2 over Cyclotomic Field of order 12 and degree 4
184
185
It must be possible to change the ring of the underlying Dirichlet character::
186
187
sage: m.change_ring(QQ)
188
Traceback (most recent call last):
189
...
190
ValueError: cannot coerce element of order 6 into self
191
"""
192
if self.base_ring() == base_ring:
193
return self
194
return ambient_R.ModularFormsAmbient_R(self, base_ring = base_ring)
195
196
def modular_symbols(self, sign=0):
197
"""
198
Return corresponding space of modular symbols with given sign.
199
200
EXAMPLES::
201
202
sage: eps = DirichletGroup(13).0
203
sage: M = ModularForms(eps^2, 2)
204
sage: M.modular_symbols()
205
Modular Symbols space of dimension 4 and level 13, weight 2, character [zeta6], sign 0, over Cyclotomic Field of order 6 and degree 2
206
sage: M.modular_symbols(1)
207
Modular Symbols space of dimension 3 and level 13, weight 2, character [zeta6], sign 1, over Cyclotomic Field of order 6 and degree 2
208
sage: M.modular_symbols(-1)
209
Modular Symbols space of dimension 1 and level 13, weight 2, character [zeta6], sign -1, over Cyclotomic Field of order 6 and degree 2
210
sage: M.modular_symbols(2)
211
Traceback (most recent call last):
212
...
213
ValueError: sign must be -1, 0, or 1
214
"""
215
sign = rings.Integer(sign)
216
try:
217
return self.__modsym[sign]
218
except AttributeError:
219
self.__modsym = {}
220
except KeyError:
221
pass
222
self.__modsym[sign] = modsym.ModularSymbols(\
223
self.character(),
224
weight = self.weight(),
225
sign = sign,
226
base_ring = self.base_ring())
227
return self.__modsym[sign]
228
229
def eisenstein_submodule(self):
230
"""
231
Return the submodule of this ambient module with character that is
232
spanned by Eisenstein series. This is the Hecke stable complement
233
of the cuspidal submodule.
234
235
EXAMPLES::
236
237
sage: m = ModularForms(DirichletGroup(13).0^2,2); m
238
Modular Forms space of dimension 3, character [zeta6] and weight 2 over Cyclotomic Field of order 6 and degree 2
239
sage: m.eisenstein_submodule()
240
Eisenstein subspace of dimension 2 of Modular Forms space of dimension 3, character [zeta6] and weight 2 over Cyclotomic Field of order 6 and degree 2
241
"""
242
try:
243
return self.__eisenstein_submodule
244
except AttributeError:
245
self.__eisenstein_submodule = eisenstein_submodule.EisensteinSubmodule_eps(self)
246
return self.__eisenstein_submodule
247
248
def hecke_module_of_level(self, N):
249
r"""
250
Return the Hecke module of level N corresponding to self, which is the
251
domain or codomain of a degeneracy map from self. Here N must be either
252
a divisor or a multiple of the level of self, and a multiple of the
253
conductor of the character of self.
254
255
EXAMPLES::
256
257
sage: M = ModularForms(DirichletGroup(15).0, 3); M.character().conductor()
258
3
259
sage: M.hecke_module_of_level(3)
260
Modular Forms space of dimension 2, character [-1] and weight 3 over Rational Field
261
sage: M.hecke_module_of_level(5)
262
Traceback (most recent call last):
263
...
264
ValueError: conductor(=3) must divide M(=5)
265
sage: M.hecke_module_of_level(30)
266
Modular Forms space of dimension 16, character [-1, 1] and weight 3 over Rational Field
267
"""
268
import constructor
269
if N % self.level() == 0:
270
return constructor.ModularForms(self.character().extend(N), self.weight(), self.base_ring(), prec=self.prec())
271
elif self.level() % N == 0:
272
return constructor.ModularForms(self.character().restrict(N), self.weight(), self.base_ring(), prec=self.prec())
273
else:
274
raise ValueError, "N (=%s) must be a divisor or a multiple of the level of self (=%s)" % (N, self.level())
275
276
####################################################################
277
# Computations of Dimensions
278
####################################################################
279
def _dim_cuspidal(self):
280
"""
281
Return the dimension of the cuspidal subspace, computed using a dimension formula.
282
283
EXAMPLES::
284
285
sage: m = ModularForms(DirichletGroup(389,CyclotomicField(4)).0,3); m._dim_cuspidal()
286
64
287
"""
288
try:
289
return self.__the_dim_cuspidal
290
except AttributeError:
291
self.__the_dim_cuspidal = self.group().dimension_cusp_forms(
292
self.weight(), eps=self.character())
293
return self.__the_dim_cuspidal
294
295
def _dim_eisenstein(self):
296
"""
297
Return the dimension of the Eisenstein subspace of this space, computed
298
using a dimension formula.
299
300
EXAMPLES::
301
302
sage: m = ModularForms(DirichletGroup(13).0,7); m
303
Modular Forms space of dimension 8, character [zeta12] and weight 7 over Cyclotomic Field of order 12 and degree 4
304
sage: m._dim_eisenstein()
305
2
306
sage: m._dim_cuspidal()
307
6
308
"""
309
try:
310
return self.__the_dim_eisenstein
311
except AttributeError:
312
self.__the_dim_eisenstein = self.group().dimension_eis(self.weight(), eps=self.character())
313
return self.__the_dim_eisenstein
314
315
def _dim_new_cuspidal(self):
316
"""
317
Return the dimension of the new cuspidal subspace, computed
318
using a dimension formula.
319
320
EXAMPLES::
321
322
sage: m = ModularForms(DirichletGroup(33).0,7); m
323
Modular Forms space of dimension 26, character [-1, 1] and weight 7 over Rational Field
324
sage: m._dim_new_cuspidal()
325
20
326
sage: m._dim_cuspidal()
327
22
328
"""
329
try:
330
return self.__the_dim_new_cuspidal
331
except AttributeError:
332
self.__the_dim_new_cuspidal = self.group().dimension_new_cusp_forms(self.weight(), eps=self.character())
333
return self.__the_dim_new_cuspidal
334
335
def _dim_new_eisenstein(self):
336
"""
337
Return the dimension of the new Eisenstein subspace, computed
338
by enumerating all Eisenstein series of the appropriate level.
339
340
EXAMPLES::
341
342
sage: m = ModularForms(DirichletGroup(36).0,5); m
343
Modular Forms space of dimension 28, character [-1, 1] and weight 5 over Rational Field
344
sage: m._dim_new_eisenstein()
345
2
346
sage: m._dim_eisenstein()
347
8
348
"""
349
try:
350
return self.__the_dim_new_eisenstein
351
except AttributeError:
352
if self.character().is_trivial() and self.weight() == 2:
353
if rings.is_prime(self.level()):
354
d = 1
355
else:
356
d = 0
357
else:
358
E = self.eisenstein_series()
359
d = len([g for g in E if g.new_level() == self.level()])
360
self.__the_dim_new_eisenstein = d
361
return self.__the_dim_new_eisenstein
362
363
364
365