/* 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![4, 2, -5, -1, 1]; F := NumberField(g); ZF := Integers(F); NN := ideal; primesArray := [ [4, 2, -w], [4, 2, 1/2*w^3 - 1/2*w^2 - 5/2*w + 1], [19, 19, 1/2*w^3 - 3/2*w^2 - 1/2*w + 4], [19, 19, 1/2*w^3 + 1/2*w^2 - 5/2*w - 1], [25, 5, w^3 - w^2 - 3*w + 1], [29, 29, -1/2*w^3 + 3/2*w^2 + 3/2*w - 1], [29, 29, -w^2 + 5], [31, 31, -w^3 + 2*w^2 + 3*w - 3], [31, 31, -1/2*w^3 - 1/2*w^2 + 3/2*w + 3], [41, 41, -1/2*w^3 - 1/2*w^2 + 5/2*w], [41, 41, -1/2*w^3 + 3/2*w^2 + 1/2*w - 5], [59, 59, w^3 - w^2 - 5*w + 1], [59, 59, 3/2*w^3 - 1/2*w^2 - 11/2*w - 1], [61, 61, 3/2*w^3 - 1/2*w^2 - 11/2*w - 2], [61, 61, -2*w^2 + w + 7], [71, 71, 1/2*w^3 - 3/2*w^2 - 5/2*w + 6], [71, 71, -1/2*w^3 + 5/2*w^2 - 1/2*w - 5], [71, 71, 1/2*w^3 + 3/2*w^2 - 7/2*w - 5], [71, 71, -w^3 + 3*w^2 + 2*w - 7], [81, 3, -3], [89, 89, -1/2*w^3 + 5/2*w^2 + 3/2*w - 6], [101, 101, w^2 - 2*w - 5], [101, 101, -1/2*w^3 - 1/2*w^2 + 7/2*w - 1], [109, 109, w^3 - 2*w^2 - 3*w + 1], [109, 109, -5/2*w^3 + 7/2*w^2 + 17/2*w - 8], [109, 109, 1/2*w^3 + 1/2*w^2 - 3/2*w - 5], [109, 109, -2*w^3 + 2*w^2 + 8*w - 1], [121, 11, 3/2*w^3 - 3/2*w^2 - 9/2*w + 1], [121, 11, -3/2*w^3 + 3/2*w^2 + 9/2*w - 2], [131, 131, -1/2*w^3 - 3/2*w^2 + 11/2*w + 6], [131, 131, -1/2*w^3 - 1/2*w^2 + 9/2*w + 2], [131, 131, -1/2*w^3 - 1/2*w^2 + 9/2*w + 1], [131, 131, -3/2*w^3 + 3/2*w^2 + 13/2*w - 5], [149, 149, 5/2*w^3 - 5/2*w^2 - 17/2*w], [149, 149, -1/2*w^3 + 3/2*w^2 + 3/2*w + 1], [151, 151, 2*w^3 - 2*w^2 - 7*w + 3], [151, 151, 5/2*w^3 - 5/2*w^2 - 19/2*w + 1], [181, 181, -w^3 + w^2 + w - 3], [181, 181, 1/2*w^3 - 5/2*w^2 + 1/2*w + 8], [191, 191, 1/2*w^3 + 3/2*w^2 - 9/2*w - 8], [191, 191, 3/2*w^3 - 3/2*w^2 - 13/2*w - 1], [211, 211, -1/2*w^3 + 3/2*w^2 - 1/2*w - 5], [211, 211, -w^3 + 5*w - 1], [229, 229, -2*w^3 + 4*w^2 + 6*w - 7], [229, 229, 3/2*w^3 - 3/2*w^2 - 15/2*w + 4], [239, 239, w^3 + w^2 - 4*w - 1], [239, 239, -3/2*w^3 + 1/2*w^2 + 15/2*w - 1], [241, 241, 1/2*w^3 + 1/2*w^2 - 1/2*w - 4], [241, 241, 3/2*w^3 - 5/2*w^2 - 11/2*w + 3], [269, 269, -w^3 + 2*w^2 + w - 5], [269, 269, -3/2*w^3 + 5/2*w^2 + 7/2*w - 8], [269, 269, 3/2*w^3 - 7/2*w^2 - 7/2*w + 4], [269, 269, -w^3 - w^2 + 4*w + 7], [281, 281, -1/2*w^3 + 5/2*w^2 - 1/2*w - 9], [281, 281, 1/2*w^3 + 3/2*w^2 - 7/2*w - 1], [289, 17, -w^3 + 2*w^2 + 5*w - 1], [289, 17, -1/2*w^3 + 3/2*w^2 + 7/2*w - 7], [331, 331, 3/2*w^3 - 3/2*w^2 - 15/2*w + 2], [331, 331, -5/2*w^3 + 7/2*w^2 + 17/2*w - 4], [331, 331, 3*w - 1], [331, 331, -3/2*w^3 + 1/2*w^2 + 7/2*w + 3], [349, 349, -1/2*w^3 - 1/2*w^2 + 5/2*w - 3], [349, 349, -1/2*w^3 + 3/2*w^2 + 1/2*w - 8], [359, 359, -5/2*w^3 + 9/2*w^2 + 11/2*w - 6], [359, 359, -1/2*w^3 + 7/2*w^2 + 1/2*w - 6], [361, 19, -2*w^3 + 2*w^2 + 6*w - 3], [379, 379, 1/2*w^3 + 5/2*w^2 - 9/2*w - 7], [379, 379, w^3 - w^2 - 6*w + 3], [389, 389, 1/2*w^3 - 1/2*w^2 - 5/2*w - 4], [389, 389, w - 5], [401, 401, 2*w^2 + w - 7], [401, 401, -3/2*w^3 + 7/2*w^2 + 11/2*w - 6], [401, 401, w^3 - 3*w^2 - 3*w + 3], [401, 401, 2*w^2 - 9], [409, 409, -1/2*w^3 - 5/2*w^2 + 9/2*w + 8], [409, 409, 1/2*w^3 + 3/2*w^2 - 3/2*w - 7], [409, 409, -3/2*w^3 + 7/2*w^2 + 9/2*w - 5], [409, 409, -1/2*w^3 + 7/2*w^2 - 3/2*w - 7], [419, 419, 2*w^3 - 11*w - 5], [419, 419, 5/2*w^3 - 3/2*w^2 - 17/2*w + 2], [421, 421, -1/2*w^3 + 5/2*w^2 + 7/2*w - 2], [421, 421, -w^3 + w^2 + w + 5], [431, 431, 2*w^3 - w^2 - 6*w - 1], [431, 431, -5/2*w^3 + 7/2*w^2 + 15/2*w - 5], [439, 439, -w^3 + 7*w - 5], [439, 439, -w^3 + w + 3], [449, 449, -2*w^3 + 2*w^2 + 5*w - 3], [449, 449, -1/2*w^3 - 1/2*w^2 + 11/2*w - 1], [449, 449, 1/2*w^3 + 1/2*w^2 - 5/2*w - 7], [449, 449, 5/2*w^3 - 5/2*w^2 - 11/2*w + 5], [491, 491, -5/2*w^3 + 5/2*w^2 + 17/2*w - 2], [491, 491, 2*w^3 - 2*w^2 - 5*w + 1], [499, 499, w^3 + w^2 - 5*w - 1], [499, 499, -w^3 + 3*w^2 + w - 9], [521, 521, -w^3 + 4*w^2 + w - 9], [521, 521, 1/2*w^3 + 5/2*w^2 - 7/2*w - 7], [541, 541, -3/2*w^3 + 5/2*w^2 + 11/2*w - 1], [541, 541, 1/2*w^3 + 1/2*w^2 - 1/2*w - 6], [569, 569, -3/2*w^3 + 5/2*w^2 + 3/2*w - 5], [569, 569, -2*w^3 + 4*w^2 + 5*w - 13], [571, 571, -w^3 + 3*w^2 - 7], [571, 571, -w^3 + 2*w^2 + w - 7], [599, 599, 1/2*w^3 + 5/2*w^2 - 5/2*w - 11], [599, 599, 1/2*w^3 + 3/2*w^2 - 11/2*w - 8], [619, 619, -w - 5], [619, 619, -1/2*w^3 + 1/2*w^2 + 5/2*w - 6], [619, 619, -1/2*w^3 + 7/2*w^2 - 1/2*w - 9], [619, 619, 3*w^2 - 2*w - 7], [641, 641, -w^3 - 2*w^2 + 5*w + 3], [641, 641, 2*w^2 - 4*w - 7], [641, 641, 3/2*w^3 - 9/2*w^2 - 5/2*w + 13], [641, 641, -3/2*w^3 + 7/2*w^2 + 5/2*w - 9], [659, 659, -w^3 + 7*w + 1], [659, 659, 5/2*w^3 - 5/2*w^2 - 19/2*w - 1], [659, 659, -1/2*w^3 + 7/2*w^2 + 1/2*w - 8], [659, 659, 2*w^2 + 2*w - 7], [661, 661, 2*w^3 - 2*w^2 - 10*w + 1], [661, 661, w^3 - 5*w - 7], [691, 691, -w^3 + 3*w^2 + 4*w - 3], [691, 691, -3/2*w^3 + 7/2*w^2 + 1/2*w - 6], [691, 691, 5/2*w^3 - 1/2*w^2 - 23/2*w - 2], [691, 691, -1/2*w^3 + 5/2*w^2 + 5/2*w - 10], [701, 701, 5/2*w^3 - 5/2*w^2 - 23/2*w + 4], [701, 701, -1/2*w^3 + 1/2*w^2 + 7/2*w - 7], [701, 701, -2*w^3 + w^2 + 10*w - 3], [701, 701, -1/2*w^3 + 7/2*w^2 - 3/2*w - 12], [709, 709, -1/2*w^3 + 5/2*w^2 - 3/2*w - 8], [709, 709, -3/2*w^3 + 5/2*w^2 + 5/2*w - 7], [719, 719, -w^3 + 4*w^2 - w - 9], [719, 719, 3/2*w^3 + 3/2*w^2 - 17/2*w - 5], [739, 739, 3/2*w^3 + 1/2*w^2 - 11/2*w - 8], [739, 739, 2*w^3 - 4*w^2 - 5*w + 3], [761, 761, 3*w^2 - 11], [761, 761, 5/2*w^3 - 7/2*w^2 - 13/2*w + 4], [761, 761, -3/2*w^3 + 9/2*w^2 + 9/2*w - 7], [761, 761, 5/2*w^3 - 3/2*w^2 - 17/2*w - 1], [821, 821, -w^3 + w^2 + 7*w + 1], [821, 821, -4*w - 1], [821, 821, -w^3 + w^2 + 7*w - 5], [821, 821, 2*w^3 - 2*w^2 - 10*w + 5], [829, 829, 3*w^3 - 2*w^2 - 11*w + 1], [829, 829, -5/2*w^3 + 7/2*w^2 + 11/2*w - 5], [839, 839, 3/2*w^3 + 1/2*w^2 - 9/2*w - 6], [839, 839, 5/2*w^3 - 9/2*w^2 - 15/2*w + 6], [841, 29, 5/2*w^3 - 5/2*w^2 - 15/2*w + 4], [859, 859, -3*w^3 + 3*w^2 + 10*w - 1], [859, 859, 5/2*w^3 - 5/2*w^2 - 13/2*w], [881, 881, -3/2*w^3 + 7/2*w^2 + 9/2*w - 3], [881, 881, -w^3 + 3*w^2 + 2*w - 13], [881, 881, -5/2*w^3 + 9/2*w^2 + 19/2*w - 8], [881, 881, -7/2*w^3 + 11/2*w^2 + 25/2*w - 10], [911, 911, w^3 - w^2 + 2*w - 1], [911, 911, 7/2*w^3 - 11/2*w^2 - 17/2*w + 4], [911, 911, -3*w^3 + 2*w^2 + 11*w + 1], [911, 911, 5/2*w^3 - 7/2*w^2 - 11/2*w + 3], [919, 919, 1/2*w^3 + 1/2*w^2 + 3/2*w - 5], [919, 919, -5/2*w^3 + 7/2*w^2 + 21/2*w - 4], [929, 929, -3/2*w^3 + 9/2*w^2 + 3/2*w - 11], [929, 929, -1/2*w^3 + 1/2*w^2 + 11/2*w + 1], [929, 929, -3/2*w^3 + 3/2*w^2 + 17/2*w - 5], [929, 929, 3/2*w^3 + 3/2*w^2 - 15/2*w - 4], [941, 941, -1/2*w^3 + 5/2*w^2 - 5/2*w - 7], [941, 941, -3/2*w^3 + 7/2*w^2 + 5/2*w - 10], [961, 31, 5/2*w^3 - 5/2*w^2 - 15/2*w + 2], [971, 971, 5/2*w^3 + 1/2*w^2 - 21/2*w - 4], [971, 971, 3*w^3 - 15*w - 5], [971, 971, -2*w^3 + 2*w^2 + 3*w - 5], [971, 971, -5/2*w^3 + 5/2*w^2 + 21/2*w - 10], [991, 991, -3/2*w^3 + 7/2*w^2 + 9/2*w - 2], [991, 991, 1/2*w^3 + 3/2*w^2 - 3/2*w - 10]]; primes := [ideal : I in primesArray]; heckePol := x^2 - 48; K := NumberField(heckePol); heckeEigenvaluesArray := [0, 1, e, 1/2*e + 2, -e - 2, -1/2*e, 6, 1/2*e + 6, 1/2*e - 2, -e - 2, e - 2, -e, e + 8, -2, 6, -e - 4, -e + 4, 1/2*e - 2, -2*e, 3/2*e + 4, 3/2*e - 4, -e + 2, 14, e + 10, 1/2*e - 4, 1/2*e + 12, -10, 2, e - 10, -e, 12, -e, 1/2*e - 14, -e + 2, 2*e + 6, e + 4, 5/2*e - 2, -3/2*e - 4, -2*e - 2, 3/2*e + 2, 2*e + 8, -2*e + 4, -3/2*e + 2, -3*e + 2, 1/2*e - 12, e + 12, -e + 4, e + 14, -22, 6, 1/2*e - 20, -2*e + 6, 14, -3/2*e + 8, 2*e + 10, -4*e + 2, -2*e + 2, 2*e + 4, 4, 2*e - 4, -e - 8, -2, -10, 1/2*e - 26, 16, -4*e + 10, -4, e - 16, 7/2*e - 8, -2*e - 2, e - 26, -4*e - 6, -22, 10, -2*e - 6, -1/2*e - 12, -2*e + 26, -1/2*e - 28, -5/2*e - 10, -3*e, -e - 14, 3/2*e, e + 12, -e + 28, -4*e + 8, e + 20, -3*e - 18, -3/2*e, -2*e + 2, -4*e + 2, -3*e + 8, -e - 24, -e - 16, -2*e + 12, -5/2*e + 12, -3/2*e - 24, 7/2*e, -3*e - 14, -7/2*e + 16, 2*e + 2, 1/2*e + 2, -e - 24, 4*e, -e + 36, -28, 3*e - 8, -e - 32, -2*e - 4, 5/2*e + 16, e + 14, 2*e - 6, -6, 4*e + 12, 4*e - 4, 1/2*e - 22, 3*e + 24, 2*e + 30, 6, -3/2*e + 34, -2*e + 20, 9/2*e + 2, -2*e + 28, -7/2*e - 4, 6*e - 2, 2*e + 6, -3*e + 18, -2*e + 6, -e + 42, -3*e - 20, e + 12, -3*e - 24, -1/2*e - 2, -2*e + 18, -e - 18, -38, -e - 18, -2, -5*e + 10, 4*e - 2, 22, 1/2*e - 4, -3*e + 34, e - 12, e - 28, 3*e - 10, 4*e + 20, 11/2*e - 10, 2*e + 10, 2*e - 22, -5/2*e - 12, -7*e + 6, e - 28, -9/2*e - 6, e + 28, -4*e, 2*e + 16, -2*e + 40, 3/2*e + 36, 9/2*e + 8, 2*e - 6, -2*e - 30, -e + 10, 7/2*e + 16, -11/2*e + 16, 2*e - 36, -e - 24, 3*e + 16, -e - 24, -16, -3*e - 36]; 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;