I am beginning to learn SAGE. I have been working on a project that requires me to have an (orthogonal) eigenbasis for $S_2^{\text{new}}(\Gamma_0(N))$. Is there an easy way to get that?

I think I can use ~~CuspForms(Gamma0(N),2).new_submodule().hecke_matrix(p) ~~`CuspForms(Gamma0(N),2).new_submodule().hecke_matrix(p)`

(for many primes) with some linear algebra to, after some effort, build an eigenbasis. But since this is something basic in the theory of modular forms, I thought it would be already implemented in SAGE (but I could not find it). Is that so?

edit:----

Thank you very much for the answers below, I am about to accept them. Though, I have been trying to use those routines and encountered some issues. In some cases, they don't seem to give me all newforms. I am trying to understand why. For example, for N=89, k=2

```
sage: S_new = CuspForms(89,2).new_submodule()
sage: S_new.dimension()
7
sage: Newforms(89,names='a')
[q - q^2 - q^3 - q^4 - q^5 + O(q^6),
q + q^2 + 2*q^3 - q^4 - 2*q^5 + O(q^6),
q + a2*q^2 + (-1/2*a2^4 + 1/2*a2^3 + 7/2*a2^2 - 5/2*a2 - 4)*q^3 + (a2^2 - 2)*q^4 + (-a2^2 + 4)*q^5 + O(q^6)]
```

Why does it not calculate the remaining eigenforms in this case? Is it because the coefficient fields are too complicated? LMFDB says one of them has degree 140 https://www.lmfdb.org/ModularForm/GL2/Q/holomorphic/?level=89&weight=2&search_type=List

Using Cremona's answer with ~~(...).q_eigenform(50,names='a') ~~`d.q_eigenform(50,names='a')`

yields the same.

I see that I can change the base field to $\bar{\mathbb{Q}}$ to get the full collection:

```
sage: Newforms(89,names='a',base_ring=QQbar)
[q - 2.47725271?*q^2 - 2.759353854?*q^3 + 4.1367810?*q^4 - 2.13678098?*q^5 + O(q^6),
q - 2.098127745?*q^2 + 2.3452649700?*q^3 + 2.402140034?*q^4 - 0.402140035?*q^5 + O(q^6),
q - q^2 - q^3 - q^4 - q^5 + O(q^6),
q - 0.74595374?*q^2 - 0.54990973?*q^3 - 1.44355303?*q^4 + 3.44355303?*q^5 + O(q^6),
q + 1.00000000000000?*q^2 + 2.00000000000000?*q^3 - 1.00000000000000?*q^4 - 2.00000000000000?*q^5 + O(q^6),
q + 1.62790662528?*q^2 - 0.14890720385?*q^3 + 0.6500799807?*q^4 + 1.34992001936?*q^5 + O(q^6),
q + 2.693427562?*q^2 - 1.8870941866?*q^3 + 5.254552031?*q^4 - 3.254552031?*q^5 + O(q^6)]
```

But then I have to work with these approximation and lose some information. For example, I cannot recover the Hecke eigenvalue fields from these forms.

I think one solution would be to compute the eigenvalues of the Hecke matrixes (say, for the rational basis that SAGE gives me via ~~CuspForms(89,2).basis()). ~~`CuspForms(89,2).basis()`

). And then try to recover the coefficient fields from them. To ~~then ~~finally use ~~Newforms(89,names='a',base_ring=K), ~~`Newforms(89,names='a',base_ring=K)`

with K being the compositum of coefficient fields. The problem is that it takes too long in cases like this one.

I am wondering if that is all that I can do in this case? Or maybe there is a better way to use those commands, ~~that ~~to avoids these issues?