/* This code can be loaded, or copied and pasted, into Magma. It will load the data associated to the HMF, including the field, level, and Hecke and Atkin-Lehner eigenvalue data. At the *bottom* of the file, there is code to recreate the Hilbert modular form in Magma, by creating the HMF space and cutting out the corresponding Hecke irreducible subspace. From there, you can ask for more eigenvalues or modify as desired. It is commented out, as this computation may be lengthy. */ P := PolynomialRing(Rationals()); g := P![2, 0, -6, -2, 1]; F := NumberField(g); ZF := Integers(F); NN := ideal; primesArray := [ [2, 2, w], [5, 5, -w^3 + 3*w^2 + 2*w - 1], [5, 5, w - 1], [11, 11, w^3 - 2*w^2 - 5*w - 1], [13, 13, -w^3 + 3*w^2 + 3*w - 1], [17, 17, 2*w^3 - 5*w^2 - 9*w + 5], [23, 23, -w^3 + 3*w^2 + 4*w - 5], [25, 5, -w^2 + 3*w + 1], [29, 29, -2*w^3 + 6*w^2 + 5*w - 1], [31, 31, -w^2 + 2*w + 1], [43, 43, -w^3 + 3*w^2 + 2*w - 3], [43, 43, -w^3 + 2*w^2 + 6*w - 3], [59, 59, 2*w^3 - 6*w^2 - 7*w + 7], [73, 73, 3*w^3 - 6*w^2 - 16*w - 5], [79, 79, -5*w^3 + 14*w^2 + 20*w - 17], [81, 3, -3], [83, 83, -w - 3], [83, 83, w^2 - 3*w - 7], [89, 89, w^2 - 2*w - 7], [101, 101, -2*w^3 + 5*w^2 + 8*w - 3], [101, 101, 5*w^3 - 14*w^2 - 19*w + 17], [103, 103, -w^3 + w^2 + 8*w + 3], [103, 103, 2*w^3 - 5*w^2 - 7*w - 1], [109, 109, 3*w^3 - 7*w^2 - 14*w + 1], [109, 109, -w^2 + 4*w + 1], [127, 127, -3*w^3 + 8*w^2 + 11*w - 7], [127, 127, -w^3 + 2*w^2 + 7*w + 1], [137, 137, -2*w^3 + 5*w^2 + 9*w - 1], [139, 139, -w^3 + 3*w^2 + 2*w - 5], [149, 149, w^3 - 3*w^2 - w - 1], [149, 149, -2*w^3 + 4*w^2 + 10*w + 1], [163, 163, w^3 - 4*w^2 - w + 11], [163, 163, 2*w^3 - 4*w^2 - 10*w + 1], [173, 173, -4*w^3 + 11*w^2 + 15*w - 13], [179, 179, 2*w^2 - 6*w - 3], [179, 179, -w^3 + 2*w^2 + 7*w - 1], [181, 181, w^3 - 10*w - 9], [181, 181, -3*w^3 + 8*w^2 + 14*w - 7], [199, 199, w^3 - 8*w - 9], [211, 211, 2*w - 3], [223, 223, -w^3 + 4*w^2 + w - 5], [227, 227, w^3 - 2*w^2 - 5*w - 5], [227, 227, -3*w^3 + 7*w^2 + 14*w - 5], [227, 227, -4*w^3 + 10*w^2 + 19*w - 7], [227, 227, w^2 - 4*w - 5], [239, 239, -2*w^3 + 5*w^2 + 7*w - 3], [251, 251, -w^3 + 4*w^2 + 2*w - 11], [251, 251, 2*w^3 - 6*w^2 - 6*w + 1], [257, 257, -3*w^3 + 6*w^2 + 16*w + 3], [263, 263, -w^3 + 3*w^2 + 3*w - 7], [263, 263, w^3 - 4*w^2 + 7], [269, 269, -2*w^3 + 6*w^2 + 6*w - 11], [269, 269, -w^3 + 4*w^2 - w - 5], [271, 271, -3*w^3 + 9*w^2 + 11*w - 11], [271, 271, w^2 - 5*w - 3], [277, 277, w^3 - 4*w^2 - 2*w + 7], [277, 277, -2*w^3 + 7*w^2 + 8*w - 9], [281, 281, 2*w^2 - 4*w - 5], [281, 281, 2*w^3 - 4*w^2 - 11*w + 1], [283, 283, -3*w^3 + 8*w^2 + 14*w - 11], [293, 293, w^3 - 2*w^2 - 6*w + 5], [307, 307, -2*w^3 + 5*w^2 + 7*w - 1], [313, 313, 2*w^3 - 4*w^2 - 9*w + 3], [313, 313, -2*w^3 + 5*w^2 + 6*w - 3], [317, 317, -2*w^3 + 5*w^2 + 9*w + 1], [347, 347, 4*w^3 - 9*w^2 - 21*w + 3], [347, 347, 4*w^3 - 10*w^2 - 18*w + 5], [349, 349, -2*w^3 + 6*w^2 + 7*w - 3], [353, 353, -w^3 + 12*w + 5], [353, 353, w^2 - w - 7], [359, 359, -2*w^3 + 5*w^2 + 6*w - 7], [359, 359, -w^3 + 4*w^2 - 11], [373, 373, -w^3 + 2*w^2 + 6*w + 5], [379, 379, -3*w^3 + 8*w^2 + 14*w - 5], [397, 397, 6*w^3 - 14*w^2 - 30*w + 7], [401, 401, 3*w^3 - 5*w^2 - 20*w - 7], [409, 409, 3*w^3 - 7*w^2 - 12*w - 3], [409, 409, 2*w^2 - 4*w - 7], [421, 421, w^3 - 11*w - 11], [421, 421, -w^3 + 3*w^2 + w - 7], [431, 431, 2*w^3 - 3*w^2 - 14*w - 3], [431, 431, -4*w^3 + 11*w^2 + 15*w - 15], [433, 433, 2*w^3 - 5*w^2 - 6*w + 1], [439, 439, -4*w^3 + 11*w^2 + 13*w - 9], [439, 439, -2*w^3 + 6*w^2 + 8*w - 11], [443, 443, 2*w - 5], [443, 443, -6*w^3 + 17*w^2 + 24*w - 21], [449, 449, w^3 - 2*w^2 - 8*w + 3], [449, 449, 4*w^3 - 12*w^2 - 15*w + 17], [457, 457, -2*w^3 + 4*w^2 + 9*w + 5], [461, 461, -3*w^3 + 6*w^2 + 15*w - 1], [461, 461, -3*w^3 + 7*w^2 + 17*w + 1], [463, 463, -4*w^3 + 10*w^2 + 17*w - 7], [463, 463, -3*w^3 + 10*w^2 + 9*w - 17], [467, 467, 4*w^3 - 8*w^2 - 21*w - 7], [467, 467, w^3 - 6*w^2 + 3*w + 19], [479, 479, -w^3 + w^2 + 8*w + 1], [487, 487, -4*w^3 + 11*w^2 + 14*w - 15], [487, 487, 3*w^3 - 6*w^2 - 15*w - 5], [491, 491, w^2 - 5], [503, 503, 2*w^3 - 5*w^2 - 11*w + 3], [523, 523, -3*w^3 + 7*w^2 + 13*w + 1], [547, 547, 2*w^3 - 3*w^2 - 12*w - 3], [547, 547, 2*w^3 - 3*w^2 - 12*w - 9], [557, 557, -3*w^3 + 9*w^2 + 9*w - 11], [557, 557, -6*w^3 + 15*w^2 + 27*w - 13], [563, 563, -3*w^3 + 7*w^2 + 14*w - 7], [571, 571, -5*w^3 + 11*w^2 + 26*w - 3], [593, 593, -6*w^3 + 15*w^2 + 26*w - 7], [599, 599, 7*w^3 - 18*w^2 - 29*w + 17], [599, 599, -2*w^3 + 6*w^2 + 8*w - 3], [601, 601, -7*w^3 + 20*w^2 + 28*w - 23], [601, 601, 3*w^3 - 7*w^2 - 12*w + 5], [607, 607, 5*w^3 - 12*w^2 - 24*w + 9], [607, 607, w^3 - 5*w^2 + 15], [613, 613, -w^3 + 5*w^2 - 2*w - 9], [617, 617, w^3 + w^2 - 13*w - 15], [617, 617, 2*w^3 - 4*w^2 - 8*w - 1], [619, 619, 5*w^3 - 10*w^2 - 27*w - 7], [619, 619, 2*w^3 - 4*w^2 - 10*w + 3], [643, 643, w^3 - 5*w^2 + 5*w + 5], [643, 643, 4*w^3 - 9*w^2 - 20*w - 1], [643, 643, 3*w^3 - 7*w^2 - 14*w - 3], [643, 643, -3*w^3 + 7*w^2 + 13*w - 3], [647, 647, -3*w^3 + 8*w^2 + 12*w - 3], [653, 653, -w^3 + 9*w + 13], [653, 653, -w^3 + 4*w^2 + 3*w - 9], [653, 653, -2*w^3 + 7*w^2 + 4*w - 7], [653, 653, w^2 - 4*w - 9], [673, 673, -w^3 + 5*w^2 + w - 13], [683, 683, w^3 - 3*w^2 - 3*w - 3], [701, 701, 5*w^3 - 13*w^2 - 23*w + 9], [709, 709, 2*w^3 - w^2 - 19*w - 15], [719, 719, -5*w^3 + 15*w^2 + 20*w - 19], [727, 727, -w - 5], [751, 751, -4*w^3 + 10*w^2 + 15*w - 9], [751, 751, 6*w^3 - 17*w^2 - 22*w + 21], [757, 757, 3*w^3 - 6*w^2 - 18*w - 1], [757, 757, -w^3 + 4*w^2 + 2*w + 1], [769, 769, w^2 - 2*w + 3], [773, 773, 5*w^3 - 12*w^2 - 23*w + 9], [787, 787, 2*w^3 - 4*w^2 - 5*w + 1], [797, 797, -3*w^3 + 8*w^2 + 10*w - 3], [809, 809, 2*w^2 - 5*w - 1], [809, 809, 4*w^3 - 6*w^2 - 28*w - 11], [827, 827, 4*w^3 - 8*w^2 - 22*w - 1], [827, 827, 2*w^2 - 6*w - 9], [829, 829, -w^3 + w^2 + 10*w + 1], [839, 839, -2*w^3 + 2*w^2 + 16*w + 7], [877, 877, 6*w^3 - 16*w^2 - 25*w + 13], [877, 877, w^3 - w^2 - 7*w + 1], [881, 881, 2*w^3 - 2*w^2 - 15*w - 7], [881, 881, -4*w^3 + 7*w^2 + 26*w + 9], [887, 887, 2*w^3 - 4*w^2 - 13*w - 1], [907, 907, 5*w^3 - 11*w^2 - 26*w - 1], [907, 907, 5*w^3 - 13*w^2 - 22*w + 9], [907, 907, w^3 - 5*w^2 + 2*w + 13], [907, 907, -2*w^3 + 7*w^2 + 5*w - 7], [911, 911, -3*w^3 + 8*w^2 + 9*w - 5], [919, 919, -2*w^3 + 7*w^2 + 6*w - 3], [919, 919, -3*w^3 + 8*w^2 + 15*w - 7], [947, 947, -2*w^3 + 5*w^2 + 12*w - 9], [947, 947, -w^2 + w - 3], [947, 947, 3*w^3 - 6*w^2 - 14*w - 7], [947, 947, -w^3 + 5*w^2 - w - 17], [953, 953, 3*w^3 - 9*w^2 - 9*w + 13], [953, 953, -4*w^3 + 13*w^2 + 11*w - 23], [967, 967, 8*w^3 - 20*w^2 - 33*w + 19]]; primes := [ideal : I in primesArray]; heckePol := x^3 + 3*x^2 - 6*x - 9; K := NumberField(heckePol); heckeEigenvaluesArray := [1, e, -1, -1/3*e^2 - 2*e - 1, 2/3*e^2 + e - 6, 1/3*e^2 + e - 2, -5/3*e^2 - 3*e + 7, 1, 1/3*e^2 + 2*e - 2, 1/3*e^2 - e - 7, -1/3*e^2 + 1, -1/3*e^2 - 2*e, e^2 - e - 12, -e^2 - e - 2, -1/3*e^2 - 3*e + 4, e^2 + 3*e - 8, e^2 + 5*e - 3, -5/3*e^2 + e + 16, -1/3*e^2 - 3*e + 2, e - 12, 2*e^2 + 3*e - 12, -7/3*e^2 - 6*e + 6, -e^2 - 7*e + 1, -4/3*e^2 - e, -8/3*e^2 - 4*e + 14, 1/3*e^2 + 7*e + 2, 1/3*e^2 + 3*e + 14, 5/3*e^2 + 7*e - 7, 4/3*e^2 + 3*e - 21, 1/3*e^2 - 3*e - 5, 7/3*e^2 + 6*e - 14, -1/3*e^2 - 7*e + 1, e^2 + 4*e - 2, 5/3*e^2 - e - 13, -e + 3, -3*e^2 - 7*e + 15, -1/3*e^2 - 4*e + 4, 10/3*e^2 + 2*e - 25, -e^2 + 3*e + 14, -e^2 - 6*e + 8, 16/3*e^2 + 11*e - 18, -1/3*e^2 - 5*e - 16, 7/3*e^2 + 6*e - 14, -5/3*e^2 - 2*e - 5, e^2 + 5*e + 3, -3*e^2 - 6*e + 3, 14/3*e^2 + 7*e - 16, 3*e - 6, 3*e^2 + 8*e - 18, -13/3*e^2 - 8*e + 23, -e^2 - 4*e - 9, -4*e^2 - 2*e + 33, -4/3*e^2 - 5*e - 4, -10/3*e^2 + e + 28, 5/3*e^2 - 2*e - 15, -10/3*e^2 + 2*e + 37, e^2 - 6*e - 10, 5/3*e^2 + 2*e - 4, 2/3*e^2 - 3*e - 22, -e^2 + 8, 8/3*e^2 + 9*e - 19, -1/3*e^2 - 3, -2/3*e^2 - 22, 5*e^2 + 3*e - 35, 5*e^2 + 7*e - 27, -4/3*e^2 - 7*e - 4, -13/3*e^2 - 9*e + 14, 1/3*e^2 - 3*e + 5, -2*e - 27, -3*e^2 - 4*e + 9, 1/3*e^2 + e - 5, -4/3*e^2 - 12*e + 5, 8/3*e^2 + 10*e + 1, -2*e^2 + 6*e + 28, e^2 - e - 5, 1/3*e^2 + e + 22, -2*e^2 - 2*e - 2, -e^2 - 5*e - 16, 1/3*e^2 - e - 27, 8/3*e^2 + 10*e + 1, 14/3*e^2 + 5*e - 25, 22/3*e^2 + 17*e - 29, -5/3*e^2 + 2*e + 14, 10/3*e^2 + 9*e + 2, 10/3*e^2 + 12*e - 3, -7/3*e^2 - 6*e + 8, -5/3*e^2 - 7*e + 13, -10*e - 18, -5*e^2 - 4*e + 21, -1/3*e^2 + 4*e - 8, 2/3*e^2 - 3*e - 4, e^2 + 12*e + 6, -4*e^2 - 5*e + 13, 10/3*e^2 + 6*e, 5/3*e^2 + 6*e + 11, -4/3*e^2 - 8*e - 13, 4*e^2 + 5*e - 24, 13/3*e^2 + 6*e - 18, -5*e^2 - 14*e + 7, 4*e^2 + 14*e - 15, 11/3*e^2 + 16*e - 13, 14/3*e^2 + 2*e - 39, e^2 - 3*e - 29, 3*e^2 + 18*e - 10, e^2 + 11*e + 9, -4/3*e^2 + 4*e + 5, -8/3*e^2 - 10*e + 7, -5*e^2 - 9*e + 25, 6*e^2 + 14*e - 9, -2/3*e^2 - 11, e^2 - 4*e - 30, -5/3*e^2 - 4*e - 6, -2*e^2 - 7*e + 34, -17/3*e^2 - 8*e + 20, -7/3*e^2 - 2*e - 17, 11/3*e^2 + 13*e + 7, -e^2 - e + 3, -2*e^2 + e + 18, 7/3*e^2 + 11*e + 5, -5/3*e^2 - 10*e - 16, -5/3*e^2 + 5*e + 23, -4/3*e^2 + 4*e + 15, -23/3*e^2 - 18*e + 32, 3*e^2 + 5*e - 11, 3*e^2 - 2*e - 24, -2*e^2 - 3*e - 6, -4*e^2 - 11*e + 24, -4*e^2 - 13*e + 15, -e^2 - 4*e, 5*e^2 + 14*e - 22, -5*e^2 - 4*e + 18, -11/3*e^2 - 5*e + 28, 26/3*e^2 + 21*e - 32, 16/3*e^2 + 12*e - 8, -1/3*e^2 - 11*e - 8, -1/3*e^2 + 2*e - 18, 5/3*e^2 + 6*e - 44, 7/3*e^2 - e - 7, 14/3*e^2 + 5*e - 26, -10/3*e^2 - 4*e + 22, 6*e^2 + 11*e - 24, -20/3*e^2 - 20*e + 38, 5/3*e^2 - 3*e - 16, 4*e^2 + 17*e, 2/3*e^2 - 6*e - 19, -19/3*e^2 - 8*e + 29, -2*e^2 - 2*e - 15, -5*e^2 - 12*e + 25, -14/3*e^2 - 13*e + 10, 7*e + 28, -1/3*e^2 + 14*e + 6, 1/3*e^2 + 9*e - 5, 8*e^2 + 16*e - 21, -23/3*e^2 - 15*e + 43, 3*e^2 + 15*e + 13, -2/3*e^2 - e - 22, -2*e^2 - 15*e + 14, 5/3*e^2 + 1, e^2 + 18*e + 3, -6*e^2 - 12*e - 8, -e^2 + 4*e + 16, -17/3*e^2 - 2*e + 46, 3*e^2 - 15, -6*e^2 - 9*e + 21, -13/3*e^2 - 16*e + 41, -7*e - 6, 3*e^2 + 4*e - 3, 5*e^2 + 12*e - 32]; heckeEigenvalues := AssociativeArray(); for i := 1 to #heckeEigenvaluesArray do heckeEigenvalues[primes[i]] := heckeEigenvaluesArray[i]; end for; ALEigenvalues := AssociativeArray(); ALEigenvalues[ideal] := -1; ALEigenvalues[ideal] := 1; // EXAMPLE: // pp := Factorization(2*ZF)[1][1]; // heckeEigenvalues[pp]; print "To reconstruct the Hilbert newform f, type f, iso := Explode(make_newform());"; function make_newform(); M := HilbertCuspForms(F, NN); S := NewSubspace(M); // SetVerbose("ModFrmHil", 1); NFD := NewformDecomposition(S); newforms := [* Eigenform(U) : U in NFD *]; if #newforms eq 0 then; print "No Hilbert newforms at this level"; return 0; end if; print "Testing ", #newforms, " possible newforms"; newforms := [* f: f in newforms | IsIsomorphic(BaseField(f), K) *]; print #newforms, " newforms have the correct Hecke field"; if #newforms eq 0 then; print "No Hilbert newform found with the correct Hecke field"; return 0; end if; autos := Automorphisms(K); xnewforms := [* *]; for f in newforms do; if K eq RationalField() then; Append(~xnewforms, [* f, autos[1] *]); else; flag, iso := IsIsomorphic(K,BaseField(f)); for a in autos do; Append(~xnewforms, [* f, a*iso *]); end for; end if; end for; newforms := xnewforms; for P in primes do; xnewforms := [* *]; for f_iso in newforms do; f, iso := Explode(f_iso); if HeckeEigenvalue(f,P) eq iso(heckeEigenvalues[P]) then; Append(~xnewforms, f_iso); end if; end for; newforms := xnewforms; if #newforms eq 0 then; print "No Hilbert newform found which matches the Hecke eigenvalues"; return 0; else if #newforms eq 1 then; print "success: unique match"; return newforms[1]; end if; end if; end for; print #newforms, "Hilbert newforms found which match the Hecke eigenvalues"; return newforms[1]; end function;