Ambient spaces of modular forms

EXAMPLES:

We compute a basis for the ambient space \(M_2(\Gamma_1(25),\chi)\), where \(\chi\) is quadratic.

sage: chi = DirichletGroup(25,QQ).0; chi
Dirichlet character modulo 25 of conductor 5 mapping 2 |--> -1
sage: n = ModularForms(chi,2); n
Modular Forms space of dimension 6, character [-1] and weight 2 over Rational Field
sage: type(n)
<class 'sage.modular.modform.ambient_eps.ModularFormsAmbient_eps_with_category'>
>>> from sage.all import *
>>> chi = DirichletGroup(Integer(25),QQ).gen(0); chi
Dirichlet character modulo 25 of conductor 5 mapping 2 |--> -1
>>> n = ModularForms(chi,Integer(2)); n
Modular Forms space of dimension 6, character [-1] and weight 2 over Rational Field
>>> type(n)
<class 'sage.modular.modform.ambient_eps.ModularFormsAmbient_eps_with_category'>

Compute a basis:

sage: n.basis()
[
1 + O(q^6),
q + O(q^6),
q^2 + O(q^6),
q^3 + O(q^6),
q^4 + O(q^6),
q^5 + O(q^6)
]
>>> from sage.all import *
>>> n.basis()
[
1 + O(q^6),
q + O(q^6),
q^2 + O(q^6),
q^3 + O(q^6),
q^4 + O(q^6),
q^5 + O(q^6)
]

Compute the same basis but to higher precision:

sage: n.set_precision(20)
sage: n.basis()
[
1 + 10*q^10 + 20*q^15 + O(q^20),
q + 5*q^6 + q^9 + 12*q^11 - 3*q^14 + 17*q^16 + 8*q^19 + O(q^20),
q^2 + 4*q^7 - q^8 + 8*q^12 + 2*q^13 + 10*q^17 - 5*q^18 + O(q^20),
q^3 + q^7 + 3*q^8 - q^12 + 5*q^13 + 3*q^17 + 6*q^18 + O(q^20),
q^4 - q^6 + 2*q^9 + 3*q^14 - 2*q^16 + 4*q^19 + O(q^20),
q^5 + q^10 + 2*q^15 + O(q^20)
]
>>> from sage.all import *
>>> n.set_precision(Integer(20))
>>> n.basis()
[
1 + 10*q^10 + 20*q^15 + O(q^20),
q + 5*q^6 + q^9 + 12*q^11 - 3*q^14 + 17*q^16 + 8*q^19 + O(q^20),
q^2 + 4*q^7 - q^8 + 8*q^12 + 2*q^13 + 10*q^17 - 5*q^18 + O(q^20),
q^3 + q^7 + 3*q^8 - q^12 + 5*q^13 + 3*q^17 + 6*q^18 + O(q^20),
q^4 - q^6 + 2*q^9 + 3*q^14 - 2*q^16 + 4*q^19 + O(q^20),
q^5 + q^10 + 2*q^15 + O(q^20)
]
class sage.modular.modform.ambient.ModularFormsAmbient(group, weight, base_ring, character=None, eis_only=False)[source]

Bases: ModularFormsSpace, AmbientHeckeModule

An ambient space of modular forms.

ambient_space()[source]

Return the ambient space that contains this ambient space. This is, of course, just this space again.

EXAMPLES:

sage: m = ModularForms(Gamma0(3),30)
sage: m.ambient_space() is m
True
>>> from sage.all import *
>>> m = ModularForms(Gamma0(Integer(3)),Integer(30))
>>> m.ambient_space() is m
True
change_ring(base_ring)[source]

Change the base ring of this space of modular forms.

INPUT:

  • R – ring

EXAMPLES:

sage: M = ModularForms(Gamma0(37),2)
sage: M.basis()
[
q + q^3 - 2*q^4 + O(q^6),
q^2 + 2*q^3 - 2*q^4 + q^5 + O(q^6),
1 + 2/3*q + 2*q^2 + 8/3*q^3 + 14/3*q^4 + 4*q^5 + O(q^6)
]
>>> from sage.all import *
>>> M = ModularForms(Gamma0(Integer(37)),Integer(2))
>>> M.basis()
[
q + q^3 - 2*q^4 + O(q^6),
q^2 + 2*q^3 - 2*q^4 + q^5 + O(q^6),
1 + 2/3*q + 2*q^2 + 8/3*q^3 + 14/3*q^4 + 4*q^5 + O(q^6)
]

The basis after changing the base ring is the reduction modulo \(3\) of an integral basis.

sage: M3 = M.change_ring(GF(3))
sage: M3.basis()
[
q + q^3 + q^4 + O(q^6),
q^2 + 2*q^3 + q^4 + q^5 + O(q^6),
1 + q^3 + q^4 + 2*q^5 + O(q^6)
]
>>> from sage.all import *
>>> M3 = M.change_ring(GF(Integer(3)))
>>> M3.basis()
[
q + q^3 + q^4 + O(q^6),
q^2 + 2*q^3 + q^4 + q^5 + O(q^6),
1 + q^3 + q^4 + 2*q^5 + O(q^6)
]
cuspidal_submodule()[source]

Return the cuspidal submodule of this ambient module.

EXAMPLES:

sage: ModularForms(Gamma1(13)).cuspidal_submodule()
Cuspidal subspace of dimension 2 of Modular Forms space of dimension 13 for
Congruence Subgroup Gamma1(13) of weight 2 over Rational Field
>>> from sage.all import *
>>> ModularForms(Gamma1(Integer(13))).cuspidal_submodule()
Cuspidal subspace of dimension 2 of Modular Forms space of dimension 13 for
Congruence Subgroup Gamma1(13) of weight 2 over Rational Field
dimension()[source]

Return the dimension of this ambient space of modular forms, computed using a dimension formula (so it should be reasonably fast).

EXAMPLES:

sage: m = ModularForms(Gamma1(20),20)
sage: m.dimension()
238
>>> from sage.all import *
>>> m = ModularForms(Gamma1(Integer(20)),Integer(20))
>>> m.dimension()
238
eisenstein_params()[source]

Return parameters that define all Eisenstein series in self.

OUTPUT: an immutable Sequence

EXAMPLES:

sage: m = ModularForms(Gamma0(22), 2)
sage: v = m.eisenstein_params(); v
[(Dirichlet character modulo 22 of conductor 1 mapping 13 |--> 1, Dirichlet character modulo 22 of conductor 1 mapping 13 |--> 1, 2), (Dirichlet character modulo 22 of conductor 1 mapping 13 |--> 1, Dirichlet character modulo 22 of conductor 1 mapping 13 |--> 1, 11), (Dirichlet character modulo 22 of conductor 1 mapping 13 |--> 1, Dirichlet character modulo 22 of conductor 1 mapping 13 |--> 1, 22)]
sage: type(v)
<class 'sage.structure.sequence.Sequence_generic'>
>>> from sage.all import *
>>> m = ModularForms(Gamma0(Integer(22)), Integer(2))
>>> v = m.eisenstein_params(); v
[(Dirichlet character modulo 22 of conductor 1 mapping 13 |--> 1, Dirichlet character modulo 22 of conductor 1 mapping 13 |--> 1, 2), (Dirichlet character modulo 22 of conductor 1 mapping 13 |--> 1, Dirichlet character modulo 22 of conductor 1 mapping 13 |--> 1, 11), (Dirichlet character modulo 22 of conductor 1 mapping 13 |--> 1, Dirichlet character modulo 22 of conductor 1 mapping 13 |--> 1, 22)]
>>> type(v)
<class 'sage.structure.sequence.Sequence_generic'>
eisenstein_series()[source]

Return all Eisenstein series associated to this space.

sage: ModularForms(27,2).eisenstein_series()
[
q^3 + O(q^6),
q - 3*q^2 + 7*q^4 - 6*q^5 + O(q^6),
1/12 + q + 3*q^2 + q^3 + 7*q^4 + 6*q^5 + O(q^6),
1/3 + q + 3*q^2 + 4*q^3 + 7*q^4 + 6*q^5 + O(q^6),
13/12 + q + 3*q^2 + 4*q^3 + 7*q^4 + 6*q^5 + O(q^6)
]
>>> from sage.all import *
>>> ModularForms(Integer(27),Integer(2)).eisenstein_series()
[
q^3 + O(q^6),
q - 3*q^2 + 7*q^4 - 6*q^5 + O(q^6),
1/12 + q + 3*q^2 + q^3 + 7*q^4 + 6*q^5 + O(q^6),
1/3 + q + 3*q^2 + 4*q^3 + 7*q^4 + 6*q^5 + O(q^6),
13/12 + q + 3*q^2 + 4*q^3 + 7*q^4 + 6*q^5 + O(q^6)
]

sage: ModularForms(Gamma1(5),3).eisenstein_series()
[
-1/5*zeta4 - 2/5 + q + (4*zeta4 + 1)*q^2 + (-9*zeta4 + 1)*q^3 + (4*zeta4 - 15)*q^4 + q^5 + O(q^6),
q + (zeta4 + 4)*q^2 + (-zeta4 + 9)*q^3 + (4*zeta4 + 15)*q^4 + 25*q^5 + O(q^6),
1/5*zeta4 - 2/5 + q + (-4*zeta4 + 1)*q^2 + (9*zeta4 + 1)*q^3 + (-4*zeta4 - 15)*q^4 + q^5 + O(q^6),
q + (-zeta4 + 4)*q^2 + (zeta4 + 9)*q^3 + (-4*zeta4 + 15)*q^4 + 25*q^5 + O(q^6)
]
>>> from sage.all import *
>>> ModularForms(Gamma1(Integer(5)),Integer(3)).eisenstein_series()
[
-1/5*zeta4 - 2/5 + q + (4*zeta4 + 1)*q^2 + (-9*zeta4 + 1)*q^3 + (4*zeta4 - 15)*q^4 + q^5 + O(q^6),
q + (zeta4 + 4)*q^2 + (-zeta4 + 9)*q^3 + (4*zeta4 + 15)*q^4 + 25*q^5 + O(q^6),
1/5*zeta4 - 2/5 + q + (-4*zeta4 + 1)*q^2 + (9*zeta4 + 1)*q^3 + (-4*zeta4 - 15)*q^4 + q^5 + O(q^6),
q + (-zeta4 + 4)*q^2 + (zeta4 + 9)*q^3 + (-4*zeta4 + 15)*q^4 + 25*q^5 + O(q^6)
]

sage: eps = DirichletGroup(13).0^2
sage: ModularForms(eps,2).eisenstein_series()
[
-7/13*zeta6 - 11/13 + q + (2*zeta6 + 1)*q^2 + (-3*zeta6 + 1)*q^3 + (6*zeta6 - 3)*q^4 - 4*q^5 + O(q^6),
q + (zeta6 + 2)*q^2 + (-zeta6 + 3)*q^3 + (3*zeta6 + 3)*q^4 + 4*q^5 + O(q^6)
]
>>> from sage.all import *
>>> eps = DirichletGroup(Integer(13)).gen(0)**Integer(2)
>>> ModularForms(eps,Integer(2)).eisenstein_series()
[
-7/13*zeta6 - 11/13 + q + (2*zeta6 + 1)*q^2 + (-3*zeta6 + 1)*q^3 + (6*zeta6 - 3)*q^4 - 4*q^5 + O(q^6),
q + (zeta6 + 2)*q^2 + (-zeta6 + 3)*q^3 + (3*zeta6 + 3)*q^4 + 4*q^5 + O(q^6)
]
eisenstein_submodule()[source]

Return the Eisenstein submodule of this ambient module.

EXAMPLES:

sage: m = ModularForms(Gamma1(13),2); m
Modular Forms space of dimension 13 for Congruence Subgroup Gamma1(13) of weight 2 over Rational Field
sage: m.eisenstein_submodule()
Eisenstein subspace of dimension 11 of Modular Forms space of dimension 13 for Congruence Subgroup Gamma1(13) of weight 2 over Rational Field
>>> from sage.all import *
>>> m = ModularForms(Gamma1(Integer(13)),Integer(2)); m
Modular Forms space of dimension 13 for Congruence Subgroup Gamma1(13) of weight 2 over Rational Field
>>> m.eisenstein_submodule()
Eisenstein subspace of dimension 11 of Modular Forms space of dimension 13 for Congruence Subgroup Gamma1(13) of weight 2 over Rational Field
free_module()[source]

Return the free module underlying this space of modular forms.

EXAMPLES:

sage: ModularForms(37).free_module()
Vector space of dimension 3 over Rational Field
>>> from sage.all import *
>>> ModularForms(Integer(37)).free_module()
Vector space of dimension 3 over Rational Field
hecke_module_of_level(N)[source]

Return the Hecke module of level N corresponding to self, which is the domain or codomain of a degeneracy map from self. Here N must be either a divisor or a multiple of the level of self.

EXAMPLES:

sage: ModularForms(25, 6).hecke_module_of_level(5)
Modular Forms space of dimension 3 for Congruence Subgroup Gamma0(5) of weight 6 over Rational Field
sage: ModularForms(Gamma1(4), 3).hecke_module_of_level(8)
Modular Forms space of dimension 7 for Congruence Subgroup Gamma1(8) of weight 3 over Rational Field
sage: ModularForms(Gamma1(4), 3).hecke_module_of_level(9)
Traceback (most recent call last):
...
ValueError: N (=9) must be a divisor or a multiple of the level of self (=4)
>>> from sage.all import *
>>> ModularForms(Integer(25), Integer(6)).hecke_module_of_level(Integer(5))
Modular Forms space of dimension 3 for Congruence Subgroup Gamma0(5) of weight 6 over Rational Field
>>> ModularForms(Gamma1(Integer(4)), Integer(3)).hecke_module_of_level(Integer(8))
Modular Forms space of dimension 7 for Congruence Subgroup Gamma1(8) of weight 3 over Rational Field
>>> ModularForms(Gamma1(Integer(4)), Integer(3)).hecke_module_of_level(Integer(9))
Traceback (most recent call last):
...
ValueError: N (=9) must be a divisor or a multiple of the level of self (=4)
hecke_polynomial(n, var='x')[source]

Compute the characteristic polynomial of the Hecke operator \(T_n\) acting on this space. Except in level 1, this is computed via modular symbols, and in particular is faster to compute than the matrix itself.

EXAMPLES:

sage: ModularForms(17,4).hecke_polynomial(2)
x^6 - 16*x^5 + 18*x^4 + 608*x^3 - 1371*x^2 - 4968*x + 7776
>>> from sage.all import *
>>> ModularForms(Integer(17),Integer(4)).hecke_polynomial(Integer(2))
x^6 - 16*x^5 + 18*x^4 + 608*x^3 - 1371*x^2 - 4968*x + 7776

Check that this gives the same answer as computing the actual Hecke matrix (which is generally slower):

sage: ModularForms(17,4).hecke_matrix(2).charpoly()
x^6 - 16*x^5 + 18*x^4 + 608*x^3 - 1371*x^2 - 4968*x + 7776
>>> from sage.all import *
>>> ModularForms(Integer(17),Integer(4)).hecke_matrix(Integer(2)).charpoly()
x^6 - 16*x^5 + 18*x^4 + 608*x^3 - 1371*x^2 - 4968*x + 7776
is_ambient()[source]

Return True if this an ambient space of modular forms.

This is an ambient space, so this function always returns True.

EXAMPLES:

sage: ModularForms(11).is_ambient()
True
sage: CuspForms(11).is_ambient()
False
>>> from sage.all import *
>>> ModularForms(Integer(11)).is_ambient()
True
>>> CuspForms(Integer(11)).is_ambient()
False
modular_symbols(sign=0)[source]

Return the corresponding space of modular symbols with the given sign.

EXAMPLES:

sage: S = ModularForms(11,2)
sage: S.modular_symbols()
Modular Symbols space of dimension 3 for Gamma_0(11) of weight 2 with sign 0 over Rational Field
sage: S.modular_symbols(sign=1)
Modular Symbols space of dimension 2 for Gamma_0(11) of weight 2 with sign 1 over Rational Field
sage: S.modular_symbols(sign=-1)
Modular Symbols space of dimension 1 for Gamma_0(11) of weight 2 with sign -1 over Rational Field
>>> from sage.all import *
>>> S = ModularForms(Integer(11),Integer(2))
>>> S.modular_symbols()
Modular Symbols space of dimension 3 for Gamma_0(11) of weight 2 with sign 0 over Rational Field
>>> S.modular_symbols(sign=Integer(1))
Modular Symbols space of dimension 2 for Gamma_0(11) of weight 2 with sign 1 over Rational Field
>>> S.modular_symbols(sign=-Integer(1))
Modular Symbols space of dimension 1 for Gamma_0(11) of weight 2 with sign -1 over Rational Field

sage: ModularForms(1,12).modular_symbols()
Modular Symbols space of dimension 3 for Gamma_0(1) of weight 12 with sign 0 over Rational Field
>>> from sage.all import *
>>> ModularForms(Integer(1),Integer(12)).modular_symbols()
Modular Symbols space of dimension 3 for Gamma_0(1) of weight 12 with sign 0 over Rational Field
module()[source]

Return the underlying free module corresponding to this space of modular forms.

EXAMPLES:

sage: m = ModularForms(Gamma1(13),10)
sage: m.free_module()
Vector space of dimension 69 over Rational Field
sage: ModularForms(Gamma1(13),4, GF(49,'b')).free_module()
Vector space of dimension 27 over Finite Field in b of size 7^2
>>> from sage.all import *
>>> m = ModularForms(Gamma1(Integer(13)),Integer(10))
>>> m.free_module()
Vector space of dimension 69 over Rational Field
>>> ModularForms(Gamma1(Integer(13)),Integer(4), GF(Integer(49),'b')).free_module()
Vector space of dimension 27 over Finite Field in b of size 7^2
new_submodule(p=None)[source]

Return the new or \(p\)-new submodule of this ambient module.

INPUT:

  • p – (default: None), if specified return only the \(p\)-new submodule

EXAMPLES:

sage: m = ModularForms(Gamma0(33),2); m
Modular Forms space of dimension 6 for Congruence Subgroup Gamma0(33) of weight 2 over Rational Field
sage: m.new_submodule()
Modular Forms subspace of dimension 1 of Modular Forms space of dimension 6 for Congruence Subgroup Gamma0(33) of weight 2 over Rational Field
>>> from sage.all import *
>>> m = ModularForms(Gamma0(Integer(33)),Integer(2)); m
Modular Forms space of dimension 6 for Congruence Subgroup Gamma0(33) of weight 2 over Rational Field
>>> m.new_submodule()
Modular Forms subspace of dimension 1 of Modular Forms space of dimension 6 for Congruence Subgroup Gamma0(33) of weight 2 over Rational Field

Another example:

sage: M = ModularForms(17,4)
sage: N = M.new_subspace(); N
Modular Forms subspace of dimension 4 of Modular Forms space of dimension 6 for Congruence Subgroup Gamma0(17) of weight 4 over Rational Field
sage: N.basis()
[
q + 2*q^5 + O(q^6),
q^2 - 3/2*q^5 + O(q^6),
q^3 + O(q^6),
q^4 - 1/2*q^5 + O(q^6)
]
>>> from sage.all import *
>>> M = ModularForms(Integer(17),Integer(4))
>>> N = M.new_subspace(); N
Modular Forms subspace of dimension 4 of Modular Forms space of dimension 6 for Congruence Subgroup Gamma0(17) of weight 4 over Rational Field
>>> N.basis()
[
q + 2*q^5 + O(q^6),
q^2 - 3/2*q^5 + O(q^6),
q^3 + O(q^6),
q^4 - 1/2*q^5 + O(q^6)
]

sage: ModularForms(12,4).new_submodule()
Modular Forms subspace of dimension 1 of Modular Forms space of dimension 9 for Congruence Subgroup Gamma0(12) of weight 4 over Rational Field
>>> from sage.all import *
>>> ModularForms(Integer(12),Integer(4)).new_submodule()
Modular Forms subspace of dimension 1 of Modular Forms space of dimension 9 for Congruence Subgroup Gamma0(12) of weight 4 over Rational Field

Unfortunately (TODO) - \(p\)-new submodules aren’t yet implemented:

sage: m.new_submodule(3)            # not implemented
Traceback (most recent call last):
...
NotImplementedError
sage: m.new_submodule(11)           # not implemented
Traceback (most recent call last):
...
NotImplementedError
>>> from sage.all import *
>>> m.new_submodule(Integer(3))            # not implemented
Traceback (most recent call last):
...
NotImplementedError
>>> m.new_submodule(Integer(11))           # not implemented
Traceback (most recent call last):
...
NotImplementedError
prec(new_prec=None)[source]

Set or get default initial precision for printing modular forms.

INPUT:

  • new_prec – positive integer (default: None)

OUTPUT: if new_prec is None, returns the current precision

EXAMPLES:

sage: M = ModularForms(1,12, prec=3)
sage: M.prec()
3
>>> from sage.all import *
>>> M = ModularForms(Integer(1),Integer(12), prec=Integer(3))
>>> M.prec()
3

sage: M.basis()
[
q - 24*q^2 + O(q^3),
1 + 65520/691*q + 134250480/691*q^2 + O(q^3)
]
>>> from sage.all import *
>>> M.basis()
[
q - 24*q^2 + O(q^3),
1 + 65520/691*q + 134250480/691*q^2 + O(q^3)
]

sage: M.prec(5)
5
sage: M.basis()
[
q - 24*q^2 + 252*q^3 - 1472*q^4 + O(q^5),
1 + 65520/691*q + 134250480/691*q^2 + 11606736960/691*q^3 + 274945048560/691*q^4 + O(q^5)
]
>>> from sage.all import *
>>> M.prec(Integer(5))
5
>>> M.basis()
[
q - 24*q^2 + 252*q^3 - 1472*q^4 + O(q^5),
1 + 65520/691*q + 134250480/691*q^2 + 11606736960/691*q^3 + 274945048560/691*q^4 + O(q^5)
]
rank()[source]

This is a synonym for self.dimension().

EXAMPLES:

sage: m = ModularForms(Gamma0(20),4)
sage: m.rank()
12
sage: m.dimension()
12
>>> from sage.all import *
>>> m = ModularForms(Gamma0(Integer(20)),Integer(4))
>>> m.rank()
12
>>> m.dimension()
12
set_precision(n)[source]

Set the default precision for displaying elements of this space.

EXAMPLES:

sage: m = ModularForms(Gamma1(5),2)
sage: m.set_precision(10)
sage: m.basis()
[
1 + 60*q^3 - 120*q^4 + 240*q^5 - 300*q^6 + 300*q^7 - 180*q^9 + O(q^10),
q + 6*q^3 - 9*q^4 + 27*q^5 - 28*q^6 + 30*q^7 - 11*q^9 + O(q^10),
q^2 - 4*q^3 + 12*q^4 - 22*q^5 + 30*q^6 - 24*q^7 + 5*q^8 + 18*q^9 + O(q^10)
]
sage: m.set_precision(5)
sage: m.basis()
[
1 + 60*q^3 - 120*q^4 + O(q^5),
q + 6*q^3 - 9*q^4 + O(q^5),
q^2 - 4*q^3 + 12*q^4 + O(q^5)
]
>>> from sage.all import *
>>> m = ModularForms(Gamma1(Integer(5)),Integer(2))
>>> m.set_precision(Integer(10))
>>> m.basis()
[
1 + 60*q^3 - 120*q^4 + 240*q^5 - 300*q^6 + 300*q^7 - 180*q^9 + O(q^10),
q + 6*q^3 - 9*q^4 + 27*q^5 - 28*q^6 + 30*q^7 - 11*q^9 + O(q^10),
q^2 - 4*q^3 + 12*q^4 - 22*q^5 + 30*q^6 - 24*q^7 + 5*q^8 + 18*q^9 + O(q^10)
]
>>> m.set_precision(Integer(5))
>>> m.basis()
[
1 + 60*q^3 - 120*q^4 + O(q^5),
q + 6*q^3 - 9*q^4 + O(q^5),
q^2 - 4*q^3 + 12*q^4 + O(q^5)
]