/* 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 - 2*x^2 - 9*x + 6; K := NumberField(heckePol); heckeEigenvaluesArray := [e, 1, 1, 0, 0, -2*e, -2*e, -2*e^2 + 2*e + 10, -2*e + 4, -2*e + 4, 2*e + 4, 2*e^2 - 4*e - 12, 2*e^2 - 4*e - 12, -2*e^2 + 4*e + 14, -2*e^2 + 4*e + 14, 2*e - 8, 2*e - 8, -2*e, -2*e, -2*e^2 + 2*e + 14, -2*e^2 + 4*e + 12, -2*e^2 + 4*e + 12, 2*e^2 - 2*e - 14, 2*e^2 - 2*e - 14, -4, -4, 2*e^2 - 2*e - 8, 2*e^2 - 2*e - 8, -2*e^2 + 20, -2*e^2 + 20, -2*e^2 + 2*e + 10, -2*e^2 + 2*e + 10, -2*e + 4, -2*e + 4, 8, 8, -4*e + 8, -4*e + 8, 4*e - 8, 4*e - 8, 2*e^2 - 8*e - 14, 2*e^2 - 8*e - 14, 4*e, 4*e, 8, 2*e^2 + 2*e - 16, 2*e^2 + 2*e - 16, 8, 2*e^2 - 4*e - 12, 2*e^2 - 4*e - 12, -12, -12, -2*e^2 + 8*e + 16, -2*e^2 + 8*e + 16, -2*e^2 + 2*e + 16, -2*e^2 + 2*e + 16, 2*e^2 - 6*e - 26, 2*e^2 - 6*e - 26, 4*e + 18, 6*e^2 - 8*e - 32, 6*e^2 - 8*e - 32, 2*e^2 - 6*e - 30, 2*e^2 - 6*e - 30, -8*e + 4, 4*e^2 - 28, 4*e^2 - 28, -8*e + 4, -4*e^2 + 4*e + 32, -4*e^2 + 4*e + 32, -2*e^2 - 2*e + 12, 2*e^2 - 4*e - 6, 2*e^2 - 4*e - 6, -2*e^2 - 2*e + 12, 2*e + 16, 2*e + 16, -2*e^2 - 2*e + 6, -12*e + 6, -12*e + 6, -2*e^2 - 2*e + 6, 2*e^2 + 8*e - 28, 2*e^2 + 8*e - 28, 2*e^2 - 4*e - 16, 2*e^2 - 4*e - 16, 2*e - 16, 2*e - 16, -16, -16, 8*e - 20, 8*e - 20, 4*e - 20, 4*e - 20, -2*e^2 + 10*e + 18, -2*e^2 + 10*e + 18, -2*e^2 + 12*e + 16, -2*e^2 + 40, 8*e - 10, 2*e^2 + 4*e - 4, 8*e - 10, 2*e^2 + 4*e - 4, -2*e^2 + 8*e + 12, -2*e^2 + 8*e + 12, -2*e + 28, -2*e + 28, 4*e^2 - 8*e - 16, 4*e^2 - 8*e - 16, 4*e^2 - 2*e - 30, 2*e + 14, 2*e + 14, 4*e^2 - 2*e - 30, -16, 6*e^2 - 8*e - 36, 6*e^2 - 8*e - 36, -16, 2*e^2 - 2, 2*e^2 - 2, 4*e^2 - 8*e - 24, -4*e - 16, -4*e - 16, 4*e^2 - 8*e - 24, -2*e^2 + 8*e + 36, -2*e^2 + 8*e + 36, -4*e^2 + 16*e + 20, -4*e^2 + 16*e + 20, 8*e + 4, 8*e + 4, -4*e^2 + 8*e + 48, 4*e^2 - 16*e - 32, -4*e^2 + 8*e + 48, 4*e^2 - 16*e - 32, 4*e^2 - 4*e - 12, 4*e^2 - 4*e - 12, -4*e^2 - 10*e + 48, 4*e^2 - 16*e - 14, 4*e^2 - 16*e - 14, -4*e^2 - 10*e + 48, -4*e^2 + 2*e + 32, -2*e^2 + 6*e - 20, -4*e^2 + 2*e + 32, -2*e^2 + 6*e - 20, 4*e^2 - 2*e, 4*e^2 - 2*e, 2*e^2, 2*e^2, 2*e^2 + 2*e - 48, 2*e^2 + 2*e - 48, -2*e^2 + 10*e + 24, -2*e^2 + 10*e + 24, 2*e^2 - 48, 2*e^2 - 48, -2*e^2 - 8*e + 12, -2*e^2 - 8*e + 12, -4*e - 14, -4*e - 14, -2*e^2 + 12*e + 16, 2*e + 52, 4*e^2 - 32, 4*e^2 - 32, 4*e^2 + 2*e - 32, 4*e^2 + 2*e - 32, -4*e^2 + 8*e + 8, -4*e^2 + 8*e + 8]; 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;