# Creation Functions

## Ambient Spaces

An ambient space of modular symbols is created by specifying a base ring, character, weight, and optional sign. Note that spaces of modular symbols may be defined directly over any base ring (unlike `ModularForms`, which can only be base extensions of spaces over the integers). The most general signature is `ModularSymbols(eps, k, sign)`, where `eps` is a Dirichlet character (the level is taken to be the modulus of `eps`, and the base ring is taken to be the base ring of `eps`).

For information on Dirichlet characters, see Section [Dirichlet Characters](../../BasicRings/ResidueClassRings/dirichlet-characters.md#rngint-dirichlet).

**Warning:** Certain functions, such as `DualVectorSpace`, may fail when given as input a space of modular symbols over a field of positive characteristic, because the Hecke operators $T_p$, with $p$ prime to the level, need not be semisimple.

### `ModularSymbols(N): RngIntElt -> ModSym`

The space of modular symbols of level $N$, weight $2$, and trivial character over the rational numbers.

### `ModularSymbols(N, k): RngIntElt, RngIntElt -> ModSym`

The space of modular symbols of level $N$, weight $k$, and trivial character over the rational numbers.

### `ModularSymbols(N, k, F): RngIntElt, RngIntElt, Fld -> ModSym`

The space of modular symbols of level $N$, weight $k$, and trivial character over the field $F$.

### `ModularSymbols(N, k, sign): RngIntElt, RngIntElt, RngIntElt -> ModSym`

The space of modular symbols of level $N$, weight $k$, trivial character, and given $sign$ (as an integer) over the rational numbers.

### `ModularSymbols(N, k, F, sign): RngIntElt, RngIntElt, Fld, RngIntElt -> ModSym`

The space of modular symbols of level $N$, weight $k$, trivial character, and given $sign$ (as an integer), over the field $F$.

### `ModularSymbols(eps, k): GrpDrchElt, RngIntElt -> ModSym`

The space of modular symbols of weight $k$ and character $\varepsilon$ (as an element of a Dirichlet group). Note that $\varepsilon$ determines the level and the base field, so they do not need to be specified.

### `ModularSymbols(eps, k, sign): GrpDrchElt, RngIntElt, RngIntElt -> ModSym`

The space of modular symbols of weight $k$ and character $\varepsilon$ (as an element of a Dirichlet group). The level and base field are specified as part of $\varepsilon$. The third argument “sign” allows for working in certain quotients. The possible values are $-1$, $0$, and $+1$, which correspond to the $-1$ quotient, full space, and $+1$ quotient, respectively. The $+1$ quotient of $M$ is $M/(*-1)M$, where $*$ is `StarInvolution(M)`.

### `Example: Creation Ambient (ex-3cf3aa)`

We create spaces of modular symbols in several different ways.

```magma
> M37 := ModularSymbols(37); M37;
Full modular symbols space for Gamma_0(37) of weight 2 and dimension 5
over Rational Field
> Basis(M37);
[
    {-1/29, 0},
    {-1/22, 0},
    {-1/12, 0},
    {-1/18, 0},
    {oo, 0}
]

```

As `M37` is a space of modular symbols, it is not incorrect that its dimension is different than that of the three-dimensional space of modular forms $M_{2}(\Gamma_0(37))$. We have

$$
\dim \bf M_{2}(\Gamma_0(37)) = 2\times {\rm (dim\,\, cusp\,\, forms)} +
            1\times {\rm (dim\,\, Eisenstein\,\, series)} = 5.
$$

```magma
> MF := ModularForms(Gamma0(37),2);
> 2*Dimension(CuspidalSubspace(MF)) + Dimension(EisensteinSubspace(MF));
5

```

Next we decompose `M37` with respect to the Hecke operators $T_2$, $T_3$, and $T_5$.

```magma
> D := Decomposition(M37,5); D;
[
     Modular symbols space for Gamma_0(37) of weight 2 and dimension 1
     over Rational Field,
     Modular symbols space for Gamma_0(37) of weight 2 and dimension 2
     over Rational Field,
     Modular symbols space for Gamma_0(37) of weight 2 and dimension 2
     over Rational Field
]

```

The first factor corresponds to the standard Eisenstein series, and the second corresponds to an elliptic curve:

```magma
> E := EllipticCurve(D[2]); E;
Elliptic Curve defined by y^2 + y = x^3 + x^2 - 23*x - 50 over
Rational Field
> Rank(E);
0

```

We now create the space $\bf M_{12}(1)$ of weight $12$ modular symbols of level $1$.

```magma
> M12 := ModularSymbols(1,12); M12;
Full modular symbols space for Gamma_0(1) of weight 12 and dimension 3
over Rational Field
> Basis(M12);
[
    X^10*{0, oo},
    X^8*Y^2*{0, oo},
    X^9*Y*{0, oo}
]

```

```magma
> DimensionCuspFormsGamma0(1,12);
1
> R<z>:=PowerSeriesRing(Rationals());
> Delta(z)+ O(z^7);
z - 24*z^2 + 252*z^3 - 1472*z^4 + 4830*z^5 - 6048*z^6 + O(z^7)

```

As a module, cuspidal modular symbols equal cuspforms with multiplicity two.

```magma
> M12 := ModularSymbols(1,12);
> HeckeOperator(CuspidalSubspace(M12),2);
[-24   0]
[  0 -24]
>  qExpansionBasis(CuspidalSubspace(M12),7);
[
    q - 24*q^2 + 252*q^3 - 1472*q^4 + 4830*q^5 - 6048*q^6 + O(q^7)
]

```

For efficiency purposes, since one is often interested only in $q$-expansion, it is possible to work in the quotient of the space of modular symbols by all relations $*x = x$ (or $*x=-x$), where $*$ is `StarInvolution(M)`. In either of these quotients (except possibly in characteristic $p>0$) the cusp forms appear with multiplicity one instead of two.

```magma
> M12plus := ModularSymbols(1,12,+1);
> Basis(M12plus);
[
    X^10*{0, oo},
    X^8*Y^2*{0, oo}
]
> CuspidalSubspace(M12plus);
Modular symbols space for Gamma_0(1) of weight 12 and dimension 1 over
Rational Field
> qExpansionBasis(CuspidalSubspace(M12),7);
[
    q - 24*q^2 + 252*q^3 - 1472*q^4 + 4830*q^5 - 6048*q^6 + O(q^7)
]

```

The following is an example of how to create Dirichlet characters in Magma, and how to create a space of modular symbols with nontrivial character. For more details, see Section [Dirichlet Characters](../../BasicRings/ResidueClassRings/dirichlet-characters.md#rngint-dirichlet).

```magma
> G<a,b,c> := DirichletGroup(16*7,CyclotomicField(EulerPhi(16*7)));
> Order(a);
2
> Conductor(a);
4
> Order(b);
4
> Conductor(b);
16
> Order(c);
6
> Conductor(c);
7
> eps := a*b*c;
> M := ModularSymbols(eps,2); M;
Full modular symbols space of level 112, weight 2, character a*b*c,
and dimension 32 over Cyclotomic Field of order 48 and degree 16
> BaseField(M);
Cyclotomic Field of order 48 and degree 16

```

## Labels

It is also possible to create many spaces of modular symbols for $\Gamma_0(N)$ by passing a “descriptive label” as an argument to `ModularSymbols`. The most specific label is a string of the form `[Level]k[Weight][IsogenyClass]`, where `[Level]` is the level, `[Weight]` is the weight, `[IsogenyClass]` is a letter code: `A`, `B`, …, `Z`, `AA`, `BB`, …, `ZZ`, `AAA`, …, and `k` is a place holder to separate the level and the weight. If the label is `[Level][IsogenyClass]`, then the weight $k$ is assumed equal to $2$. If the label is `[Level]k[Weight]` then the cuspidal subspace of the full ambient space of modular symbols of weight $k$ and level $N$ is returned. The following are valid labels: `11A`, `37B`, `3k12A`, `11k4`. The ordering used on isogenies classes is `lt`; see the documentation for `SortDecomposition`.

**Note:** There is currently no intrinsic that, given a space of modular symbols, returns its label.

**Warning:** For $146$ of the levels between $56$ and $450$, our ordering of weight $2$ rational newforms disagrees with the ordering used in [[Cremona, 1997](../../references.md#cite-cremona-algs)]. Fortunately, it is easy to create a space of modular symbols from one of Cremona’s labels using the associated elliptic curve.

```
> E  := EllipticCurve(CremonaDatabase(),"56A");
> M1 := ModularSymbols(E);

```

Observe that Cremona’s `"56A"` is different from ours.

```
> M2 := ModularSymbols("56A");
> M2 eq M1;
false

```

### `ModularSymbols(s, sign): MonStgElt, RngIntElt -> ModSym`

### `ModularSymbols(s): MonStgElt -> ModSym`

The space of modular symbols described by a label, the string $s$, and given $sign$.

### `Example: Creation Spaces (ex-999030)`

The cusp form $\Delta(q)$ is related to the space of modular symbols whose label is `"1k12A"`.

```magma
> Del := ModularSymbols("1k12A"); Del;
Modular symbols space for Gamma_0(1) of weight 12 and dimension 2 over
Rational Field
> qEigenform(Del,5);
q - 24*q^2 + 252*q^3 - 1472*q^4 + O(q^5)

```

Next, we create the space corresponding to the first newform on $\Gamma_0(11)$ of weight $4$.

```magma
> M := ModularSymbols("11k4A"); M;
Modular symbols space for Gamma_0(11) of weight 4 and dimension 4 over
Rational Field
> AmbientSpace(M);
Full modular symbols space for Gamma_0(11) of weight 4 and dimension 6
over Rational Field
> qEigenform(M,5);
q + a*q^2 + (-4*a + 3)*q^3 + (2*a - 6)*q^4 + O(q^5)
> Parent($1);
Power series ring in q over Univariate Quotient Polynomial Algebra in
a over Rational Field with modulus a^2 - 2*a - 2

```

We next create the $+1$ quotient of the cuspidal subspace of weight-$4$ modular symbols of level $37$.

```magma
> M := ModularSymbols("37k4",+1); M;
Modular symbols space for Gamma_0(37) of weight 4 and dimension 9 over
Rational Field
> AmbientSpace(M);
Full modular symbols space for Gamma_0(37) of weight 4 and dimension
11 over Rational Field
> Factorization(CharacteristicPolynomial(HeckeOperator(M,2)));
[
    <x^4 + 6*x^3 - x^2 - 16*x + 6, 1>,
    <x^5 - 4*x^4 - 21*x^3 + 74*x^2 + 102*x - 296, 1>
]

```

## Creation of Elements

Suppose $M$ is a space of weight $k$ modular symbols over a field $F$. A modular symbol $P(X,Y)\{\alpha,\beta\}$ is input as `M!<P(X,Y),[alpha,beta]>`, where $P(X,Y)\in{}F[X,Y]$ is homogeneous of degree $k-2$, and $\alpha, \beta\in \bf P^1({\mathbb{Q}})$. Here is an example:

### `Example: Creation Elements 1 (ex-c14194)`

First create the space $M = \bf M_4(\Gamma_0(3);{\mathbb{F}}_7)$.

```magma
> F7 := GF(7);
> M := ModularSymbols(3,4,F7);
> R<X,Y> := PolynomialRing(F7,2);

```

Now we input $(X^2-2XY)\{0,1\}$.

```magma
> M!<X^2-2*X*Y,[Cusps()|0,1]>;
6*Y^2*{oo, 0}

```

Note that $(X^2-2XY)\{0,1\} = 6Y^2\{\infty,0\}$ in $M$.

When $k=2$, simply enter `M!<1,[alpha,beta]>`.

```magma
> M := ModularSymbols(11,2);
> M!<1,[Cusps()|0,Infinity()]>;
-1*{oo, 0}
> M![<1,[Cusps()|0,Infinity()]>, <1,[Cusps()|0,1/11]>];
-2*{oo, 0}

```

Any space $M$ of modular symbols is finitely generated. One proof of this uses that every modular symbol is a linear combination of *Manin symbols*. Let $\bf P^1({\mathbb{Z}}/N{\mathbb{Z}})$ be the set of pairs $(\overline{u},\overline{v}) \in {\mathbb{Z}}/N{\mathbb{Z}}\times {\mathbb{Z}}N{\mathbb{Z}}$ such that ${\rm GCD}(u,v,N)=1$, where $u$ and $v$ are lifts of $\overline{u}$ and $\overline{v}$ to ${\mathbb{Z}}$. A Manin symbols $\langle P(X,Y),(\overline{u},\overline{v})\rangle$ is a pair consisting of a homogeneous polynomial $P(X,Y)\in F[X,Y]$ of degree $k-2$ and an element $(\overline{u},\overline{v})\in \bf P^1({\mathbb{Z}}/N{\mathbb{Z}})$. The modular symbol associated to $\langle P(X,Y),(\overline{u},\overline{v})\rangle$ is constructed as follows. Choose lifts $u,v$ of $\overline{u},\overline{v}$ such that ${\rm GCD}(u,v)=1$. Then there is a matrix $g=\begin{pmatrix}w&z\\ u&v\end{pmatrix}$ in ${\operatorname{SL}}_2({\mathbb{Z}})$ whose lower two entries are $u$ and $v$. The modular symbol is then $g(P(X,Y)\{0,\infty\})$. The intrinsic `ConvertFromManinSymbol` computes the modular symbol attached to a Manin symbol. Ever modular symbol can be written as a linear combination of Manin symbols using the intrinsic `ManinSymbol`.

### `Example: Representation Conversion (ex-b624a4)`

In this example, we convert between Manin and modular symbols representations of a few elements of a space of modular symbols of weight $4$ over ${\mathbb{F}}_5$.

```magma
> F5 := GF(5);
> M := ModularSymbols(6,4,F5);
> R<X,Y> := PolynomialRing(F5,2);
> ConvertFromManinSymbol(M,<X^2+Y^2,[1,4]>);
(3*X^2 + 3*X*Y + 2*Y^2)*{-1/2, 0} + (X^2 + 4*X*Y + 4*Y^2)*{-1/3, 0} +
(X^2 + X*Y + 4*Y^2)*{1/3, 1/2}
> ManinSymbol(M.1-3*M.2);
[
    <X^2, (0 1)>,
    <2*X^2, (1 2)>
]

```

Thus the element `M.1-3*M.2` of $M$ corresponds to the sum of Manin symbols $\langle X^2, (0,1)\rangle + 2\langle X^2,(1,2)\rangle$.

### `M ! x: ModSym, . -> ModSymElt`

The coercion of $x$ into the space of modular symbols $M$. Here $x$ can be either a modular symbol that lies in a subspace of $M$, a $2$-tuple that describes a modular symbol, a sequence of such $2$-tuples, or anything that can be coerced into `VectorSpace(M)`. If $x$ is a valid sequence of such $2$-tuples, then `M!x` is the sum of the coercions into $M$ of the elements of the sequence $x$.

### `ConvertFromManinSymbol(M, x): ModSym, Tup -> ModSymElt`

The modular symbol associated to the $2$-tuple $x = \langle P(X,Y),[u,v] \rangle$, where $P(X,Y) \in F[X,Y]$ is homogeneous of degree $k-1$, $F$ is the base field of the space of modular symbols $M$, and $[u,v]$ is a sequence of $2$ integers that defines an element of $\bf P^1({\mathbb{Z}}/N{\mathbb{Z}})$, where $N$ is the level of $M$.

### `ManinSymbol(x): ModSymElt -> SeqEnum`

An expression for the modular symbol $x$ in terms of Manin symbols, which are represented as $2$-tuples $\langle P(X,Y),[u,v] \rangle$.

### `Example: Creation Elements 2 (ex-4a3707)`

```magma
> M := ModularSymbols(14,2); M;
Full modular symbols space for Gamma_0(14) of weight 2 and dimension 5
over Rational Field
> Basis(M);
[
    {oo, 0},
    {-1/8, 0},
    {-1/10, 0},
    {-1/12, 0},
    {-1/2, -3/7}
]
> M!<1,[1,0]>;
0
> M!<1,[0,1/11]>;
{-1/10, 0} + -1*{-1/12, 0}
> M![<1,[0,1/2]>, <-1,[0,1/7]>];              // sequences are added
{-1/8, 0} + -1*{-1/12, 0} + -1*{-1/2, -3/7}
> M!<1,[0,1/2]> - M!<1,[0,1/7]>;
{-1/8, 0} + -1*{-1/12, 0} + -1*{-1/2, -3/7}
> M!<1,[Cusps()|Infinity(),0]>;               // Infinity() is in Cusps().
{oo, 0}

```

We can also coerce sequences into the underlying vector space of M.

```magma
> VectorSpace(M);
Full Vector space of degree 5 over Rational Field
Mapping from: Full Vector space of degree 5 over Rational Field to
ModSym: M given by a rule [no inverse]
Mapping from: ModSym: M to Full Vector space of degree 5 over Rational
Field given by a rule [no inverse]
> Eltseq(M.3);
[ 0, 0, 1, 0, 0 ]
> M![ 0, 0, 1, 0, 0 ];
{-1/10, 0}
> M.3;
{-1/10, 0}

```

The “polynomial coefficients” of the modular symbols are homogeneous polynomials in $2$ variables of degree $k-2$.

```magma
> M := ModularSymbols(1,12);
> Basis(M);
[
    X^10*{0, oo},
    X^8*Y^2*{0, oo},
    X^9*Y*{0, oo}
]
> R<X,Y> := PolynomialRing(Rationals(),2);
> M!<X^9*Y,[Cusps()|0,Infinity()]>;
X^9*Y*{0, oo}
> M!<X^7*Y^3,[Cusps()|0,Infinity()]>;
-25/48*X^9*Y*{0, oo}
> Eltseq(M!<X*Y^9,[1/3,1/2]>);
[ -19171, -58050, -30970 ]
> M![1,2,3];
X^10*{0, oo} + 2*X^8*Y^2*{0, oo} + 3*X^9*Y*{0, oo}
> ManinSymbol(M![1,2,3]);
[
    <X^10, (0 1)>,
    <2*X^8*Y^2, (0 1)>,
    <3*X^9*Y, (0 1)>
]

```
