# Bases

Any space of modular forms that can be created in Magma is of the form $M_{\mathbb{Z}}{\otimes}_{{\mathbb{Z}}} R$ for some ring $R$ and some space $M_{\mathbb{Z}}$ of modular forms defined over ${\mathbb{Z}}$. The basis of $M$ is the image in $M$ of `Basis(M_Z)`, and `Basis(M_Z)` is in Hermite normal form.

Note that in order to determine this basis over ${\mathbb{Z}}$, it is necessary to compute $q$-expansions up to a “Sturm bound” for $M$ (see `PrecisionBound)`. The precision used internally will therefore be at least as large as this bound. If desired, however, one can compute q-expansions to lower precision by working directly with spaces of modular symbols.

## `Basis(M): ModFrm -> SeqEnum`

The canonical basis of the space of modular forms or half-integral weight forms $M$.

## `Basis(M, prec): ModFrm, RngIntElt -> [RngSerPowElt]`

## `qExpansionBasis(M, prec): ModFrm, RngIntElt -> [RngSerPowElt]`

A sequence containing q-expansions (to the specified precision) of the elements of `Basis(M)`.

## `PrecisionBound(M : parameters): ModFrm -> RngIntElt`

```magma
Exact: BoolElt                    Default: false
```

An integer $b$ such that $f + O(q^b)$ determines any modular form $f$ in the given space $M$ of modular forms or half-integral weight forms. If the optional parameter `Exact` is set to `true`, or if a q-expansion basis has already been computed for $M$, then the result is best-possible, ie the *smallest* integer $b$ such that $f+O(q^b)$ determines any modular form $f$ in $M$. Otherwise it is a “Sturm bound” similar to (although in some cases sharper than) the bounds given in section 9.4 of [[Stein, 2007](../../references.md#cite-stein-modular-forms-book)].

*Note:* In some much older versions of Magma the default was `Exact := true`.

## `RModule(M): ModFrm -> ModTupRng, Map`

## `RSpace(M): ModFrm -> ModTupRng, Map`

## `VectorSpace(M): ModFrm -> ModTupRng, Map`

```magma
Ring: Rng                    Default: 
```

An abstract free module isomorphic to the given space of modular forms M, over the same base ring (unless `Ring` is specified). The second returned object is a map from the abstract module to/from M.

This function is needed when one wants to use linear algebra functions on $M$ (since in Magma, a space of modular forms is not a subtype of vector space).

## `Example: Bases (ex-fd9bbd)`

```magma
> M := ModularForms(Gamma1(16),3); M;
Space of modular forms on Gamma_1(16) of weight 3 and dimension 23
over Integer Ring.
> Dimension(CuspidalSubspace(M));
9
> SetPrecision(M,19);
> Basis(NewSubspace(CuspidalSubspace(M)))[1];
q - 76*q^8 + 39*q^9 + 132*q^10 - 44*q^11 + 84*q^12 - 144*q^13 -
232*q^14 + 120*q^15 + 160*q^16 + 158*q^17 - 76*q^18 + O(q^19)

```

We can print the whole basis to less precision:

```magma
> SetPrecision(M,10);
> Basis(NewSubspace(CuspidalSubspace(M)));
[
    q - 76*q^8 + 39*q^9 + O(q^10),
    q^2 + q^7 - 58*q^8 + 30*q^9 + O(q^10),
    q^3 + 2*q^7 - 42*q^8 + 18*q^9 + O(q^10),
    q^4 + q^7 - 26*q^8 + 13*q^9 + O(q^10),
    q^5 + 2*q^7 - 18*q^8 + 5*q^9 + O(q^10),
    q^6 + 2*q^7 - 12*q^8 + 3*q^9 + O(q^10),
    3*q^7 - 8*q^8 + O(q^10)
]

```

Note the coefficient $3$ of $q^7$, which emphasizes that this is not the reduced echelon form over a field, but the image of a reduced form over the integers:

```magma
> MQ := BaseExtend(M,RationalField());
> Basis(NewSubspace(CuspidalSubspace(MQ)))[7];
3*q^7 - 8*q^8 + O(q^10)

```
