# $q$-Expansions

The following functions should only be called on modular symbols spaces that are cuspidal. For $q$-expansions of Eisenstein series, use the modular forms functions instead (see the example below).

## `Eigenform(M, prec): ModSym, RngIntElt -> RngSerPowElt`

## `Eigenform(M): ModSym -> RngSerPowElt`

## `qEigenform(M, prec): ModSym, RngIntElt -> RngSerPowElt`

## `qEigenform(M): ModSym -> RngSerPowElt`

## `PowerSeries(M, prec): ModSym, RngIntElt -> RngSerPowElt`

## `PowerSeries(M): ModSym -> RngSerPowElt`

The $q$-expansion of one of the Galois-conjugate newforms associated to the irreducible cuspidal space $M$ of modular symbols, computed to absolute precision $prec$ (which defaults to the highest precision computed in previous calls to this intrinsic, or $8$ if none have been computed). The coefficients of the $q$-expansion lie in a quotient of a polynomial extension of the base field of $M$. In most cases, it is necessary for $M$ to have been defined using `NewformDecomposition`.

## `qExpansionBasis(M, prec : parameters): ModSym, RngIntElt -> SeqEnum`

```magma
Al: MonStgElt                    Default: "Newform"
```

The reduced row-echelon basis of $q$-expansions for the space of modular forms associated to $M$, where $K$ is the base field of $M$. The absolute precision of the $q$-expansions is $prec$.

The optional parameter `Al` can take the values `"Newform"` and `"Universal"`. The default is `"Newform"`, which computes a basis of $q$-expansions by finding a decomposition of $M$ into subspaces corresponding to newforms, computing their $q$-expansions, and then taking all of their images under the degeneracy maps. If `Al := "Universal"` then the algorithm of Section 4.3 of [[Merel, 1994](../../references.md#cite-merel1585)] is used. This latter algorithm does not require computing a newform decomposition of $M$, but requires computing the action of many more Hecke operators. Consequently, in practice, our implementation of Merel’s algorithm is usually less efficient than our implementation of the newform algorithm.

## `qIntegralBasis(M): ModSym -> SeqEnum`

## `qIntegralBasis(M, prec): ModSym, RngIntElt -> SeqEnum`

## `qIntegralBasis(seq, prec): [ModSym], RngIntElt -> SeqEnum`

```magma
Al: MonStgElt                    Default: "Newform"
```

The reduced integral basis of $q$-expansions for the space of modular forms associated to the given space $M$ of modular symbols (or the given sequence of spaces). The q-expansions are computed to absolute precision $prec$. The base field of $M$ must be either the rationals or a cyclotomic field.

## `SystemOfEigenvalues(M, prec): ModSym, RngIntElt -> SeqEnum`

The sequence of Hecke eigenvalues $[a_2, a_3, a_5, a_7, \ldots, a_p]$ attached to the space of modular symbols $M$, where $p$ is the largest prime less than or equal to $prec$. Let $K$ be the base field of $M$. Then the $a_\ell$ either lie in $K$ or an extension of $K$ (which may be constructed either as a number field or as a quotient of $K[x]$). We assume that $M$ corresponds to a single Galois-conjugacy class of newforms.

## `Example: q Expansions (ex-cb0791)`

First we compute a $q$-basis and a representative newform for the two-dimensional space $S_2(\Gamma_0(23))$. We work in the $+1$ quotient of modular symbols since, for the purpose of computing $q$-expansions, nothing is lost and many algorithms are more efficient.

```magma
> M := CuspidalSubspace(ModularSymbols(23,2, +1));
> qExpansionBasis(M);
[
    q - q^3 - q^4 - 2*q^6 + 2*q^7 + O(q^8),
    q^2 - 2*q^3 - q^4 + 2*q^5 + q^6 + 2*q^7 + O(q^8)
]
> f := qEigenform(M,6); f;
q + a*q^2 + (-2*a - 1)*q^3 + (-a - 1)*q^4 + 2*a*q^5 + O(q^6)
> Parent(f);
Power series ring in q over Univariate Quotient Polynomial Algebra
in a over Rational Field with modulus a^2 + a - 1
> PowerSeries(M);
q + a*q^2 + (-2*a - 1)*q^3 + (-a - 1)*q^4 + 2*a*q^5 + (a - 2)*q^6 +
    (2*a + 2)*q^7 + O(q^8)
> SystemOfEigenvalues(M, 7);
[
    a,
    -2*a - 1,
    2*a,
    2*a + 2
]

```

Next we compare an integral and rational basis of $q$-expansions for $S_2(\Gamma_0(65))$, computed using modular symbols.

```magma
> S := CuspidalSubspace(ModularSymbols(65,2,+1));
> qExpansionBasis(S);
[
    q + 1/3*q^6 + 1/3*q^7 + O(q^8),
    q^2 - 1/3*q^6 + 2/3*q^7 + O(q^8),
    q^3 - 4/3*q^6 + 2/3*q^7 + O(q^8),
    q^4 - 1/3*q^6 + 5/3*q^7 + O(q^8),
    q^5 + 5/3*q^6 + 2/3*q^7 + O(q^8)
]
> qIntegralBasis(S);
[
    q + q^5 + 2*q^6 + q^7 + O(q^8),
    q^2 + 2*q^5 + 3*q^6 + 2*q^7 + O(q^8),
    q^3 + 2*q^5 + 2*q^6 + 2*q^7 + O(q^8),
    q^4 + 2*q^5 + 3*q^6 + 3*q^7 + O(q^8),
    3*q^5 + 5*q^6 + 2*q^7 + O(q^8)
]

```

If you’re interested in $q$-expansions of Eisenstein series, see the chapter on modular forms. For example:

```magma
> E := EisensteinSubspace(ModularForms(65,2));
> Basis(E);
[
    1 + O(q^8),
    q + 3*q^2 + 4*q^3 + 7*q^4 + 12*q^6 + 8*q^7 + O(q^8),
    q^5 + O(q^8)
]

```
