The cuspidal subspace

EXAMPLES:

sage: S = CuspForms(SL2Z,12); S
Cuspidal subspace of dimension 1 of Modular Forms space of dimension 2 for
Modular Group SL(2,Z) of weight 12 over Rational Field
sage: S.basis()
[
q - 24*q^2 + 252*q^3 - 1472*q^4 + 4830*q^5 + O(q^6)
]

sage: S = CuspForms(Gamma0(33),2); S
Cuspidal subspace of dimension 3 of Modular Forms space of dimension 6 for
Congruence Subgroup Gamma0(33) of weight 2 over Rational Field
sage: S.basis()
[
q - q^5 + O(q^6),
q^2 - q^4 - q^5 + O(q^6),
q^3 + O(q^6)
]

sage: S = CuspForms(Gamma1(3),6); S
Cuspidal subspace of dimension 1 of Modular Forms space of dimension 3 for
Congruence Subgroup Gamma1(3) of weight 6 over Rational Field
sage: S.basis()
[
q - 6*q^2 + 9*q^3 + 4*q^4 + 6*q^5 + O(q^6)
]
>>> from sage.all import *
>>> S = CuspForms(SL2Z,Integer(12)); S
Cuspidal subspace of dimension 1 of Modular Forms space of dimension 2 for
Modular Group SL(2,Z) of weight 12 over Rational Field
>>> S.basis()
[
q - 24*q^2 + 252*q^3 - 1472*q^4 + 4830*q^5 + O(q^6)
]

>>> S = CuspForms(Gamma0(Integer(33)),Integer(2)); S
Cuspidal subspace of dimension 3 of Modular Forms space of dimension 6 for
Congruence Subgroup Gamma0(33) of weight 2 over Rational Field
>>> S.basis()
[
q - q^5 + O(q^6),
q^2 - q^4 - q^5 + O(q^6),
q^3 + O(q^6)
]

>>> S = CuspForms(Gamma1(Integer(3)),Integer(6)); S
Cuspidal subspace of dimension 1 of Modular Forms space of dimension 3 for
Congruence Subgroup Gamma1(3) of weight 6 over Rational Field
>>> S.basis()
[
q - 6*q^2 + 9*q^3 + 4*q^4 + 6*q^5 + O(q^6)
]
S = CuspForms(SL2Z,12); S
S.basis()
S = CuspForms(Gamma0(33),2); S
S.basis()
S = CuspForms(Gamma1(3),6); S
S.basis()
class sage.modular.modform.cuspidal_submodule.CuspidalSubmodule(ambient_space)[source]

Bases: ModularFormsSubmodule

Base class for cuspidal submodules of ambient spaces of modular forms.

change_ring(R)[source]

Change the base ring of self to R, when this makes sense.

This differs from base_extend() in that there may not be a canonical map from self to the new space, as in the first example below. If this space has a character then this may fail when the character cannot be defined over R, as in the second example.

EXAMPLES:

sage: # needs sage.rings.number_field
sage: chi = DirichletGroup(109, CyclotomicField(3)).0
sage: S9 = CuspForms(chi, 2, base_ring = CyclotomicField(9)); S9
Cuspidal subspace of dimension 8 of
 Modular Forms space of dimension 10, character [zeta3 + 1] and weight 2
 over Cyclotomic Field of order 9 and degree 6
sage: S9.change_ring(CyclotomicField(3))
Cuspidal subspace of dimension 8 of
 Modular Forms space of dimension 10, character [zeta3 + 1] and weight 2
 over Cyclotomic Field of order 3 and degree 2
sage: S9.change_ring(QQ)
Traceback (most recent call last):
...
ValueError: Space cannot be defined over Rational Field
>>> from sage.all import *
>>> # needs sage.rings.number_field
>>> chi = DirichletGroup(Integer(109), CyclotomicField(Integer(3))).gen(0)
>>> S9 = CuspForms(chi, Integer(2), base_ring = CyclotomicField(Integer(9))); S9
Cuspidal subspace of dimension 8 of
 Modular Forms space of dimension 10, character [zeta3 + 1] and weight 2
 over Cyclotomic Field of order 9 and degree 6
>>> S9.change_ring(CyclotomicField(Integer(3)))
Cuspidal subspace of dimension 8 of
 Modular Forms space of dimension 10, character [zeta3 + 1] and weight 2
 over Cyclotomic Field of order 3 and degree 2
>>> S9.change_ring(QQ)
Traceback (most recent call last):
...
ValueError: Space cannot be defined over Rational Field
# needs sage.rings.number_field
chi = DirichletGroup(109, CyclotomicField(3)).0
S9 = CuspForms(chi, 2, base_ring = CyclotomicField(9)); S9
S9.change_ring(CyclotomicField(3))
S9.change_ring(QQ)
is_cuspidal()[source]

Return True since spaces of cusp forms are cuspidal.

EXAMPLES:

sage: CuspForms(4,10).is_cuspidal()
True
>>> from sage.all import *
>>> CuspForms(Integer(4),Integer(10)).is_cuspidal()
True
CuspForms(4,10).is_cuspidal()
modular_symbols(sign=0)[source]

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

EXAMPLES:

sage: S = ModularForms(11,2).cuspidal_submodule()
sage: S.modular_symbols()
Modular Symbols subspace of dimension 2 of 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 subspace of dimension 1 of Modular Symbols space
of dimension 1 for Gamma_0(11) of weight 2 with sign -1 over Rational Field

sage: M = S.modular_symbols(sign=1); M
Modular Symbols subspace of dimension 1 of Modular Symbols space of
dimension 2 for Gamma_0(11) of weight 2 with sign 1 over Rational Field
sage: M.sign()
1

sage: S = ModularForms(1,12).cuspidal_submodule()
sage: S.modular_symbols()
Modular Symbols subspace of dimension 2 of Modular Symbols space of
dimension 3 for Gamma_0(1) of weight 12 with sign 0 over Rational Field

sage: # needs sage.rings.number_field
sage: eps = DirichletGroup(13).0
sage: S = CuspForms(eps^2, 2)
sage: S.modular_symbols(sign=0)
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
sage: S.modular_symbols(sign=1)
Modular Symbols subspace of dimension 1 of Modular Symbols space
of dimension 3 and level 13, weight 2, character [zeta6], sign 1,
over Cyclotomic Field of order 6 and degree 2
sage: S.modular_symbols(sign=-1)
Modular Symbols subspace of dimension 1 of Modular Symbols space
of dimension 1 and level 13, weight 2, character [zeta6], sign -1,
over Cyclotomic Field of order 6 and degree 2
>>> from sage.all import *
>>> S = ModularForms(Integer(11),Integer(2)).cuspidal_submodule()
>>> S.modular_symbols()
Modular Symbols subspace of dimension 2 of 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 subspace of dimension 1 of Modular Symbols space
of dimension 1 for Gamma_0(11) of weight 2 with sign -1 over Rational Field

>>> M = S.modular_symbols(sign=Integer(1)); M
Modular Symbols subspace of dimension 1 of Modular Symbols space of
dimension 2 for Gamma_0(11) of weight 2 with sign 1 over Rational Field
>>> M.sign()
1

>>> S = ModularForms(Integer(1),Integer(12)).cuspidal_submodule()
>>> S.modular_symbols()
Modular Symbols subspace of dimension 2 of Modular Symbols space of
dimension 3 for Gamma_0(1) of weight 12 with sign 0 over Rational Field

>>> # needs sage.rings.number_field
>>> eps = DirichletGroup(Integer(13)).gen(0)
>>> S = CuspForms(eps**Integer(2), Integer(2))
>>> S.modular_symbols(sign=Integer(0))
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
>>> S.modular_symbols(sign=Integer(1))
Modular Symbols subspace of dimension 1 of Modular Symbols space
of dimension 3 and level 13, weight 2, character [zeta6], sign 1,
over Cyclotomic Field of order 6 and degree 2
>>> S.modular_symbols(sign=-Integer(1))
Modular Symbols subspace of dimension 1 of Modular Symbols space
of dimension 1 and level 13, weight 2, character [zeta6], sign -1,
over Cyclotomic Field of order 6 and degree 2
S = ModularForms(11,2).cuspidal_submodule()
S.modular_symbols()
S.modular_symbols(sign=-1)
M = S.modular_symbols(sign=1); M
M.sign()
S = ModularForms(1,12).cuspidal_submodule()
S.modular_symbols()
# needs sage.rings.number_field
eps = DirichletGroup(13).0
S = CuspForms(eps^2, 2)
S.modular_symbols(sign=0)
S.modular_symbols(sign=1)
S.modular_symbols(sign=-1)
class sage.modular.modform.cuspidal_submodule.CuspidalSubmodule_R(ambient_space)[source]

Bases: CuspidalSubmodule

Cuspidal submodule over a non-minimal base ring.

class sage.modular.modform.cuspidal_submodule.CuspidalSubmodule_eps(ambient_space)[source]

Bases: CuspidalSubmodule_modsym_qexp

Space of cusp forms with given Dirichlet character.

EXAMPLES:

sage: S = CuspForms(DirichletGroup(5).0,5); S
Cuspidal subspace of dimension 1 of Modular Forms space of dimension 3,
character [zeta4] and weight 5 over Cyclotomic Field of order 4 and degree 2

sage: S.basis()
[
q + (-zeta4 - 1)*q^2 + (6*zeta4 - 6)*q^3 - 14*zeta4*q^4 + (15*zeta4 + 20)*q^5 + O(q^6)
]
sage: f = S.0
sage: f.qexp()
q + (-zeta4 - 1)*q^2 + (6*zeta4 - 6)*q^3 - 14*zeta4*q^4 + (15*zeta4 + 20)*q^5 + O(q^6)
sage: f.qexp(7)
q + (-zeta4 - 1)*q^2 + (6*zeta4 - 6)*q^3 - 14*zeta4*q^4 + (15*zeta4 + 20)*q^5 + 12*q^6 + O(q^7)
sage: f.qexp(3)
q + (-zeta4 - 1)*q^2 + O(q^3)
sage: f.qexp(2)
q + O(q^2)
sage: f.qexp(1)
O(q^1)
>>> from sage.all import *
>>> S = CuspForms(DirichletGroup(Integer(5)).gen(0),Integer(5)); S
Cuspidal subspace of dimension 1 of Modular Forms space of dimension 3,
character [zeta4] and weight 5 over Cyclotomic Field of order 4 and degree 2

>>> S.basis()
[
q + (-zeta4 - 1)*q^2 + (6*zeta4 - 6)*q^3 - 14*zeta4*q^4 + (15*zeta4 + 20)*q^5 + O(q^6)
]
>>> f = S.gen(0)
>>> f.qexp()
q + (-zeta4 - 1)*q^2 + (6*zeta4 - 6)*q^3 - 14*zeta4*q^4 + (15*zeta4 + 20)*q^5 + O(q^6)
>>> f.qexp(Integer(7))
q + (-zeta4 - 1)*q^2 + (6*zeta4 - 6)*q^3 - 14*zeta4*q^4 + (15*zeta4 + 20)*q^5 + 12*q^6 + O(q^7)
>>> f.qexp(Integer(3))
q + (-zeta4 - 1)*q^2 + O(q^3)
>>> f.qexp(Integer(2))
q + O(q^2)
>>> f.qexp(Integer(1))
O(q^1)
S = CuspForms(DirichletGroup(5).0,5); S
S.basis()
f = S.0
f.qexp()
f.qexp(7)
f.qexp(3)
f.qexp(2)
f.qexp(1)
class sage.modular.modform.cuspidal_submodule.CuspidalSubmodule_g0_Q(ambient_space)[source]

Bases: CuspidalSubmodule_modsym_qexp

Space of cusp forms for \(\Gamma_0(N)\) over \(\QQ\).

class sage.modular.modform.cuspidal_submodule.CuspidalSubmodule_g1_Q(ambient_space)[source]

Bases: CuspidalSubmodule_gH_Q

Space of cusp forms for \(\Gamma_1(N)\) over \(\QQ\).

class sage.modular.modform.cuspidal_submodule.CuspidalSubmodule_gH_Q(ambient_space)[source]

Bases: CuspidalSubmodule_modsym_qexp

Space of cusp forms for \(\Gamma_H(N)\) over \(\QQ\).

class sage.modular.modform.cuspidal_submodule.CuspidalSubmodule_level1_Q(ambient_space)[source]

Bases: CuspidalSubmodule

Space of cusp forms of level 1 over \(\QQ\).

class sage.modular.modform.cuspidal_submodule.CuspidalSubmodule_modsym_qexp(ambient_space)[source]

Bases: CuspidalSubmodule

Cuspidal submodule with \(q\)-expansions calculated via modular symbols.

hecke_polynomial(n, var='x')[source]

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

EXAMPLES:

sage: CuspForms(105, 2).hecke_polynomial(2, 'y')
y^13 + 5*y^12 - 4*y^11 - 52*y^10 - 34*y^9 + 174*y^8 + 212*y^7
 - 196*y^6 - 375*y^5 - 11*y^4 + 200*y^3 + 80*y^2
>>> from sage.all import *
>>> CuspForms(Integer(105), Integer(2)).hecke_polynomial(Integer(2), 'y')
y^13 + 5*y^12 - 4*y^11 - 52*y^10 - 34*y^9 + 174*y^8 + 212*y^7
 - 196*y^6 - 375*y^5 - 11*y^4 + 200*y^3 + 80*y^2
CuspForms(105, 2).hecke_polynomial(2, 'y')

Check that this gives the same answer as computing the Hecke matrix:

sage: CuspForms(105, 2).hecke_matrix(2).charpoly(var='y')
y^13 + 5*y^12 - 4*y^11 - 52*y^10 - 34*y^9 + 174*y^8 + 212*y^7
 - 196*y^6 - 375*y^5 - 11*y^4 + 200*y^3 + 80*y^2
>>> from sage.all import *
>>> CuspForms(Integer(105), Integer(2)).hecke_matrix(Integer(2)).charpoly(var='y')
y^13 + 5*y^12 - 4*y^11 - 52*y^10 - 34*y^9 + 174*y^8 + 212*y^7
 - 196*y^6 - 375*y^5 - 11*y^4 + 200*y^3 + 80*y^2
CuspForms(105, 2).hecke_matrix(2).charpoly(var='y')

Check that Issue #21546 is fixed (this example used to take about 5 hours):

sage: CuspForms(1728, 2).hecke_polynomial(2) # long time (20 sec)
x^253 + x^251 - 2*x^249
>>> from sage.all import *
>>> CuspForms(Integer(1728), Integer(2)).hecke_polynomial(Integer(2)) # long time (20 sec)
x^253 + x^251 - 2*x^249
CuspForms(1728, 2).hecke_polynomial(2) # long time (20 sec)
new_submodule(p=None)[source]

Return the new subspace of this space of cusp forms. This is computed using modular symbols.

EXAMPLES:

sage: CuspForms(55).new_submodule()
Modular Forms subspace of dimension 3 of
 Modular Forms space of dimension 8 for
  Congruence Subgroup Gamma0(55) of weight 2 over Rational Field
>>> from sage.all import *
>>> CuspForms(Integer(55)).new_submodule()
Modular Forms subspace of dimension 3 of
 Modular Forms space of dimension 8 for
  Congruence Subgroup Gamma0(55) of weight 2 over Rational Field
CuspForms(55).new_submodule()
class sage.modular.modform.cuspidal_submodule.CuspidalSubmodule_wt1_eps(ambient_space)[source]

Bases: CuspidalSubmodule

Space of cusp forms of weight 1 with specified character.

class sage.modular.modform.cuspidal_submodule.CuspidalSubmodule_wt1_gH(ambient_space)[source]

Bases: CuspidalSubmodule

Space of cusp forms of weight 1 for a GammaH group.