Ask Your Question

Revision history [back]

John Cremona's solution will work, but you can get to the answer a little more quickly as follows:

┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.2, Release Date: 2020-10-24                     │
│ Using Python 3.8.5. Type "help()" for help.                        │
└────────────────────────────────────────────────────────────────────┘
sage: N = 120                                                                                                                        
sage: Newforms(N)                                                                                                                    
[q + q^3 - q^5 + O(q^6), q + q^3 + q^5 + O(q^6)]

The weight defaults to 2, but you can ask for larger weights with Newforms(2, weight=6) etc. If there isn't a basis of newforms with coefficients in QQ, which happens most of the time for larger weights and levels, you need to give it a name to use for the coefficient fields:

sage: Newforms(1000,names='a')                                                                                                       
[q + a0*q^3 + O(q^6),
 q - a1*q^3 + O(q^6),
 q + a2*q^3 + O(q^6),
 q - 1/2*a3*q^3 + O(q^6),
 q + a4*q^3 + O(q^6),
 q + a5*q^3 + O(q^6),
 q + a6*q^3 + O(q^6),
 q - a7*q^3 + O(q^6)]
sage: f = _[0]; f.hecke_eigenvalue_field()                                                                                           
Number Field in a0 with defining polynomial x^2 + x - 1

(Exercise for the reader: why do all of these forms have $a_2 = 0$?)

John Cremona's solution will work, but you can get to the answer a little more quickly as follows:

┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.2, Release Date: 2020-10-24                     │
│ Using Python 3.8.5. Type "help()" for help.                        │
└────────────────────────────────────────────────────────────────────┘
sage: N = 120                                                                                                                        
sage: Newforms(N)                                                                                                                    
[q + q^3 - q^5 + O(q^6), q + q^3 + q^5 + O(q^6)]

The weight defaults to 2, but you can ask for larger weights with Newforms(2, weight=6) etc. If there isn't a basis of newforms with coefficients in QQ, which happens most of the time for larger weights and levels, you need to give it a name to use for the coefficient fields:

sage: Newforms(1000,names='a')                                                                                                       
[q + a0*q^3 + O(q^6),
 q - a1*q^3 + O(q^6),
 q + a2*q^3 + O(q^6),
 q - 1/2*a3*q^3 + O(q^6),
 q + a4*q^3 + O(q^6),
 q + a5*q^3 + O(q^6),
 q + a6*q^3 + O(q^6),
 q - a7*q^3 + O(q^6)]
sage: f = _[0]; f.hecke_eigenvalue_field()                                                                                           
Number Field in a0 with defining polynomial x^2 + x - 1

(Exercise for the reader: why do all of these forms have $a_2 = 0$?)no $q^2$ term?)