/* 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, -3, -2, 1]; F := NumberField(g); ZF := Integers(F); NN := ideal; primesArray := [ [4, 2, w^3 - 2*w^2 - 2*w + 1], [7, 7, -w^3 + 3*w^2 + w - 3], [7, 7, -w^2 + w + 2], [17, 17, -w^3 + 3*w^2 - 3], [17, 17, -w^3 + w^2 + 4*w], [25, 5, -w^3 + 3*w^2 + 2*w - 2], [25, 5, -2*w^3 + 4*w^2 + 5*w - 1], [41, 41, -w^3 + 2*w^2 + 4*w - 2], [47, 47, -2*w^3 + 5*w^2 + 4*w - 4], [47, 47, 2*w^3 - 4*w^2 - 5*w], [49, 7, w^2 - 4*w - 1], [71, 71, 2*w - 3], [71, 71, -w^3 + w^2 + 6*w - 2], [73, 73, -w^3 + 3*w^2 + 3*w - 5], [73, 73, 2*w^3 - 5*w^2 - 5*w + 4], [73, 73, -w^3 + 3*w^2 - 5], [73, 73, w^3 - w^2 - 4*w + 2], [79, 79, 2*w^3 - 3*w^2 - 6*w + 2], [79, 79, 2*w^3 - 3*w^2 - 5*w], [81, 3, -3], [89, 89, -w^3 + w^2 + 5*w - 3], [89, 89, w - 4], [97, 97, -3*w^3 + 7*w^2 + 6*w - 5], [97, 97, -2*w^3 + 3*w^2 + 7*w - 2], [103, 103, -w - 3], [103, 103, -w^3 + 2*w^2 + 3*w - 5], [103, 103, -w^3 + 4*w^2 - w - 5], [103, 103, -3*w^3 + 6*w^2 + 7*w - 3], [113, 113, w^3 - 4*w^2 + w + 4], [113, 113, 2*w^2 - 3*w - 4], [113, 113, 3*w^3 - 6*w^2 - 7*w + 4], [113, 113, -2*w^3 + 6*w^2 + 2*w - 7], [137, 137, -w^3 + 4*w^2 - 4], [137, 137, w^3 - 4*w^2 + 6], [151, 151, -3*w^3 + 8*w^2 + 3*w - 4], [151, 151, -2*w^3 + 2*w^2 + 7*w + 4], [167, 167, -2*w^3 + 3*w^2 + 6*w - 3], [167, 167, -2*w^3 + 5*w^2 + 2*w - 6], [191, 191, w^3 - 2*w^2 - w + 5], [191, 191, -w^3 + 5*w^2 - 3*w - 3], [193, 193, -w^3 + 2*w^2 + 5*w - 2], [193, 193, -2*w^3 + 4*w^2 + 7*w - 4], [199, 199, -2*w^3 + 5*w^2 + 4*w - 2], [199, 199, w^2 - 5], [223, 223, -w^3 + 8*w - 2], [223, 223, -2*w^3 + 2*w^2 + 9*w], [223, 223, -3*w^3 + 5*w^2 + 11*w - 1], [223, 223, -w^3 + 4*w^2 + w - 8], [233, 233, -3*w^3 + 7*w^2 + 6*w - 4], [233, 233, w^3 - w^2 - 2*w - 3], [239, 239, -w^3 + 6*w], [239, 239, 2*w^3 - 5*w^2 - 4*w + 1], [257, 257, -3*w^3 + 7*w^2 + 7*w - 5], [257, 257, 3*w^3 - 7*w^2 - 5*w + 1], [263, 263, w^3 - w^2 - 4*w - 5], [263, 263, -2*w^3 + 3*w^2 + 9*w - 4], [281, 281, -w^3 + 3*w^2 + 4*w - 6], [281, 281, 3*w^3 - 7*w^2 - 8*w + 5], [289, 17, -3*w^3 + 6*w^2 + 6*w - 4], [311, 311, -3*w^3 + 5*w^2 + 11*w - 3], [311, 311, w - 5], [313, 313, -2*w^3 + 6*w^2 + w - 9], [313, 313, -w^3 + 3*w^2 + 3*w - 7], [359, 359, 3*w^3 - 6*w^2 - 8*w], [359, 359, -w^2 + 3*w - 4], [359, 359, w^3 - w^2 - 5*w - 5], [359, 359, w^3 - 2*w^2 - 4], [383, 383, -4*w^3 + 8*w^2 + 9*w - 3], [383, 383, -w^3 + 5*w^2 - 3*w - 7], [401, 401, -3*w^3 + 8*w^2 + 3*w - 9], [401, 401, -3*w^3 + 7*w^2 + 6*w - 3], [401, 401, w^3 - w^2 - 2*w - 4], [401, 401, -2*w^3 + 2*w^2 + 7*w - 1], [439, 439, -4*w^3 + 9*w^2 + 7*w - 6], [439, 439, 3*w^3 - 5*w^2 - 7*w + 1], [449, 449, -4*w^3 + 9*w^2 + 9*w - 6], [449, 449, 2*w^3 - 2*w^2 - 11*w - 2], [449, 449, -w^3 + 5*w^2 - 3*w - 11], [449, 449, -3*w^3 + 5*w^2 + 10*w - 5], [457, 457, -2*w^3 + 2*w^2 + 9*w - 1], [457, 457, w^3 - 4*w^2 + 3*w + 5], [463, 463, 3*w^2 - 5*w - 6], [463, 463, -w^3 + 5*w^2 - 3*w - 5], [479, 479, -2*w^3 + 3*w^2 + 9*w - 2], [479, 479, -w^3 + w^2 + 7*w - 1], [487, 487, -2*w^2 + 5*w + 6], [487, 487, -w^3 + 7*w - 2], [487, 487, -w^3 + 6*w - 2], [487, 487, -w^3 + 4*w^2 - 2*w - 8], [503, 503, w^3 - 4*w - 6], [503, 503, -3*w^3 + 8*w^2 + 4*w - 4], [521, 521, 3*w^2 - 4*w - 7], [521, 521, 2*w^3 - 7*w^2 + 6], [529, 23, -w^3 + 2*w^2 + 2*w - 6], [529, 23, w^3 - 2*w^2 - 2*w - 4], [569, 569, 2*w^3 - 7*w^2 - 2*w + 7], [569, 569, 4*w^3 - 7*w^2 - 10*w + 4], [569, 569, 3*w^3 - 4*w^2 - 13*w], [569, 569, 4*w^3 - 8*w^2 - 11*w + 3], [577, 577, 4*w^2 - 7*w - 10], [577, 577, w^3 + w^2 - 6*w - 9], [593, 593, w^3 - 4*w^2 + 2*w - 2], [593, 593, 3*w^3 - 10*w^2 + w + 11], [601, 601, -2*w^3 + 4*w^2 + 8*w - 3], [601, 601, -2*w^3 + 4*w^2 + 8*w - 5], [617, 617, 5*w^3 - 12*w^2 - 11*w + 11], [617, 617, 3*w^2 - 4*w - 5], [617, 617, -2*w^3 + 7*w^2 - 8], [617, 617, 5*w^3 - 10*w^2 - 13*w + 11], [631, 631, -3*w^2 + 8*w + 5], [631, 631, 2*w^3 - 7*w^2 - w + 10], [631, 631, 5*w^3 - 11*w^2 - 10*w + 9], [631, 631, 2*w^3 - w^2 - 12*w], [641, 641, -3*w^3 + 8*w^2 + 5*w - 5], [641, 641, 2*w^2 - w - 7], [647, 647, -2*w^3 + 2*w^2 + 11*w - 1], [647, 647, 2*w^3 - 2*w^2 - 11*w - 1], [647, 647, -3*w^3 + 9*w^2 + 4*w - 10], [647, 647, w^3 - 5*w^2 + 6], [673, 673, -5*w^3 + 11*w^2 + 12*w - 8], [673, 673, 3*w^3 - 5*w^2 - 10*w + 6], [719, 719, -3*w^3 + 4*w^2 + 10*w - 2], [719, 719, -3*w^3 + 8*w^2 + 2*w - 8], [727, 727, -w^3 + 5*w^2 - 2*w - 6], [727, 727, -w^3 + 5*w^2 - 2*w - 7], [743, 743, -5*w^3 + 10*w^2 + 13*w - 4], [743, 743, -4*w^3 + 9*w^2 + 10*w - 6], [743, 743, 2*w^3 - 2*w^2 - 10*w + 3], [743, 743, w^2 + 2*w - 5], [751, 751, -w^3 + 4*w^2 - 3*w - 6], [751, 751, 2*w^3 - 2*w^2 - 9*w + 2], [761, 761, 4*w^3 - 9*w^2 - 6*w + 4], [761, 761, 3*w^3 - 3*w^2 - 12*w - 1], [761, 761, 3*w^3 - 9*w^2 + 8], [761, 761, 4*w^3 - 7*w^2 - 10*w + 1], [769, 769, 4*w^3 - 7*w^2 - 10*w + 3], [769, 769, -4*w^3 + 7*w^2 + 14*w - 5], [769, 769, 4*w^3 - 9*w^2 - 6*w + 6], [769, 769, -w^2 + 6*w], [809, 809, -2*w^3 + 2*w^2 + 7*w - 3], [809, 809, -3*w^3 + 8*w^2 + 3*w - 11], [823, 823, 3*w^3 - 8*w^2 - 7*w + 6], [823, 823, -2*w^3 + 6*w^2 + 5*w - 10], [839, 839, -3*w^3 + 5*w^2 + 12*w - 1], [839, 839, -w^3 + w^2 + 8*w - 4], [887, 887, -4*w^3 + 9*w^2 + 5*w - 6], [887, 887, -5*w^3 + 9*w^2 + 13*w - 5], [919, 919, -4*w^3 + 6*w^2 + 14*w - 3], [919, 919, -5*w^3 + 12*w^2 + 9*w - 8], [929, 929, -2*w^3 + 3*w^2 + 10*w - 5], [929, 929, -2*w^3 + 3*w^2 + 10*w], [937, 937, -3*w^3 + 7*w^2 + 8*w - 3], [937, 937, -w^3 + 3*w^2 + 4*w - 8], [961, 31, -4*w^3 + 8*w^2 + 8*w - 5], [961, 31, -4*w^3 + 8*w^2 + 8*w - 3], [967, 967, 4*w^3 - 8*w^2 - 7*w + 1], [967, 967, -5*w^3 + 10*w^2 + 11*w - 3], [977, 977, 3*w^3 - 8*w^2 - w + 7], [977, 977, -4*w^3 + 6*w^2 + 13*w - 3], [991, 991, w^2 - w - 8], [991, 991, -3*w^3 + 5*w^2 + 12*w - 5]]; primes := [ideal : I in primesArray]; heckePol := x^3 - x^2 - 5*x + 1; K := NumberField(heckePol); heckeEigenvaluesArray := [e, -e^2 + 5, -1/2*e^2 + e + 7/2, -e^2 + 2*e + 5, e^2 - 2*e - 5, 2*e^2 - e - 5, e^2 - 3, e - 1, -1, -1/2*e^2 - e + 7/2, 1/2*e^2 - e - 3/2, e^2 - 4*e - 1, 5/2*e^2 - e - 31/2, -e^2 + 2*e + 5, 9/2*e^2 - 5*e - 31/2, -6*e, -5/2*e^2 + 3*e + 19/2, -e^2 - 3*e + 6, 3*e^2 - 6*e - 9, 3*e^2 - 17, 1/2*e^2 - 5*e + 1/2, -2*e^2 - e + 15, -1/2*e^2 - e + 11/2, -4*e + 2, -1/2*e^2 - e - 5/2, -2*e + 10, -5*e^2 + 5*e + 14, 3*e^2 + e - 10, 5/2*e^2 - e - 35/2, e^2 - 4*e - 3, -5/2*e^2 + e + 3/2, -3/2*e^2 + e + 5/2, -2*e - 4, 11/2*e^2 - 5*e - 25/2, 11/2*e^2 - 3*e - 45/2, 3*e^2 - 11, 3*e^2 - 4*e - 11, -2*e + 2, -2*e^2 + 10, -1/2*e^2 - 7*e + 11/2, 5/2*e^2 + 7*e - 39/2, -3*e - 17, e^2 + e + 8, e^2 - 4*e + 3, -11/2*e^2 + 7*e + 53/2, 6*e^2 - 8*e - 10, e^2 - e - 14, 5*e^2 - 2*e - 15, -e^2 + 2*e + 5, 9/2*e^2 - 5*e - 11/2, -1/2*e^2 + 3*e + 23/2, -6*e^2 + 12*e + 18, -4*e^2 + 12*e + 10, -e^2 - 2*e + 1, -5/2*e^2 + e + 55/2, -9/2*e^2 + 11*e + 31/2, -2*e^2 - 4*e, e^2 + 4*e - 3, 7/2*e^2 - 9*e - 5/2, -9/2*e^2 + 9*e + 23/2, 5*e^2 + e - 28, -7/2*e^2 - e + 45/2, 1/2*e^2 + 5*e + 9/2, e^2 - 4*e - 25, -4*e^2 + 12*e + 12, 9*e^2 - 11*e - 24, 1/2*e^2 + 3*e + 21/2, 3/2*e^2 + 3*e - 53/2, -13/2*e^2 + 9*e + 27/2, -e^2 - 6*e + 5, 7*e^2 - 4*e - 5, -2*e^2 + 3*e + 27, -8*e^2 + 6*e + 24, -7/2*e^2 + e + 1/2, -4*e^2 - 4*e + 20, 5*e^2 - 4*e - 19, e^2 - 6*e + 15, 2*e^2 + 8*e - 32, -11/2*e^2 + 5*e + 45/2, -17/2*e^2 + 7*e + 59/2, -15/2*e^2 + 7*e + 1/2, -6*e^2 + 10*e + 36, -e^2 + 3*e, 8*e^2 + 6*e - 42, -9*e^2 + 2*e + 39, -17/2*e^2 + 11*e + 55/2, 10*e^2 - 12*e - 38, 23/2*e^2 - 11*e - 49/2, -e^2 + 8*e - 15, 2*e + 6, -9*e^2 + 15*e + 36, 10*e^2 - 10*e - 18, -2*e^2 - 4*e - 12, -2*e^2 + 3*e - 9, -17/2*e^2 + 7*e + 47/2, -4*e^2 + 10*e + 24, 1/2*e^2 - 7*e - 7/2, -9*e^2 + 14*e + 41, -7*e^2 + 2*e + 11, 3*e^2 - 10*e + 5, 6*e^2 - 8*e - 16, 2*e^2 - 10*e + 6, -8*e^2 + 15*e + 41, -17/2*e^2 + 7*e + 35/2, -e^2 + 10*e + 9, -4*e^2 - 3*e + 3, 2*e + 28, -5*e^2 + 6*e + 25, -1/2*e^2 - 7*e - 21/2, e^2 - 8*e + 11, -8*e^2 + 20*e + 36, 7*e^2 + 8*e - 35, 5*e^2 - 8*e - 25, -5/2*e^2 + e + 31/2, -e^2 + 6*e + 17, 5/2*e^2 + 5*e - 7/2, -5*e^2 + e + 34, 11/2*e^2 + 9*e - 73/2, -e^2 - 6*e + 35, e^2 - 10*e - 9, -9/2*e^2 + 7*e + 43/2, 11*e^2 - 22*e - 45, 12*e^2 - 8*e - 32, 5*e^2 + 8*e - 29, -e^2 + 4*e + 13, -13*e^2 + 5*e + 46, 2*e^2 - 20*e - 14, 5/2*e^2 + 9*e - 23/2, -5*e^2 + 5*e - 6, -3/2*e^2 - 7*e + 45/2, -11*e^2 + 18*e + 33, -6*e^2 + 15*e + 7, -7/2*e^2 - 7*e + 61/2, 3/2*e^2 - e - 33/2, 6*e^2 + 4*e - 24, -8*e^2 + 18*e + 16, -3*e^2 + 14*e + 3, -8*e^2 + 8*e + 26, 25/2*e^2 - 13*e - 75/2, -2*e^2 - 16*e + 16, -2*e^2 + 14*e + 26, -11*e^2 - 5*e + 38, e^2 - 4*e + 3, 14*e - 26, 14*e^2 - 54, 2*e^2 - 34, -4*e + 12, -11/2*e^2 + 25*e + 45/2, -9*e^2 + 49, 15/2*e^2 - 9*e - 93/2, -7*e^2 + 2*e + 47, 6*e^2 - 20*e - 48, -3*e^2 + 16*e + 21, 3*e^2 - 4*e - 5, -10*e^2 + 20*e + 24, -7*e^2 + 24*e + 19, -3*e^2 - 13*e + 2, -6*e^2 - 14*e + 26, 14*e + 16, -13/2*e^2 - 9*e + 103/2, -5*e^2 + 6*e - 17]; 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;