Base of Eigenforms
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)
(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. However, I have been trying to use those commands and encountered some issues. In some cases, they don't seem to give me a complete basis. 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...
Using Cremona's answer with d.q_eigenform(50,names='a')
yields the same.
I see that I can change the base field to $\overline{\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 approximations 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()
). And then try to recover the coefficient fields from them. To finally use 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, to avoids these issues?
Three comments on your edited question: (1) It's considered rather bad manners to edit a question after it's been answered.
(2) As you can see in the documentation, the "Newforms" command returns one from each Galois orbit of newforms. In the first of your added examples,
q + a2*q^2 + (-1/2*a2^4 +
, the number field generated by $a_2$ can be embedded into CC in 5 different ways and these fill up the space.(3) Sage's
QQbar
class does not lose information via inexact approximations.QQbar
is notCC
. Internally, an element ofQQbar
consists of a polynomial with Q coefficients, together with intervals (with exact, rational endpoints) containing the real and imaginary parts of a unique root of that polynomial.Example to show you can recover exact values:
@David Loeffler. Thank you very much! Your comment was incredibly helpful, now I understand how I have to use
Newforms
.My apologies about editing the post with the example. This was my first question here, and I didn't know editing like that was bad manners. Thank you for letting me know.
Would it be better if I edit it again to revert it to its original state? And make that example into a comment?