/* 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![3, 4, -5, -1, 1]; F := NumberField(g); ZF := Integers(F); NN := ideal; primesArray := [ [2, 2, w - 1], [3, 3, w], [8, 2, -w^3 + 5*w + 1], [19, 19, w^3 - w^2 - 3*w + 2], [19, 19, -w^3 + 4*w - 2], [23, 23, w^3 + w^2 - 4*w - 5], [27, 3, -w^3 + w^2 + 5*w - 4], [31, 31, w^3 + w^2 - 4*w - 1], [47, 47, -w^2 - w + 5], [53, 53, 2*w^3 - 2*w^2 - 9*w + 10], [59, 59, 2*w - 1], [59, 59, w^3 - 2*w - 2], [61, 61, -w^2 - 2*w + 4], [67, 67, 2*w^2 - 7], [73, 73, 5*w^3 + w^2 - 23*w - 8], [79, 79, -2*w^3 - w^2 + 9*w + 7], [79, 79, -w^3 + w^2 + 4*w - 1], [79, 79, w^3 - w^2 - w - 2], [79, 79, w^3 - 2*w^2 - 2*w + 2], [83, 83, w^3 + w^2 - 3*w - 4], [83, 83, 3*w^3 + w^2 - 13*w - 4], [89, 89, -w^3 + 6*w - 2], [89, 89, w^3 - 3*w^2 - 4*w + 11], [97, 97, w^2 + 2*w - 2], [97, 97, 2*w^2 - w - 4], [103, 103, -w^3 + 3*w^2 + 2*w - 7], [107, 107, 2*w^3 + 2*w^2 - 8*w - 5], [113, 113, -2*w^3 + 7*w + 2], [113, 113, w^3 - 3*w^2 - 3*w + 8], [127, 127, w^3 - 4*w + 4], [131, 131, -2*w^2 - w + 8], [131, 131, w - 4], [139, 139, w^2 - w - 7], [157, 157, w^3 + w^2 - 6*w - 5], [167, 167, w^3 - 4*w - 4], [169, 13, 2*w^3 + w^2 - 10*w - 2], [169, 13, 2*w^3 + 2*w^2 - 9*w - 4], [173, 173, 4*w^3 + 3*w^2 - 18*w - 14], [173, 173, w^3 - w^2 - 6*w - 1], [193, 193, w^3 - 2*w - 4], [193, 193, 3*w^3 - 3*w^2 - 12*w + 11], [197, 197, -2*w^3 - w^2 + 6*w + 4], [199, 199, 2*w^3 + 2*w^2 - 10*w - 11], [199, 199, -2*w^3 + 10*w + 1], [211, 211, w^2 - 2*w - 4], [211, 211, -4*w^3 + 17*w + 2], [223, 223, w^3 - w^2 - 6*w + 5], [227, 227, -w - 4], [227, 227, -w^3 - 2*w^2 + 6*w + 2], [229, 229, 2*w^3 - 2*w^2 - 8*w + 5], [239, 239, 4*w^3 + w^2 - 19*w - 7], [251, 251, 2*w^3 - w^2 - 10*w + 2], [263, 263, w^3 - w^2 - 5*w + 8], [263, 263, -3*w^3 + 5*w^2 + 12*w - 17], [263, 263, w^3 - 3*w^2 + w + 4], [263, 263, 2*w^2 + w - 2], [269, 269, -w^3 + 2*w^2 + 4*w - 4], [271, 271, 3*w - 2], [277, 277, -w^3 - w^2 + 6*w - 1], [277, 277, w^2 + 3*w - 5], [281, 281, 2*w^3 - 12*w - 5], [283, 283, -2*w^3 + 9*w - 2], [293, 293, -w^2 - 3*w + 7], [313, 313, 2*w^3 - 2*w^2 - 6*w + 5], [331, 331, -4*w^2 - w + 14], [331, 331, -3*w^2 + 3*w + 5], [337, 337, 4*w^3 - 16*w + 1], [347, 347, -4*w^3 - w^2 + 16*w + 2], [359, 359, 2*w^2 - 2*w - 7], [359, 359, -2*w^3 + w^2 + 10*w - 4], [361, 19, 3*w^3 - 6*w^2 - 12*w + 22], [373, 373, -w^3 + w^2 + 2*w - 5], [373, 373, -2*w^3 + w^2 + 8*w + 2], [379, 379, 2*w^3 - 2*w^2 - 5*w + 4], [397, 397, -4*w^3 - w^2 + 18*w + 10], [397, 397, -2*w^3 - 3*w^2 + 10*w + 14], [409, 409, -2*w^3 + w^2 + 10*w - 8], [409, 409, 3*w^2 - 10], [419, 419, 2*w^3 + w^2 - 9*w - 1], [419, 419, -2*w^3 + w^2 + 6*w - 2], [431, 431, 3*w^3 - w^2 - 12*w - 1], [431, 431, 4*w^3 + w^2 - 18*w - 4], [433, 433, 2*w^3 + 2*w^2 - 11*w - 8], [457, 457, 3*w^2 - 8], [461, 461, -3*w - 4], [461, 461, w^3 + 3*w^2 - 3*w - 8], [479, 479, -3*w^3 + w^2 + 12*w - 7], [487, 487, 2*w^3 - 3*w^2 - 7*w + 7], [491, 491, -w^3 - 3*w^2 + 6*w + 5], [557, 557, 4*w^3 - w^2 - 19*w - 1], [569, 569, 3*w^2 - w - 7], [571, 571, -6*w^3 - 2*w^2 + 25*w + 10], [571, 571, w^3 + w^2 - 8*w - 5], [577, 577, 2*w^3 - w^2 - 9*w - 1], [577, 577, -2*w^3 - 3*w^2 + 7*w + 7], [577, 577, w^2 + 2*w - 10], [577, 577, 4*w^3 - 18*w - 5], [587, 587, -w^3 - 2*w^2 + 6*w + 10], [599, 599, 3*w^3 + w^2 - 12*w - 1], [599, 599, 3*w^3 + 2*w^2 - 12*w - 10], [601, 601, w^2 - 8], [613, 613, -3*w^2 - w + 5], [617, 617, 3*w^3 - 3*w^2 - 11*w + 10], [619, 619, 2*w^3 - 4*w^2 - 7*w + 16], [625, 5, -5], [631, 631, -w^3 + 2*w^2 + 4*w - 2], [641, 641, -3*w^3 - w^2 + 13*w + 2], [641, 641, -2*w^3 + 3*w^2 + 8*w - 8], [643, 643, -2*w^3 + 9*w - 4], [653, 653, -3*w^3 - w^2 + 8*w + 1], [673, 673, -2*w^3 + 11*w - 2], [673, 673, -w^3 + w^2 + w - 4], [677, 677, 4*w^3 + 2*w^2 - 19*w - 14], [691, 691, 2*w^3 + 3*w^2 - 8*w - 10], [691, 691, -w^3 + 3*w^2 + 5*w - 16], [701, 701, 2*w^3 + 2*w^2 - 8*w - 1], [709, 709, 7*w^3 + w^2 - 30*w - 5], [733, 733, -w^3 + 2*w^2 + 2*w - 8], [733, 733, -10*w^3 - 3*w^2 + 44*w + 16], [739, 739, -3*w^3 - w^2 + 11*w + 10], [739, 739, 2*w^3 - 2*w^2 - 11*w + 4], [757, 757, w^3 - 3*w^2 - 7*w + 14], [769, 769, w^3 + w^2 - 2*w - 7], [773, 773, 2*w^3 - 2*w^2 - 9*w + 4], [787, 787, 3*w^3 - 14*w + 2], [787, 787, 2*w^3 + 2*w^2 - 6*w - 7], [797, 797, 2*w^3 + 3*w^2 - 9*w - 11], [797, 797, -4*w^3 - 4*w^2 + 19*w + 20], [809, 809, w^3 + 3*w^2 - 4*w - 7], [821, 821, -w^3 - 3*w^2 + 5*w + 10], [839, 839, 2*w^3 + w^2 - 5*w - 5], [839, 839, 3*w^3 + 3*w^2 - 14*w - 11], [853, 853, -3*w^3 + 3*w^2 + 10*w - 13], [859, 859, -4*w^3 + 19*w + 2], [859, 859, -2*w^3 + 4*w^2 + 7*w - 10], [863, 863, w^2 - 3*w - 5], [863, 863, -2*w^3 + 3*w^2 + 12*w - 16], [877, 877, -w^3 + 5*w^2 + 4*w - 19], [877, 877, -3*w^3 - 3*w^2 + 11*w + 4], [881, 881, 2*w^3 + 2*w^2 - 9*w - 2], [883, 883, -3*w^3 + 7*w^2 + 13*w - 26], [887, 887, -w^3 + 2*w^2 + 6*w - 2], [907, 907, 8*w^3 + 3*w^2 - 33*w - 11], [907, 907, -w^3 - w^2 + w - 4], [907, 907, -2*w^3 + 6*w^2 + 8*w - 23], [907, 907, -3*w^3 + w^2 + 11*w - 4], [911, 911, -3*w^3 - 3*w^2 + 12*w + 13], [911, 911, w^3 + 3*w^2 - 6*w - 7], [929, 929, 2*w^3 + 3*w^2 - 9*w - 7], [941, 941, 4*w - 1], [947, 947, w^3 + w^2 - 7*w - 8], [953, 953, -4*w^3 + w^2 + 14*w - 8], [953, 953, 2*w^3 + w^2 - 9*w + 1], [967, 967, -w^3 + w^2 + 7*w - 2], [967, 967, 4*w^3 + 3*w^2 - 18*w - 8], [971, 971, 2*w^3 + 3*w^2 - 8*w - 8], [977, 977, 4*w^3 - 16*w - 1], [977, 977, 7*w^3 + w^2 - 29*w - 4], [977, 977, 3*w^3 - w^2 - 14*w - 1], [977, 977, -3*w^3 + 10*w + 2], [983, 983, -2*w^3 - 2*w^2 + 7*w - 2], [991, 991, 7*w^3 + w^2 - 30*w - 7], [991, 991, 4*w^3 - 2*w^2 - 17*w + 4], [997, 997, 4*w^3 + 2*w^2 - 16*w - 11], [997, 997, 6*w^3 + 4*w^2 - 25*w - 14]]; primes := [ideal : I in primesArray]; heckePol := x^3 - 9*x - 4; K := NumberField(heckePol); heckeEigenvaluesArray := [0, e, -e^2 + e + 5, -e, 4, -e^2 + 8, 4, -e - 4, -e^2 + 4*e + 8, -2*e^2 + e + 10, 2*e + 4, -2*e^2 + 12, 2*e^2 - 10, 2*e^2 - 4*e - 12, 2*e^2 + 2*e - 14, -4*e, 2*e - 8, e^2 + 4*e - 8, e + 4, 2*e^2 - 4*e - 12, -4*e + 4, 2*e^2 - 3*e - 18, 4*e + 2, -2*e^2 + 18, -2*e^2 + 10, 2*e^2 - 4*e - 8, -3*e^2 + 4*e + 20, 2*e^2 - e - 18, e^2 + 4*e - 14, -e^2 + 4*e + 16, -e^2 + 12, 3*e^2 - 4*e - 12, 12, e^2 - 2, -16, 2*e^2 - 6*e - 14, 2*e^2 - 2*e - 22, -4*e^2 + 4*e + 22, -2*e^2 + e + 18, -2*e^2 + 8*e + 18, -2*e^2 - 5*e + 14, -2*e^2 - 4*e + 6, 3*e^2 - 16, 4*e^2 - 8*e - 32, 12, 4*e - 12, 3*e + 4, 3*e^2 + 4*e - 20, 4*e^2 - e - 24, -2*e^2 + 4*e - 2, e - 4, -4*e - 4, -e^2 - 4*e + 8, 4*e^2 - 3*e - 28, 4*e + 8, -24, 2*e^2 - e - 6, -8*e, 2*e^2 - 6*e - 26, 2*e^2 - e - 14, -2*e^2 - 6*e + 26, -2*e + 4, -3*e^2 + 8*e + 22, -2*e^2 - 2*e + 26, 4*e^2 - 4*e - 20, 4*e^2 + 4*e - 20, -2*e^2 + 3*e + 14, 6*e + 4, -2*e^2 + 8, 4*e^2 - 3*e - 4, 2*e^2 - 4*e + 2, 2*e^2 - 2, -2*e^2 - 2*e - 2, -9*e - 8, -18, -6*e^2 - 4*e + 38, -2*e^2 - 10*e + 18, 3*e^2 - 4*e - 22, -4*e^2 - 2*e + 12, -e - 8, -4*e^2 + 2*e + 8, 4*e^2 - 8*e - 40, -6*e^2 + 26, -e^2 + 10, 6*e^2 - 8*e - 34, -2*e^2 - 4*e + 30, -2*e + 8, 9*e + 12, 2*e^2 - 4*e - 20, -2*e^2 + 10*e + 6, -8*e + 2, -8*e - 4, e^2 - 4*e - 28, -6*e^2 + 8*e + 26, -3*e^2 - 4*e + 34, -4*e^2 + 8*e + 18, -6*e^2 - 6*e + 42, e^2 + 12, -4*e^2 + 40, -8*e + 16, -4*e^2 + 26, 6*e^2 - 6*e - 18, 2*e^2 + 6*e - 22, 8*e - 4, 4*e^2 - 8*e - 30, -7*e + 12, 2*e^2 - 2*e - 30, -10*e^2 + 9*e + 54, 4*e^2 - 5*e - 48, -2*e^2 - e + 10, -6*e^2 + 6*e + 10, 2*e^2 - 4*e - 22, -8*e + 6, 6*e^2 - 8*e - 28, 2*e^2 + 12*e - 12, 2*e^2 + 4*e - 2, 10*e^2 - 8*e - 58, -e^2 - 12*e + 14, 2*e^2 + 3*e - 22, 7*e^2 - 20, -12*e + 12, 4*e^2 - 26, -2*e^2 + 10, 2*e^2 - 10*e - 18, -4*e^2 - 2*e + 28, e^2 + 8*e - 4, -4*e - 26, 2*e^2 - 8*e - 18, e^2 + 8*e + 10, -8*e^2 + 8*e + 38, -2*e^2 + 4*e - 8, -6*e^2 - 4*e + 56, 9*e^2 - 4*e - 42, 4*e^2 - 8*e - 4, 8*e^2 - 10*e - 60, -7*e^2 + 32, 8*e^2 - 4*e - 48, 6*e^2 - 12*e - 26, -2*e^2 - 2*e + 6, 2*e^2 + 2*e + 26, 8*e - 20, 4*e^2 - 15*e - 44, -8*e^2 - 5*e + 40, -4*e^2 + 4*e - 4, 5*e^2 - 44, -4*e^2 + 10*e + 36, -4*e^2 + 20*e + 32, 7*e^2 - 32, 6*e^2 - 12*e - 46, -2*e^2 + 6*e + 38, -6*e^2 - 4*e + 36, 6*e^2 - 2*e - 46, 6*e^2 - e - 10, 8*e^2 - e - 20, -8*e^2 + 11*e + 60, -4*e^2 - 4*e + 44, -2*e^2 + 9*e - 10, 2*e^2 + 8*e + 2, -6*e^2 + 12*e + 50, 2*e^2 - 6*e + 26, -8*e^2 + 4*e + 40, -2*e + 40, 8*e^2 - e - 44, -7*e^2 + 8*e + 22, -7*e^2 + 12*e + 38]; 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;