I think the following code block - which comes with more prints than computations - gives the answer to the question. I will use the `a`

from above, by asking sage to construct cusp forms over $K$, where $K$ corresponds to the posted `K.<a> = NumberField( x^2 + x - 1 )`

. (My choice would have been else to work over `K.<a> = QuadraticField(5)`

, so that the Galois conjugation is transparent.)

The many prints in the sequel should make the code self-explanatory. This is rather a long answer, but it may be that the short answer, an all it is needed is the "short answer":

*Use *`CF = CuspForms( 23, base_ring=K )`

and work in this space of cusp forms.

The longer answer now:

```
R.<x> = QQ[]
K.<a> = NumberField( x^2 + x - 1 )
print "a has the charpoly:", a.charpoly()
print "a has the galois conjugate:", a.galois_conjugate()
CF = CuspForms( 23, base_ring=K, prec=12 )
print "CF is\n%s\n" % CF
print "A basis of CF is:\n%s\n" % CF.basis()
print "The following Hecke operators Tp have the eigenvalues..."
for p in primes( 20 ):
Tp = CF.hecke_matrix(p)
print "T(%s) -> %s" % ( p, Tp.eigenvalues() )
print "The Jordan decomposition for T(2) is T(2) = S J S.inverse() with..."
J, S = T2.jordan_form( transformation=True )
print "J is the matrix:\n%s\n" % J
print "S is the matrix:\n%s\n" % S
print "Test for the equality T(2) = S J S.inverse()..."
print "Is T2 = S J S.inverse()? %s" % bool( T2 == S * J * S.inverse() )
print "The columns of S are giving the base change..."
print "\nLet e1, e2 be the base of CF, where:"
e1, e2 = CF.basis()
print "e1 = %s" % e1
print "e2 = %s" % e2
print "\nLet f1, f2 be the corresponding eigenforms:"
f1, f2 = e1 + a*e2, e1 + a.galois_conjugate()*e2
print "f1 = %s" % f1
print "f2 = %s" % f2
print "\n\nThen we have:"
for p in primes( 20 ):
for ev in list( set( CF.hecke_matrix(p).eigenvalues() ) ):
for f in ( f1, f2 ):
Tp_f = CF.hecke_operator(p)(f)
if Tp_f == ev*f:
print ( "%s is an eigenform for T(%s) w.r.t. eigenvalue %s"
% ( 'f1' if f==f1 else 'f2', p, ev ) )
print
```

This gives:

```
a has the charpoly: x^2 + x - 1
a has the galois conjugate: -a - 1
CF is
Cuspidal subspace of dimension 2 of Modular Forms space of dimension 3 for Congruence Subgroup Gamma0(23) of weight 2 over Number Field in a with defining polynomial x^2 + x - 1
A basis of CF is:
[
q - q^3 - q^4 - 2*q^6 + 2*q^7 - q^8 + 2*q^9 + 2*q^10 - 4*q^11 + O(q^12),
q^2 - 2*q^3 - q^4 + 2*q^5 + q^6 + 2*q^7 - 2*q^8 - 2*q^10 - 2*q^11 + O(q^12)
]
The following Hecke operators Tp have the eigenvalues...
T(2) -> [a, -a - 1]
T(3) -> [2*a + 1, -2*a - 1]
T(5) -> [2*a, -2*a - 2]
T(7) -> [2*a + 2, -2*a]
T(11) -> [2*a - 2, -2*a - 4]
T(13) -> [3, 3]
T(17) -> [2*a + 4, -2*a + 2]
T(19) -> [-2, -2]
The Jordan decomposition for T(2) is T(2) = S J S.inverse() with...
J is the matrix:
[ a| 0]
[------+------]
[ 0|-a - 1]
S is the matrix:
[ 1 1]
[ a -a - 1]
Test for the equality T(2) = S J S.inverse()...
Is T2 = S J S.inverse()? True
The columns of S are giving the base change...
Let e1, e2 be the base of CF, where:
e1 = q - q^3 - q^4 - 2*q^6 + 2*q^7 - q^8 + 2*q^9 + 2*q^10 - 4*q^11 + O(q^12)
e2 = q^2 - 2*q^3 - q^4 + 2*q^5 + q^6 + 2*q^7 - 2*q^8 - 2*q^10 - 2*q^11 + O(q^12)
Let f1, f2 be the corresponding eigenforms:
f1 = 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 + (-2*a - 1)*q^8 + 2*q^9 + (-2*a + 2)*q^10 + (-2*a - 4)*q^11 + O(q^12)
f2 = q + (-a - 1)*q^2 + (2*a + 1)*q^3 + a*q^4 + (-2*a - 2)*q^5 + (-a - 3)*q^6 - 2*a*q^7 + (2*a + 1)*q^8 + 2*q^9 + (2*a + 4)*q^10 + (2*a - 2)*q^11 + O(q^12)
Then we have:
f1 is an eigenform for T(2) w.r.t. eigenvalue a
f2 is an eigenform for T(2) w.r.t. eigenvalue -a - 1
f1 is an eigenform for T(3) w.r.t. eigenvalue -2*a - 1
f2 is an eigenform for T(3) w.r.t. eigenvalue 2*a + 1
f2 is an eigenform for T(5) w.r.t. eigenvalue -2*a - 2
f1 is an eigenform for T(5) w.r.t. eigenvalue 2*a
f1 is an eigenform for T(7) w.r.t. eigenvalue 2*a + 2
f2 is an eigenform for T(7) w.r.t. eigenvalue -2*a
f2 is an eigenform for T(11) w.r.t. eigenvalue 2*a - 2
f1 is an eigenform for T(11) w.r.t. eigenvalue -2*a - 4
f1 is an eigenform for T(13) w.r.t. eigenvalue 3
f2 is an eigenform for T(13) w.r.t. eigenvalue 3
f2 is an eigenform for T(17) w.r.t. eigenvalue 2*a + 4
f1 is an eigenform for T(17) w.r.t. eigenvalue -2*a + 2
f1 is an eigenform for T(19) w.r.t. eigenvalue -2
f2 is an eigenform for T(19) w.r.t. eigenvalue -2
```

(The matrices for the Hecke operators differ from the posted ones, since the sage basis differ.)

I hope, this helps to proceed. (It is hard to specifically translate the core of the question "*I have been trying *`k.< a > = NumberField( x^2 + x - 1 )`

, but then I don't know how to proceed with this a.")

A final note: If there is a need for a "ring" to do the computations inside, to test for equalities, to work with matrices over it, *et caetera*, here is the ring:

```
sage: f1.q_expansion().parent()
Power Series Ring in q over Number Field in a with defining polynomial x^2 + x - 1
```

P.S. The question got an 1up, since it gives all needed details in a given interesting number theoretical / modular structure, in a field, which is one of the strengths of sage. Such examples are needed, and the provide the best way to understand sage by math's and/or math's by sage...

The Jordan form for $T_2$ is computed if the matrix is defined over a field where the characteristic polynomial of $T_2$ splits in linear factors. The following worked for me:

In the given case it is better - i think - to have full control over the number field used, adjoining

`a`

is everything we need.`QQbar`

always works instead of the above`S`

.