42.1 Creating Spaces of Modular Forms

Module: sage.modular.modform.constructor

Creating Spaces of Modular Forms

sage: m = ModularForms(Gamma1(4),11)
sage: m
Modular Forms space of dimension 6 for Congruence Subgroup Gamma1(4) of
weight 11 over Rational Field
sage: m.basis()
[
q - 134*q^5 + O(q^6),
q^2 + 80*q^5 + O(q^6),
q^3 + 16*q^5 + O(q^6),
q^4 - 4*q^5 + O(q^6),
1 + 4092/50521*q^2 + 472384/50521*q^3 + 4194300/50521*q^4 + O(q^6),
q + 1024*q^2 + 59048*q^3 + 1048576*q^4 + 9765626*q^5 + O(q^6)
]

Module-level Functions

CuspForms( [group=1], [weight=2], [base_ring=None], [use_cache=True], [prec=6])

Create a space of cuspidal modular forms.

See the documentation for the ModularForms command for a description of the input parameters.

sage: CuspForms(11,2)
Cuspidal subspace of dimension 1 of Modular Forms space of dimension 2 for
Congruence Subgroup Gamma0(11) of weight 2 over Rational Field

EisensteinForms( [group=1], [weight=2], [base_ring=None], [use_cache=True], [prec=6])

Create a space of eisenstein modular forms.

See the documentation for the ModularForms command for a description of the input parameters.

sage: EisensteinForms(11,2)
Eisenstein subspace of dimension 1 of Modular Forms space of dimension 2
for Congruence Subgroup Gamma0(11) of weight 2 over Rational Field

ModularForms( [group=1], [weight=2], [base_ring=None], [use_cache=True], [prec=6])

Create an ambient space of modular forms.

Input:

group
- A congruence subgroup or a Dirichlet character eps.
weight
- int, the weight, which must be an integer >= 1.
base_ring
- the base ring (ignored if group is a Dirichlet character)

Create using the command ModularForms(group, weight, base_ring) where group could be either a congruence subgroup or a Dirichlet character.

First we create some spaces with trivial character:

sage: ModularForms(Gamma0(11),2).dimension()
2
sage: ModularForms(Gamma0(1),12).dimension()
2

If we give an integer N for the congruence subgroup, it defaults to $ \Gamma_0(N)$ :

sage: ModularForms(1,12).dimension()
2
sage: ModularForms(11,4)
Modular Forms space of dimension 4 for Congruence Subgroup Gamma0(11) of
weight 4 over Rational Field

We create some spaces for $ \Gamma_1(N)$ .

sage: ModularForms(Gamma1(13),2)
Modular Forms space of dimension 13 for Congruence Subgroup Gamma1(13) of
weight 2 over Rational Field
sage: ModularForms(Gamma1(13),2).dimension()
13
sage: [ModularForms(Gamma1(7),k).dimension() for k in [2,3,4,5]]
[5, 7, 9, 11]
sage: ModularForms(Gamma1(5),11).dimension()
12

We create a space with character:

sage: e = (DirichletGroup(13).0)^2
sage: e.order()
6
sage: M = ModularForms(e, 2); M
Modular Forms space of dimension 3, character [zeta6] and weight 2 over
Cyclotomic Field of order 6 and degree 2
sage: f = M.T(2).charpoly('x'); f
x^3 + (-2*zeta6 - 2)*x^2 + (-2*zeta6)*x + 14*zeta6 - 7
sage: f.factor()
(x - 2*zeta6 - 1) * (x - zeta6 - 2) * (x + zeta6 + 1)

More examples of spaces with character:

sage: e = DirichletGroup(5, RationalField()).gen(); e
[-1]
sage: m = ModularForms(e, 2); m
Modular Forms space of dimension 2, character [-1] and weight 2 over
Rational Field
sage: m == loads(dumps(m))
True
sage: m.T(2).charpoly('x')
x^2 - 1
sage: m = ModularForms(e, 6); m.dimension()
4
sage: m.T(2).charpoly('x')
x^4 - 917*x^2 - 42284

ModularForms_clear_cache( )

Clear the cache of modular forms.

sage: M = ModularForms(37,2)
sage: sage.modular.modform.constructor._cache == {}
False

sage: sage.modular.modform.constructor.ModularForms_clear_cache()
sage: sage.modular.modform.constructor._cache  
{}

Newform( identifier, [group=None], [weight=2], [base_ring=Rational Field], [names=None])

Input:

identifier
- a cannonical label, or the index of the specific newform desired
group
- the congruence subgroup of the newform
weight
- the weight of the newform (default 2)
base_ring
- the base ring
names
- if the newform has coefficients in a number field, a generator name must be specified

sage: Newform('67a', names='a')
q + 2*q^2 - 2*q^3 + 2*q^4 + 2*q^5 + O(q^6)
sage: Newform('67b', names='a')
q + a1*q^2 + (-a1 - 3)*q^3 + (-3*a1 - 3)*q^4 - 3*q^5 + O(q^6)

Newforms( group, [weight=2], [base_ring=Rational Field], [names=None])

Input:

group
- the congruence subgroup of the newform
weight
- the weight of the newform (default 2)
base_ring
- the base ring
names
- if the newform has coefficients in a number field, a generator name must be specified

sage: Newforms(11, 2)
[q - 2*q^2 - q^3 + 2*q^4 + q^5 + O(q^6)]
sage: Newforms(65, names='a')
[q - q^2 - 2*q^3 - q^4 - q^5 + O(q^6),
 q + a1*q^2 + (a1 + 1)*q^3 + (-2*a1 - 1)*q^4 + q^5 + O(q^6),
 q + a2*q^2 + (-a2 + 1)*q^3 + q^4 - q^5 + O(q^6)]

canonical_parameters( group, level, weight, base_ring)

Given a group, level, weight, and base_ring as input by the user, return a canonicalized version of them, where level is a Sage integer, group really is a group, weight is a Sage integer, and base_ring a Sage ring. Note that we can't just get the level from the group, because we have the convention that the character for Gamma1(N) is None (which makes good sense).

Input:

group
- int, long, SAGE integer, group, dirichlet character, or
level
- int, long, SAGE integer, or group
weight
- coercible to SAGE integer
base_ring
- commutative SAGE ring

Output:
level
- SAGE integer
group
- congruence subgroup
weight
- SAGE integer
ring
- commutative SAGE ring

sage: from sage.modular.modform.constructor import canonical_parameters
sage: v = canonical_parameters(5, 5, int(7), ZZ); v
(5, Congruence Subgroup Gamma0(5), 7, Integer Ring)
sage: type(v[0]), type(v[1]), type(v[2]), type(v[3])
(<type 'sage.rings.integer.Integer'>,
 <class 'sage.modular.congroup.Gamma0'>,
 <type 'sage.rings.integer.Integer'>,
 <type 'sage.rings.integer_ring.IntegerRing_class'>)
sage: canonical_parameters( 5, 7, 7, ZZ )
Traceback (most recent call last):
...
ValueError: group and level do not match.

parse_label( s)

See About this document... for information on suggesting changes.