# Further Examples

## `Example: Integral Hecke (ex-3b8963)`

```magma
> R<x> := PolynomialRing(IntegerRing());
> F := NumberField(x^2-15);  OF := Integers(F);
> M := HilbertCuspForms(F, 1*OF, [2,4]);
> M;
Cuspidal space of Hilbert modular forms over Number Field with defining polynomial
x^2 - 15 over the Rational Field
   Level = Ideal of norm 1 generated by ( [1, 0] )
   Weight = [ 2, 4 ]
> Dimension(M);
2
> T2 := HeckeOperator(M, Factorization(2*OF)[1][1] );
> BaseRing(T2);
Number Field with defining polynomial $.1^2 + 1 over F

```

So the basis used to compute M is over this extension of F. We now replace this with a $F$-rational basis (this is implemented for new spaces, in particular spaces of level $1$).

```magma
> IsNew(M);
true
> SetRationalBasis(M);
> for P in PrimesUpTo(7,F) do
>    Norm(P), HeckeOperator(M,P);
> end for;
2
[  0   1]
[-20   0]
3
[0 0]
[0 0]
5
[  0   4]
[-80   0]
7
[0 0]
[0 0]
7
[0 0]
[0 0]
> #NewformDecomposition(M);
1

```

In general the Hecke matrices would be over $F$, however for this space there is a basis where they have entries in ${\mathbb{Z}}$. The program was able to discover this because the basis is chosen by putting one of the matrices in rational canonical form.

## `Example: Classical Example (ex-c19462)`

It is possible to use this package to compute classical modular forms (although this will usually be much slower). Here we compute the newform of level $14$ three times independently. First we wish to use Algorithm 1, so we choose the quaternion algebra over ${\mathbb{Q}}$ ramified at $2$ and infinity. (Note: Algorithm I is not implemented over `Rationals()`, so we must work over a number field isomorphic to ${\mathbb{Q}}$ instead!)

```magma
> QQ := RationalsAsNumberField();
> ZZ := Integers(QQ);
> M := HilbertCuspForms(QQ, 14*ZZ);
> A := QuaternionAlgebra(2*ZZ, InfinitePlaces(QQ) : Optimized);
> M14 := NewSubspace(M : QuaternionOrder:=MaximalOrder(A) );
> Dimension(M14);
1
> f := Eigenform(NewformDecomposition(M14)[1]);
> primes := PrimesUpTo(50);
> time eigenvalues1:= [ <p, HeckeEigenvalue(f,p*ZZ)> : p in primes ];
Time: 0.220
> eigenvalues1;
[ <2, -1>, <3, -2>, <5, 0>, <7, 1>, <11, 0>, <13, -4>, <17, 6>, <19, 2>, <23, 0>,
  <29, -6>, <31, -4>, <37, 2>, <41, 6>, <43, 8>, <47, -12> ]

```

Now we use Algorithm 2, choosing the indefinite quaternion algebra over ${\mathbb{Q}}$ ramified at $2$ and $7$.

```magma
> Q := Rationals();
> M := HilbertCuspForms(Q, 14);
> A := QuaternionAlgebra(14 : Al:="Smallest" );
> A.1^2, A.2^2;
7, -2
> M14 := NewSubspace(M : QuaternionOrder:=MaximalOrder(A) );
> IsDefinite(M14); // Not definite means Algorithm 2
false
> Dimension(M14);
1
> f := Eigenform(NewformDecomposition(M14)[1]);
> time eigenvalues2 := [ <p, HeckeEigenvalue(f,p)> : p in primes |
>                                                          GCD(p,14) eq 1];
Time: 2.750
> eigenvalues2;
[ <3, -2>, <5, 0>, <11, 0>, <13, -4>, <17, 6>, <19, 2>, <23, 0>,
  <29, -6>, <31, -4>, <37, 2>, <41, 6>, <43, 8>, <47, -12> ]

```

Finally we check both results agree with the standard modular forms package.

```magma
> M14 := CuspForms(14);
> time eigenvalues := [ <p, HeckeOperator(M14,p)[1,1]> : p in primes ];
Time: 0.160
> assert eigenvalues1 eq eigenvalues;
> assert eigenvalues2 subset eigenvalues;

```
