---
title: "Bases"
canonical: "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/ModularForms/Bases.html"
source: "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/ModularForms/Bases.md"
part: "Modular Arithmetic Geometry"
chapter: "Modular Forms"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Modular Arithmetic Geometry", "source": "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/index-modular-arithmetic-geometry.md"}
  - {"title": "Modular Forms", "source": "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/ModularForms/index-modular-forms.md"}
prev: {"title": "Creation Functions", "source": "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/ModularForms/creation.md"}
next: {"title": "$q$-Expansions", "source": "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/ModularForms/q-expansions.md"}
intrinsics:
  - {"name": "Basis", "signature": "Basis(M): ModFrm -> SeqEnum"}
  - {"name": "Basis", "signature": "Basis(M, prec): ModFrm, RngIntElt -> [RngSerPowElt]"}
  - {"name": "qExpansionBasis", "signature": "qExpansionBasis(M, prec): ModFrm, RngIntElt -> [RngSerPowElt]"}
  - {"name": "PrecisionBound", "signature": "PrecisionBound(M : parameters): ModFrm -> RngIntElt"}
  - {"name": "RModule", "signature": "RModule(M): ModFrm -> ModTupRng, Map"}
  - {"name": "RSpace", "signature": "RSpace(M): ModFrm -> ModTupRng, Map"}
  - {"name": "VectorSpace", "signature": "VectorSpace(M): ModFrm -> ModTupRng, Map"}
examples:
  - "ex-fd9bbd"
---

<a id="modfrm-bases"></a>
<a id="id1"></a>
# 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.

<a id="function-basis-modfrm"></a>
## `Basis(M): ModFrm -> SeqEnum`

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

<a id="function-basis-modfrm-rngintelt"></a>
## `Basis(M, prec): ModFrm, RngIntElt -> [RngSerPowElt]`

<a id="function-qexpansionbasis-modfrm-rngintelt"></a>
## `qExpansionBasis(M, prec): ModFrm, RngIntElt -> [RngSerPowElt]`

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

<a id="function-precisionbound-modfrm"></a>
## `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 [[Ste07](https://docs.magma-maths.org/v2.30-1/references.md#cite-stein-modular-forms-book)].

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

<a id="function-rmodule-modfrm"></a>
## `RModule(M): ModFrm -> ModTupRng, Map`

<a id="function-rspace-modfrm"></a>
## `RSpace(M): ModFrm -> ModTupRng, Map`

<a id="function-vectorspace-modfrm"></a>
## `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).

<a id="example-ex-fd9bbd"></a>
## `Example: Basis of a Cuspidal New Subspace (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)
```
