/* 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, 5, -4, -2, 1]; F := NumberField(g); ZF := Integers(F); NN := ideal; primesArray := [ [5, 5, w + 1], [5, 5, -w + 2], [7, 7, -w^2 + 2*w + 1], [7, 7, -w^2 + 2], [9, 3, w^3 - w^2 - 4*w], [16, 2, 2], [17, 17, -w^3 + 2*w^2 + 3*w - 2], [17, 17, -w^3 + w^2 + 4*w - 2], [25, 5, w^2 - w - 3], [37, 37, 2*w - 1], [43, 43, -w^3 + 2*w^2 + 2*w - 2], [43, 43, w^3 - w^2 - 3*w + 1], [59, 59, 2*w - 5], [59, 59, -2*w - 3], [79, 79, -w^3 + 2*w^2 + 5*w - 4], [79, 79, -w^3 + w^2 + 6*w - 2], [83, 83, -w^3 + 7*w], [83, 83, -w^3 + 2*w^2 + 4*w - 2], [83, 83, -w^3 + w^2 + 5*w - 3], [83, 83, w^2 - 2*w - 6], [89, 89, w^2 - 2*w - 4], [89, 89, w^2 - 5], [101, 101, -2*w^3 + 5*w^2 + 5*w - 11], [101, 101, w^2 + w - 4], [101, 101, w^2 - 3*w - 2], [101, 101, 2*w^3 - w^2 - 9*w - 3], [109, 109, w^3 - w^2 - 6*w - 3], [109, 109, -w^3 + 2*w^2 + 5*w - 9], [121, 11, w^3 - 8*w], [121, 11, w^3 - 3*w^2 - 5*w + 7], [131, 131, w^3 - 5*w - 6], [131, 131, -w^3 + 3*w^2 + 2*w - 10], [163, 163, 2*w^2 - 3*w - 6], [163, 163, 2*w^2 - w - 7], [167, 167, w^3 - w^2 - 3*w - 4], [167, 167, -w^3 + 2*w^2 + 2*w - 7], [193, 193, 2*w^3 - 3*w^2 - 7*w + 2], [193, 193, 2*w^3 - 3*w^2 - 7*w + 6], [227, 227, 2*w^3 - 3*w^2 - 8*w + 1], [227, 227, -2*w^3 + 3*w^2 + 8*w - 8], [251, 251, 2*w^2 - w - 9], [251, 251, 2*w^2 - 3*w - 8], [257, 257, w^3 + w^2 - 8*w - 7], [257, 257, -4*w^3 + 5*w^2 + 17*w - 1], [269, 269, 2*w^3 - 2*w^2 - 10*w + 3], [269, 269, 2*w^3 - 3*w^2 - 9*w + 2], [269, 269, 2*w^3 - 3*w^2 - 9*w + 8], [269, 269, -2*w^3 + 4*w^2 + 8*w - 7], [277, 277, w^3 - w^2 - 4*w - 4], [277, 277, -w^3 + 2*w^2 + 3*w - 8], [289, 17, 2*w^2 - 2*w - 3], [293, 293, -w^2 - 2*w + 5], [293, 293, -w^3 + 3*w^2 + 3*w - 4], [293, 293, w^3 - 6*w + 1], [293, 293, -2*w^3 + 4*w^2 + 7*w - 6], [311, 311, -w^3 + 3*w^2 + w - 7], [311, 311, w^3 - 4*w - 4], [331, 331, -2*w^3 + 4*w^2 + 9*w - 10], [331, 331, 2*w^3 - 2*w^2 - 11*w + 1], [337, 337, 2*w^2 - 3*w - 4], [337, 337, -w^3 + 2*w^2 + 6*w - 3], [337, 337, w^3 - w^2 - 7*w + 4], [337, 337, 2*w^2 - w - 5], [353, 353, -3*w^3 + 4*w^2 + 13*w - 2], [353, 353, 3*w^3 - 5*w^2 - 12*w + 12], [373, 373, -2*w^3 + 6*w^2 + 3*w - 11], [373, 373, -w^3 - w^2 + 6*w + 7], [373, 373, -w^3 + 4*w^2 + w - 11], [373, 373, 2*w^3 - 9*w - 4], [379, 379, w^3 - w^2 - 7*w + 1], [379, 379, 3*w^3 - 7*w^2 - 7*w + 11], [379, 379, 3*w^3 - 2*w^2 - 12*w], [379, 379, -w^3 + 2*w^2 + 6*w - 6], [383, 383, -3*w^3 + 4*w^2 + 12*w - 8], [383, 383, 3*w^3 - 5*w^2 - 11*w + 5], [421, 421, 2*w^3 - 2*w^2 - 9*w - 4], [421, 421, -2*w^3 + 4*w^2 + 7*w - 13], [457, 457, -w^3 + 2*w^2 + 6*w - 5], [457, 457, w^3 - w^2 - 7*w + 2], [461, 461, -w^3 + 3*w^2 + 4*w - 4], [461, 461, -w^3 + 7*w - 2], [463, 463, -w^3 + 4*w^2 + 3*w - 10], [463, 463, w^3 + w^2 - 8*w - 4], [467, 467, -w^3 + 6*w - 2], [467, 467, -w^3 + 3*w^2 + 3*w - 3], [479, 479, -w^3 + w^2 + w - 4], [479, 479, w^3 - 2*w^2 - 3], [487, 487, -3*w^3 + 4*w^2 + 12*w - 3], [487, 487, -3*w^3 + 5*w^2 + 11*w - 10], [499, 499, 3*w^3 - 4*w^2 - 11*w + 8], [499, 499, 3*w^3 - 5*w^2 - 10*w + 4], [503, 503, -w^3 + 2*w^2 + w - 5], [503, 503, w^3 - w^2 - 2*w - 3], [521, 521, 2*w^3 - 4*w^2 - 6*w + 3], [521, 521, -w^3 + 10*w - 8], [521, 521, w^3 - 3*w^2 - 7*w + 1], [521, 521, -2*w^3 + 2*w^2 + 8*w - 5], [541, 541, 2*w - 7], [541, 541, 2*w + 5], [547, 547, w^3 - 4*w^2 + 7], [547, 547, w^3 + w^2 - 5*w - 4], [563, 563, -2*w^3 + 4*w^2 + 7*w - 5], [563, 563, -2*w^3 + 2*w^2 + 9*w - 4], [587, 587, -w^3 - w^2 + 4*w + 6], [587, 587, w^3 - 4*w^2 + w + 8], [593, 593, w^2 + w - 7], [593, 593, 2*w^3 - 5*w^2 - 4*w + 5], [593, 593, -2*w^3 + w^2 + 8*w - 2], [593, 593, w^2 - 3*w - 5], [613, 613, 2*w^3 - 3*w^2 - 11*w + 2], [613, 613, w^3 + w^2 - 6*w - 3], [613, 613, 3*w^3 - 4*w^2 - 12*w + 4], [613, 613, 2*w^3 - 3*w^2 - 11*w + 10], [631, 631, -w^3 - w^2 + 7*w + 6], [631, 631, -w^3 + 4*w^2 + 2*w - 11], [647, 647, w^2 - 4*w - 3], [647, 647, w^2 + 2*w - 6], [677, 677, w^2 + w - 8], [677, 677, -w^3 + 7*w - 3], [677, 677, -w^3 + 3*w^2 + 4*w - 3], [677, 677, w^2 - 3*w - 6], [709, 709, w^3 - 7*w - 8], [709, 709, w^3 - 3*w^2 - 4*w + 14], [739, 739, w^3 - w^2 - 4*w - 5], [739, 739, -3*w^3 + 3*w^2 + 16*w - 3], [739, 739, -3*w^3 + 6*w^2 + 13*w - 13], [739, 739, -w^3 + 2*w^2 + 3*w - 9], [751, 751, -w - 5], [751, 751, w^3 + w^2 - 7*w - 4], [751, 751, -w^3 + 4*w^2 + 2*w - 9], [751, 751, w - 6], [757, 757, -w^3 + 4*w^2 + 2*w - 10], [757, 757, w^3 + w^2 - 7*w - 5], [761, 761, -3*w^3 + 2*w^2 + 17*w - 1], [761, 761, -3*w^3 + 6*w^2 + 9*w - 17], [761, 761, 2*w^3 - 5*w^2 - 9*w + 9], [761, 761, 2*w^3 - 2*w^2 - 7*w - 6], [773, 773, -3*w^3 + 8*w^2 + 6*w - 12], [773, 773, w^3 - 4*w - 6], [773, 773, -w^3 + 3*w^2 + w - 9], [773, 773, -3*w^3 + w^2 + 13*w + 1], [797, 797, 3*w^3 - 2*w^2 - 13*w + 1], [797, 797, 3*w^3 - 7*w^2 - 8*w + 11], [823, 823, 2*w^3 - 3*w^2 - 6*w - 4], [823, 823, -2*w^3 + 3*w^2 + 7*w + 3], [823, 823, w^3 - 2*w^2 - 7*w - 3], [823, 823, -3*w^3 + 5*w^2 + 9*w - 2], [857, 857, 2*w^3 - w^2 - 10*w + 1], [857, 857, -2*w^3 + 5*w^2 + 6*w - 8], [883, 883, 3*w^3 - 3*w^2 - 12*w + 1], [883, 883, 3*w^3 - 6*w^2 - 9*w + 11], [887, 887, -2*w^3 + 5*w^2 + 7*w - 9], [887, 887, -4*w^3 + 6*w^2 + 17*w - 7], [887, 887, -2*w^3 + 5*w^2 + 9*w - 16], [887, 887, 2*w^3 - w^2 - 11*w + 1], [907, 907, -3*w^3 + 3*w^2 + 16*w - 2], [907, 907, -3*w^3 + 6*w^2 + 13*w - 14], [919, 919, 2*w^3 - 2*w^2 - 7*w + 9], [919, 919, -2*w^3 + 2*w^2 + 12*w - 5], [929, 929, -2*w^3 + 4*w^2 + 8*w - 5], [929, 929, 3*w^3 - 4*w^2 - 11*w + 12], [929, 929, 3*w^3 - 5*w^2 - 10*w], [929, 929, -2*w^3 + 2*w^2 + 10*w - 5], [967, 967, 3*w^3 - 5*w^2 - 9*w + 11], [967, 967, -3*w^3 + 7*w^2 + 6*w - 10], [971, 971, 2*w^3 - 2*w^2 - 7*w - 5], [971, 971, -2*w^3 + w^2 + 8*w - 3], [971, 971, 2*w^3 - 5*w^2 - 4*w + 4], [971, 971, -2*w^3 + 4*w^2 + 5*w - 12], [983, 983, 4*w - 7], [983, 983, 2*w^2 - 4*w - 7], [983, 983, 2*w^2 - 9], [983, 983, 4*w + 3], [991, 991, 2*w^3 - 6*w^2 - 5*w + 14], [991, 991, -2*w^3 + 11*w + 5]]; primes := [ideal : I in primesArray]; heckePol := x^4 - 16*x^2 + 4; K := NumberField(heckePol); heckeEigenvaluesArray := [e, 1/2*e^3 - 8*e, 1/2*e^2 - 3, -1/2*e^2 + 5, -1, 1, -1/2*e^3 + 9*e, 1/2*e^3 - 9*e, 4, 6, 1/2*e^2 - 3, -1/2*e^2 + 5, 1/2*e^3 - 11*e, -3/2*e^3 + 25*e, e^2 - 6, -e^2 + 10, -3/2*e^3 + 23*e, -1/2*e^3 + 9*e, 1/2*e^3 - 9*e, -1/2*e^3 + 5*e, -1/2*e^3 + 7*e, -1/2*e^3 + 7*e, 3/2*e^3 - 20*e, -1/2*e^3 + 9*e, 1/2*e^3 - 9*e, 2*e^3 - 29*e, e^2 - 14, -e^2 + 2, e^2, -e^2 + 16, e^3 - 12*e, 2*e^3 - 30*e, -e^2 + 2, e^2 - 14, -e^3 + 10*e, -3*e^3 + 46*e, -e^2 + 18, e^2 + 2, -2*e^3 + 32*e, -4*e, -7/2*e^3 + 55*e, -1/2*e^3 + e, -3*e^3 + 53*e, 5/2*e^3 - 46*e, -e^3 + 15*e, -1/2*e^3 + 7*e, -1/2*e^3 + 7*e, -1/2*e^3 + 6*e, -2*e^2 + 32, 2*e^2, -10, -3/2*e^3 + 22*e, 7/2*e^3 - 53*e, 3/2*e^3 - 17*e, -e^3 + 13*e, -3*e^3 + 46*e, -e^3 + 10*e, 1/2*e^2 - 17, -1/2*e^2 - 9, -2, 2*e^2 + 4, -2*e^2 + 36, -2, 9/2*e^3 - 65*e, 7/2*e^3 - 47*e, -26, e^2 + 2, -e^2 + 18, -26, 3/2*e^2 - 11, 1/2*e^2 - 19, -1/2*e^2 - 11, -3/2*e^2 + 13, -2*e^3 + 26*e, -3*e^3 + 44*e, 14, 14, -2*e^2 + 6, 2*e^2 - 26, -3/2*e^3 + 26*e, e^3 - 19*e, -2*e^2 + 24, 2*e^2 - 8, 5/2*e^3 - 41*e, -1/2*e^3 + 13*e, -3/2*e^3 + 17*e, -7/2*e^3 + 53*e, -9/2*e^2 + 41, 9/2*e^2 - 31, 1/2*e^2 - 35, -1/2*e^2 - 27, -1/2*e^3 + 3*e, -5/2*e^3 + 39*e, -9/2*e^3 + 69*e, -e^3 + 11*e, -5/2*e^3 + 38*e, -3/2*e^3 + 15*e, -2*e^2 + 16, 2*e^2 - 16, -8, -8, -11/2*e^3 + 87*e, -1/2*e^3 - 3*e, 9/2*e^3 - 61*e, 11/2*e^3 - 79*e, 7/2*e^3 - 61*e, -1/2*e^3 + 16*e, 4*e^3 - 65*e, -5/2*e^3 + 47*e, -6, -3*e^2 + 30, 3*e^2 - 18, -6, 2*e^2 - 4, -2*e^2 + 28, -6*e^3 + 96*e, -12*e, -9/2*e^3 + 82*e, 9/2*e^3 - 61*e, 11/2*e^3 - 79*e, 5*e^3 - 89*e, -3*e^2 + 50, 3*e^2 + 2, -2*e^2 + 52, -5*e^2 + 34, 5*e^2 - 46, 2*e^2 + 20, 1/2*e^2 - 5, -1/2*e^2 - 7, 1/2*e^2 - 15, -1/2*e^2 + 3, e^2 + 16, -e^2 + 32, -3/2*e^3 + 35*e, e^3 - 9*e, 7/2*e^3 - 54*e, 11/2*e^3 - 91*e, -1/2*e^3 + 13*e, e^3 - 23*e, -7/2*e^3 + 58*e, 5/2*e^3 - 41*e, -3/2*e^3 + 13*e, -11/2*e^3 + 85*e, 2*e^2 - 12, -e^2 - 6, e^2 - 22, -2*e^2 + 20, -3/2*e^3 + 11*e, -13/2*e^3 + 101*e, 3/2*e^2 - 3, -3/2*e^2 + 21, -1/2*e^3 + 17*e, 11/2*e^3 - 93*e, -5/2*e^3 + 51*e, 9/2*e^3 - 73*e, -7/2*e^2 + 5, 7/2*e^2 - 51, 3/2*e^2 - 35, -3/2*e^2 - 11, 15/2*e^3 - 118*e, -3/2*e^3 + 13*e, -11/2*e^3 + 85*e, e^3 - e, 4*e^2 - 16, -4*e^2 + 48, -5/2*e^3 + 27*e, 12*e, 6*e^3 - 96*e, -13/2*e^3 + 99*e, 5*e^3 - 90*e, -5*e^3 + 92*e, 6*e^3 - 106*e, -5*e^3 + 90*e, 1/2*e^2 - 49, -1/2*e^2 - 41]; 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;