/* 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![1, -2, -6, -1, 1]; F := NumberField(g); ZF := Integers(F); NN := ideal; primesArray := [ [5, 5, -w^3 + 2*w^2 + 3*w], [7, 7, w - 1], [11, 11, -w^3 + 2*w^2 + 4*w], [13, 13, -2*w^3 + 3*w^2 + 10*w - 2], [16, 2, 2], [17, 17, -w^3 + 2*w^2 + 5*w - 3], [17, 17, -w^3 + w^2 + 5*w], [17, 17, -w^2 + 2*w + 1], [19, 19, w^2 - w - 2], [29, 29, w^3 - 2*w^2 - 5*w], [29, 29, w^2 - w - 3], [31, 31, -w^3 + 2*w^2 + 3*w - 2], [43, 43, 2*w^3 - 3*w^2 - 11*w], [47, 47, w^3 - 7*w - 4], [53, 53, -2*w^3 + 3*w^2 + 9*w - 1], [61, 61, -w - 3], [73, 73, -w^3 + 2*w^2 + 3*w - 3], [73, 73, w^3 - w^2 - 7*w - 1], [81, 3, -3], [83, 83, -2*w^3 + 3*w^2 + 9*w + 1], [83, 83, -w^3 + 3*w^2 + 2*w - 3], [89, 89, w - 4], [103, 103, w^3 - 2*w^2 - 6*w + 3], [113, 113, 2*w^3 - w^2 - 14*w - 6], [121, 11, -w^2 + 2*w + 7], [125, 5, -3*w^3 + 4*w^2 + 15*w + 1], [139, 139, w^3 - 2*w^2 - 5*w - 3], [139, 139, w^3 - 5*w - 5], [151, 151, w^3 - 9*w - 7], [157, 157, -3*w^3 + 6*w^2 + 13*w - 6], [163, 163, w^3 - 3*w^2 - 2*w + 9], [167, 167, -w^3 + 7*w + 3], [167, 167, -3*w^3 + 4*w^2 + 15*w - 1], [173, 173, 2*w^3 - 3*w^2 - 7*w - 2], [181, 181, -w^3 + 3*w^2 + 4*w - 5], [191, 191, w^3 - w^2 - 4*w - 4], [193, 193, -w^3 + w^2 + 7*w + 6], [193, 193, 2*w^3 - 2*w^2 - 13*w - 5], [199, 199, -2*w^3 + 5*w^2 + 5*w - 5], [211, 211, w^3 - w^2 - 8*w - 3], [211, 211, -2*w^2 + 3*w + 8], [227, 227, -w^3 + 3*w^2 + 4*w - 4], [227, 227, w^2 - 3*w - 6], [229, 229, w^2 - 5], [229, 229, 3*w^3 - 4*w^2 - 17*w - 2], [233, 233, 3*w^3 - 6*w^2 - 13*w + 3], [233, 233, 3*w^3 - 4*w^2 - 16*w + 1], [241, 241, -2*w^3 + 4*w^2 + 8*w + 1], [251, 251, 2*w^3 - 2*w^2 - 9*w - 3], [277, 277, 3*w^3 - 4*w^2 - 17*w - 1], [281, 281, -2*w^2 + 5*w + 1], [283, 283, -4*w^3 + 6*w^2 + 19*w - 2], [293, 293, -3*w^3 + 6*w^2 + 12*w - 2], [307, 307, w^3 - w^2 - 4*w - 5], [307, 307, w^3 - w^2 - 8*w - 2], [311, 311, 2*w^2 - 3*w - 7], [313, 313, -2*w^3 + w^2 + 15*w + 3], [317, 317, -w^3 + 3*w^2 + w - 5], [331, 331, 2*w^3 - 3*w^2 - 12*w], [337, 337, w^3 - w^2 - 8*w - 1], [343, 7, -w^3 + 6*w + 8], [347, 347, 2*w^3 - 4*w^2 - 7*w + 5], [349, 349, 2*w^3 - 4*w^2 - 9*w], [353, 353, -3*w^3 + 4*w^2 + 16*w + 5], [353, 353, -3*w^3 + 4*w^2 + 14*w], [353, 353, -w^3 + 3*w^2 + 4*w - 8], [353, 353, -w^3 + 2*w^2 + 8*w - 3], [359, 359, -4*w^3 + 7*w^2 + 19*w - 3], [367, 367, -w^3 + 2*w^2 + 6*w - 5], [373, 373, 5*w^3 - 8*w^2 - 26*w + 3], [379, 379, -3*w^3 + 5*w^2 + 17*w - 4], [379, 379, -w^3 + 2*w^2 + 4*w - 6], [383, 383, w^2 - 6], [389, 389, w^3 - 2*w^2 - 3*w - 4], [389, 389, w^2 + w - 4], [397, 397, -4*w^3 + 5*w^2 + 23*w + 5], [397, 397, -3*w^3 + 5*w^2 + 12*w - 2], [419, 419, -3*w^3 + 4*w^2 + 17*w + 5], [419, 419, -3*w^3 + 5*w^2 + 15*w], [419, 419, 3*w^3 - 5*w^2 - 14*w - 1], [419, 419, 2*w^3 - 3*w^2 - 10*w - 6], [431, 431, 2*w^3 - 2*w^2 - 11*w], [433, 433, w^3 - 8*w - 1], [433, 433, 2*w^2 - 2*w - 5], [439, 439, 2*w^3 - 2*w^2 - 9*w - 6], [443, 443, 2*w^3 - 5*w^2 - 7*w], [443, 443, 2*w^3 - 5*w^2 - 9*w + 4], [457, 457, -2*w^3 + 5*w^2 + 7*w - 4], [457, 457, -w^3 + 2*w^2 - 3], [461, 461, -4*w^3 + 7*w^2 + 17*w - 7], [479, 479, 3*w^3 - 5*w^2 - 12*w + 6], [487, 487, -2*w^3 + 5*w^2 + 9*w - 9], [487, 487, w^3 - 10*w - 8], [499, 499, 2*w^3 - 2*w^2 - 12*w + 1], [503, 503, w^2 - 7], [503, 503, w^3 + w^2 - 7*w - 8], [529, 23, -3*w^3 + 5*w^2 + 12*w + 1], [529, 23, 3*w^3 - 4*w^2 - 14*w - 1], [541, 541, w^3 - 4*w^2 - 2*w + 11], [563, 563, -2*w^3 + w^2 + 15*w + 6], [569, 569, w^3 - 2*w^2 - 4*w - 4], [601, 601, 3*w^3 - 5*w^2 - 17*w + 1], [607, 607, -2*w^3 + 5*w^2 + 7*w - 5], [607, 607, -w^3 + 3*w^2 + 6*w - 5], [613, 613, -4*w^3 + 5*w^2 + 21*w + 1], [613, 613, -5*w^3 + 8*w^2 + 23*w - 4], [619, 619, w^3 + w^2 - 9*w - 5], [619, 619, -3*w^3 + 4*w^2 + 14*w + 2], [641, 641, -6*w^3 + 8*w^2 + 31*w + 3], [643, 643, 3*w^3 - 4*w^2 - 17*w - 6], [643, 643, -2*w^3 + 5*w^2 + 7*w - 6], [647, 647, 3*w^3 - 4*w^2 - 13*w - 10], [653, 653, -3*w^3 + 5*w^2 + 14*w + 2], [653, 653, w^3 - 2*w^2 - w - 3], [661, 661, 5*w^3 - 9*w^2 - 24*w + 5], [683, 683, 2*w^3 - 3*w^2 - 13*w - 2], [683, 683, 4*w^3 - 7*w^2 - 18*w + 1], [719, 719, -w^3 + 2*w^2 + 3*w - 7], [719, 719, 3*w^3 - 5*w^2 - 16*w - 1], [727, 727, -2*w^3 + 5*w^2 + 8*w - 7], [727, 727, 2*w^3 - 5*w^2 - 7*w + 13], [733, 733, -2*w^2 + 7], [733, 733, -3*w^3 + 5*w^2 + 11*w + 2], [739, 739, -6*w^3 + 9*w^2 + 29*w - 3], [739, 739, -2*w^3 + 3*w^2 + 7*w + 5], [751, 751, 4*w^3 - 5*w^2 - 23*w - 3], [757, 757, -w^3 + 10*w + 4], [757, 757, 2*w^3 - w^2 - 14*w - 4], [769, 769, -w^3 + 4*w^2 + 4*w - 8], [769, 769, 4*w^3 - 6*w^2 - 21*w - 2], [787, 787, 3*w^3 - 3*w^2 - 19*w - 6], [787, 787, -2*w^2 + 6*w + 7], [839, 839, -3*w^3 + 3*w^2 + 19*w + 5], [841, 29, 3*w^3 - 4*w^2 - 13*w - 4], [853, 853, -3*w^3 + 5*w^2 + 14*w + 3], [853, 853, 2*w^2 - w - 9], [853, 853, 3*w^3 - 5*w^2 - 11*w + 1], [853, 853, w - 6], [857, 857, 2*w^3 - 2*w^2 - 9*w - 7], [857, 857, -4*w^3 + 8*w^2 + 13*w - 1], [859, 859, 2*w^3 - 4*w^2 - 13*w + 2], [859, 859, w^3 - w^2 - 9*w - 2], [863, 863, -2*w^3 - w^2 + 17*w + 11], [877, 877, 5*w^3 - 6*w^2 - 28*w - 9], [877, 877, -4*w^3 + 5*w^2 + 20*w + 6], [881, 881, 4*w^3 - 5*w^2 - 18*w - 8], [911, 911, -w^3 + 4*w^2 - w - 8], [911, 911, 2*w^3 - 3*w^2 - 13*w - 1], [919, 919, w^3 - w^2 - 7*w + 5], [929, 929, 2*w^3 - 3*w^2 - 13*w + 1], [929, 929, -2*w^3 + 5*w^2 + 6*w - 11], [941, 941, -3*w^3 + 7*w^2 + 12*w - 5], [953, 953, -2*w^3 + 5*w^2 + 5*w - 7], [971, 971, w^3 - w^2 - 3*w - 5], [971, 971, 3*w^3 - 7*w^2 - 12*w + 11], [977, 977, 3*w^3 - 5*w^2 - 11*w], [997, 997, -2*w^3 + 3*w^2 + 6*w - 5], [997, 997, -4*w^3 + 7*w^2 + 16*w - 2]]; primes := [ideal : I in primesArray]; heckePol := x^3 - 8*x - 5; K := NumberField(heckePol); heckeEigenvaluesArray := [e, 3, e^2 - e - 4, e + 3, -2*e^2 + e + 9, e^2 - 2*e - 6, -e^2 + e + 6, e - 2, e^2 - 5, -e, e + 6, -1, -e^2 - e + 11, -e^2 - 2*e + 9, -e^2 + 5, 3*e^2 - 3*e - 17, 3*e^2 - 3*e - 16, -3*e^2 + 5*e + 18, -2*e^2 + 12, e^2 + e - 2, e + 7, e^2 - 3*e - 6, -e^2 - 7, -e^2 - e + 9, -3*e^2 - e + 18, -e^2 + 4*e + 8, -5*e^2 + 8*e + 29, 3*e^2 - 3*e - 8, 4*e^2 - 8*e - 30, e^2 + 5*e - 12, -e - 5, -2*e^2 - 4*e + 18, 3*e^2 - 9*e - 26, e^2 - 5*e - 6, 3*e^2 - 2*e - 27, -2*e^2 + 2*e + 15, -3*e^2 - 4*e + 23, -2*e^2 + 4*e + 31, 2*e^2 - 15, -2*e^2 + 2*e + 13, 5*e^2 - 8*e - 33, -5*e^2 + 7*e + 26, 3*e^2 - 5*e - 22, -e^2 - e + 4, -4*e^2 - 3*e + 23, -3*e^2 + 9, -7*e^2 + 8*e + 36, -2*e^2 + 9*e + 3, 2*e^2 - 4*e - 4, 4*e^2 - 6*e - 8, -e^2 + 2*e + 5, e^2 + 5*e - 6, -e^2 + e - 2, 3*e^2 - 10*e - 15, -e^2 - 5*e + 15, -6*e^2 + 3*e + 25, e^2 + e + 16, -5*e^2 - e + 30, e^2 + 10*e - 10, -e^2 - 5*e + 6, 2*e^2 - 2*e + 5, 2*e^2 + 3*e - 13, -e^2 + 33, 7*e^2 - 8*e - 28, 2*e^2 - 6*e - 14, 4*e^2 - e - 29, 3*e^2 - 2*e - 29, 2*e^2 - 10*e - 17, -6*e^2 + 3*e + 25, e^2 - 5*e - 2, 2*e^2 + 8*e - 24, e^2 - 2*e + 19, 5*e^2 - 7*e - 34, e^2 + 4*e - 1, 3*e^2 - 5*e - 36, 2*e^2 + 6*e - 24, -e^2 - e + 12, -2*e^2 + 2*e + 12, 6*e^2 - 12*e - 29, 2*e - 8, 4*e^2 - 9, -5*e + 11, 5*e^2 + 5*e - 26, 3*e^2 - e - 32, -5*e^2 + 10*e + 24, -3*e^2 + 18, -3*e^2 - 10*e + 21, -5*e^2 + 9*e + 34, 8*e - 4, e^2 + 5*e - 15, 2*e^2 + 3*e - 27, e^2 + e + 18, -2*e^2 + 12*e + 9, -6*e^2 + e + 29, 6*e^2 - 16*e - 34, -e^2 + 15, 5*e^2 - 7*e - 44, e^2 + 3, 7*e^2 - 10*e - 35, 7*e^2 - 9*e - 46, e - 13, -7*e^2 + 10*e + 44, 4*e^2 - 4*e - 7, -e^2 + 11*e, e^2 + 6*e - 5, -e^2 + 7*e + 26, 3*e^2 + e - 35, 7*e^2 - 13*e - 43, -6*e^2 - 5*e + 41, e^2 + 3*e + 24, -4*e^2 - 4*e + 24, 3*e^2 + 3*e + 6, 9*e^2 - 8*e - 49, 4*e^2 - 4*e - 49, -5*e^2 + 7*e + 18, 3*e^2 - 11*e - 25, e^2 - 3*e - 19, -3*e^2 + 10*e + 26, 5*e^2 + e - 10, e^2 + 12*e - 15, -6*e^2 + 9*e + 28, 3*e^2 - e - 6, -2*e^2 + 8*e - 14, -7*e^2 - e + 24, e^2 + 11*e - 10, -6*e^2 + e + 27, -3*e^2 + 15*e + 18, 2*e^2 - 7*e - 7, -2*e^2 + 5*e + 45, 8*e^2 - 13*e - 55, 3*e^2 - 18*e - 28, 3*e^2 - 3*e - 8, 6*e^2 - 16*e - 38, e^2 + 5*e - 20, -e^2 - 9*e + 26, -7*e^2 + 2*e + 39, e^2 - 7*e + 2, -3*e^2 + 12*e - 10, 3*e^2 - 10*e - 35, 4*e^2 - 2*e + 22, -4*e + 20, -4*e^2 - 5*e + 29, 12*e^2 - 8*e - 64, -8*e^2 - 4*e + 43, -7*e^2 + 5*e + 45, 3*e^2 - 7*e + 10, 2*e^2 - e - 5, 3*e^2 - 7*e - 14, 3*e^2 - 3*e - 20, -8*e^2 + 19*e + 61, -10*e^2 + 3*e + 52, -11*e + 13, -11*e^2 + 10*e + 69, -9*e^2 - 5*e + 45, 4*e^2 - 6*e - 22, 12*e^2 - 3*e - 45, 2*e^2 - 16*e + 5, -e^2 + 5*e + 27]; heckeEigenvalues := AssociativeArray(); for i := 1 to #heckeEigenvaluesArray do heckeEigenvalues[primes[i]] := heckeEigenvaluesArray[i]; end for; ALEigenvalues := AssociativeArray(); 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;