/* 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![9, 3, -7, -1, 1]; F := NumberField(g); ZF := Integers(F); NN := ideal; primesArray := [ [5, 5, -1/3*w^3 - 2/3*w^2 + 7/3*w + 4], [5, 5, 1/3*w^3 - 4/3*w^2 - 1/3*w + 3], [9, 3, -w], [9, 3, 1/3*w^3 - 1/3*w^2 - 7/3*w + 1], [16, 2, 2], [19, 19, 2/3*w^3 - 2/3*w^2 - 11/3*w], [19, 19, -1/3*w^3 + 1/3*w^2 + 1/3*w + 1], [31, 31, 2/3*w^3 + 1/3*w^2 - 11/3*w - 2], [31, 31, 2/3*w^3 - 5/3*w^2 - 5/3*w + 5], [41, 41, -1/3*w^3 + 4/3*w^2 + 7/3*w - 6], [41, 41, -1/3*w^3 + 4/3*w^2 + 7/3*w - 3], [61, 61, 1/3*w^3 - 4/3*w^2 + 2/3*w + 4], [61, 61, 2/3*w^3 + 1/3*w^2 - 14/3*w - 2], [71, 71, -1/3*w^3 + 4/3*w^2 + 1/3*w - 7], [71, 71, 1/3*w^3 + 2/3*w^2 - 7/3*w], [89, 89, -1/3*w^3 + 1/3*w^2 + 10/3*w - 3], [89, 89, 1/3*w^3 - 1/3*w^2 - 10/3*w - 1], [101, 101, 1/3*w^3 - 1/3*w^2 - 7/3*w - 3], [101, 101, -2/3*w^3 + 5/3*w^2 + 11/3*w - 4], [101, 101, 2/3*w^3 - 5/3*w^2 - 8/3*w + 3], [101, 101, w - 4], [109, 109, 2/3*w^3 + 1/3*w^2 - 8/3*w - 4], [109, 109, -w^3 + 2*w^2 + 4*w - 4], [121, 11, w^3 - w^2 - 4*w + 1], [121, 11, -w^3 + w^2 + 4*w - 2], [131, 131, 4/3*w^3 - 1/3*w^2 - 22/3*w - 1], [131, 131, -w^3 + 7*w + 2], [139, 139, 2/3*w^3 - 2/3*w^2 - 14/3*w + 1], [139, 139, 2*w - 1], [139, 139, 1/3*w^3 + 5/3*w^2 - 7/3*w - 10], [139, 139, -2/3*w^3 + 8/3*w^2 + 5/3*w - 5], [149, 149, w^3 + w^2 - 7*w - 11], [149, 149, -w^3 - w^2 + 5*w + 4], [151, 151, -2/3*w^3 - 4/3*w^2 + 14/3*w + 5], [151, 151, 2/3*w^3 - 8/3*w^2 - 2/3*w + 9], [169, 13, -2/3*w^3 - 1/3*w^2 + 11/3*w], [169, 13, -2/3*w^3 + 5/3*w^2 + 5/3*w - 7], [179, 179, 4/3*w^3 - 7/3*w^2 - 13/3*w + 6], [179, 179, -4/3*w^3 + 1/3*w^2 + 19/3*w + 1], [181, 181, 5/3*w^3 - 8/3*w^2 - 20/3*w + 5], [181, 181, -1/3*w^3 + 1/3*w^2 + 10/3*w - 1], [181, 181, -4/3*w^3 + 1/3*w^2 + 16/3*w + 3], [191, 191, w^2 - 3*w - 1], [191, 191, -1/3*w^3 + 4/3*w^2 + 10/3*w - 3], [199, 199, -w^3 + 3*w^2 + w - 7], [199, 199, -4/3*w^3 + 1/3*w^2 + 19/3*w - 1], [211, 211, -1/3*w^3 - 5/3*w^2 + 4/3*w + 8], [211, 211, w^3 - 3*w^2 - 4*w + 8], [229, 229, -4/3*w^3 + 4/3*w^2 + 13/3*w - 4], [229, 229, -5/3*w^3 + 5/3*w^2 + 23/3*w - 5], [229, 229, 1/3*w^3 - 7/3*w^2 + 2/3*w + 10], [229, 229, -2/3*w^3 + 2/3*w^2 + 2/3*w - 3], [239, 239, 4/3*w^3 - 1/3*w^2 - 19/3*w - 2], [239, 239, -2/3*w^3 + 2/3*w^2 + 11/3*w - 6], [251, 251, 2*w^2 - w - 8], [251, 251, -1/3*w^3 - 2/3*w^2 + 7/3*w - 2], [251, 251, 1/3*w^3 - 4/3*w^2 - 1/3*w + 9], [251, 251, -1/3*w^3 + 7/3*w^2 + 1/3*w - 7], [269, 269, -5/3*w^3 + 8/3*w^2 + 17/3*w - 8], [269, 269, -5/3*w^3 + 11/3*w^2 + 17/3*w - 12], [271, 271, 1/3*w^3 + 2/3*w^2 - 13/3*w - 3], [271, 271, 1/3*w^3 + 2/3*w^2 - 13/3*w - 2], [311, 311, -1/3*w^3 + 7/3*w^2 - 5/3*w - 8], [311, 311, -w^3 + 5*w - 1], [331, 331, -2/3*w^3 - 1/3*w^2 + 8/3*w + 6], [331, 331, -w^3 + 2*w^2 + 4*w - 2], [349, 349, -w^3 + 2*w^2 + w + 1], [349, 349, 1/3*w^3 - 1/3*w^2 - 7/3*w - 4], [349, 349, -4/3*w^3 + 13/3*w^2 + 10/3*w - 11], [349, 349, w - 5], [361, 19, -4/3*w^3 + 4/3*w^2 + 16/3*w - 3], [379, 379, 7/3*w^3 - 1/3*w^2 - 43/3*w - 9], [379, 379, 2*w^3 - 3*w^2 - 9*w + 8], [401, 401, 1/3*w^3 + 2/3*w^2 - 7/3*w - 8], [401, 401, -1/3*w^3 + 10/3*w^2 - 2/3*w - 15], [401, 401, -4/3*w^3 + 4/3*w^2 + 13/3*w - 3], [401, 401, -1/3*w^3 + 4/3*w^2 - 5/3*w + 3], [409, 409, -5/3*w^3 + 8/3*w^2 + 20/3*w - 7], [409, 409, 4/3*w^3 - 1/3*w^2 - 16/3*w - 1], [419, 419, 4/3*w^3 - 16/3*w^2 - 1/3*w + 10], [419, 419, 5/3*w^3 + 7/3*w^2 - 35/3*w - 17], [421, 421, -2*w^3 + 4*w^2 + 7*w - 10], [421, 421, -5/3*w^3 + 8/3*w^2 + 29/3*w - 7], [421, 421, 1/3*w^3 + 2/3*w^2 + 5/3*w - 4], [421, 421, -5/3*w^3 - 1/3*w^2 + 23/3*w + 5], [431, 431, -2/3*w^3 + 5/3*w^2 + 11/3*w - 1], [431, 431, -w^2 - w + 8], [439, 439, -2/3*w^3 + 11/3*w^2 - 1/3*w - 8], [439, 439, -2/3*w^3 + 11/3*w^2 + 8/3*w - 15], [479, 479, w^3 + 2*w^2 - 6*w - 10], [479, 479, -5/3*w^3 + 5/3*w^2 + 14/3*w], [479, 479, -5/3*w^3 + 5/3*w^2 + 23/3*w - 3], [479, 479, -4/3*w^3 + 4/3*w^2 + 13/3*w - 2], [521, 521, -w^3 + 2*w^2 + 5*w + 1], [521, 521, 1/3*w^3 + 2/3*w^2 - 1/3*w - 10], [541, 541, 1/3*w^3 + 5/3*w^2 + 2/3*w - 7], [541, 541, 5/3*w^3 - 5/3*w^2 - 26/3*w], [569, 569, -w - 5], [569, 569, 1/3*w^3 - 1/3*w^2 - 7/3*w + 6], [571, 571, w^3 - 4*w - 8], [571, 571, -1/3*w^3 + 7/3*w^2 + 7/3*w - 4], [599, 599, 5/3*w^3 - 5/3*w^2 - 14/3*w + 4], [599, 599, -4/3*w^3 + 13/3*w^2 + 13/3*w - 15], [599, 599, 2*w^3 - 3*w^2 - 8*w + 5], [599, 599, 7/3*w^3 - 7/3*w^2 - 34/3*w + 6], [601, 601, -4/3*w^3 + 13/3*w^2 + 13/3*w - 13], [601, 601, -w^3 + 8*w + 5], [619, 619, -5/3*w^3 + 11/3*w^2 + 17/3*w - 13], [619, 619, 4/3*w^3 + 2/3*w^2 - 19/3*w - 2], [631, 631, w^3 - w^2 - 7*w + 1], [631, 631, 3*w - 2], [641, 641, -2/3*w^3 + 5/3*w^2 + 2/3*w - 7], [641, 641, -1/3*w^3 + 7/3*w^2 - 5/3*w - 9], [661, 661, -5/3*w^3 + 11/3*w^2 + 20/3*w - 9], [661, 661, w^3 + w^2 - 4*w - 7], [691, 691, -5/3*w^3 + 8/3*w^2 + 17/3*w - 6], [691, 691, 2*w^2 - 3*w - 10], [691, 691, 5/3*w^3 - 2/3*w^2 - 23/3*w - 1], [691, 691, 1/3*w^3 + 5/3*w^2 - 13/3*w - 3], [701, 701, 2/3*w^3 + 4/3*w^2 - 20/3*w - 11], [701, 701, -2/3*w^3 - 1/3*w^2 + 17/3*w + 9], [709, 709, -2/3*w^3 - 7/3*w^2 + 17/3*w + 11], [709, 709, -1/3*w^3 + 10/3*w^2 - 2/3*w - 8], [709, 709, -2/3*w^3 + 11/3*w^2 - 1/3*w - 10], [709, 709, 3*w^2 - 2*w - 14], [719, 719, 7/3*w^3 + 8/3*w^2 - 46/3*w - 21], [719, 719, -2*w^3 + 7*w^2 + 2*w - 13], [719, 719, 2/3*w^3 + 7/3*w^2 - 14/3*w - 9], [719, 719, -w^3 + 4*w^2 + 2*w - 13], [761, 761, 1/3*w^3 + 5/3*w^2 - 1/3*w - 8], [761, 761, 5/3*w^3 - 2/3*w^2 - 14/3*w + 1], [761, 761, -8/3*w^3 + 11/3*w^2 + 38/3*w - 11], [761, 761, -4/3*w^3 + 10/3*w^2 + 19/3*w - 9], [809, 809, -2/3*w^3 + 11/3*w^2 + 5/3*w - 15], [809, 809, 3*w^2 - w - 8], [811, 811, 2/3*w^3 + 7/3*w^2 - 14/3*w - 11], [811, 811, 1/3*w^3 + 8/3*w^2 - 13/3*w - 10], [811, 811, 1/3*w^3 - 10/3*w^2 + 5/3*w + 11], [811, 811, -w^3 + 4*w^2 + 2*w - 11], [821, 821, 2*w^3 - w^2 - 12*w - 5], [821, 821, 1/3*w^3 + 5/3*w^2 - 7/3*w - 14], [829, 829, -2/3*w^3 + 11/3*w^2 + 5/3*w - 10], [829, 829, 3*w^2 - w - 13], [839, 839, 4/3*w^3 - 1/3*w^2 - 25/3*w + 1], [839, 839, -2/3*w^3 + 5/3*w^2 - 1/3*w - 6], [841, 29, 5/3*w^3 - 5/3*w^2 - 20/3*w + 1], [841, 29, -5/3*w^3 + 5/3*w^2 + 20/3*w - 4], [859, 859, -1/3*w^3 - 8/3*w^2 + 13/3*w + 11], [859, 859, -1/3*w^3 + 10/3*w^2 - 5/3*w - 10], [859, 859, 2/3*w^3 - 8/3*w^2 + 1/3*w + 9], [859, 859, -2/3*w^3 + 5/3*w^2 + 2/3*w - 8], [881, 881, -4/3*w^3 + 16/3*w^2 + 4/3*w - 11], [881, 881, 1/3*w^3 - 13/3*w^2 - 4/3*w + 18], [911, 911, -1/3*w^3 + 10/3*w^2 + 1/3*w - 14], [911, 911, -1/3*w^3 + 10/3*w^2 + 1/3*w - 9], [929, 929, 4/3*w^3 - 7/3*w^2 - 22/3*w + 4], [929, 929, 1/3*w^3 + 2/3*w^2 + 2/3*w - 6], [961, 31, 5/3*w^3 - 5/3*w^2 - 20/3*w + 2], [971, 971, -2/3*w^3 + 11/3*w^2 + 2/3*w - 13], [971, 971, 1/3*w^3 + 8/3*w^2 - 10/3*w - 9], [991, 991, -4/3*w^3 + 10/3*w^2 + 16/3*w - 17], [991, 991, -2*w^3 + 4*w^2 + 11*w - 11]]; primes := [ideal : I in primesArray]; heckePol := x^2 - 2*x - 7; K := NumberField(heckePol); heckeEigenvaluesArray := [e, 2, 4, -e - 1, -1/2*e - 1/2, -1, -3/2*e + 1/2, -2*e + 2, 5/2*e - 7/2, 2, e + 7, -1/2*e - 1/2, -5, e + 5, -2*e - 3, 5/2*e + 9/2, -e + 1, -5*e + 6, -3/2*e + 17/2, -5*e + 5, e + 1, 7/2*e + 3/2, 3*e - 1, e + 3, -e + 5, 3/2*e - 13/2, 2*e - 4, -e - 11, -7/2*e + 9/2, 2*e + 6, 1/2*e + 25/2, -2*e + 11, -7/2*e + 21/2, 2*e - 3, 4*e - 7, e - 17, 2*e - 19, e + 3, -9, -7*e + 3, 6*e - 10, 1/2*e - 31/2, 2*e - 8, -4*e - 10, 3*e + 5, -17, -6*e + 6, -7*e + 1, 2*e - 4, 2*e - 18, -e - 3, 3*e + 17, -7*e + 1, 2*e + 4, -9/2*e - 21/2, 4*e - 2, 7/2*e + 19/2, 3/2*e + 11/2, -4*e - 14, -7*e - 1, -e + 5, 4*e + 2, 7*e - 10, -6*e + 16, -19/2*e + 37/2, 2*e - 22, 4*e - 19, -7/2*e + 5/2, -e + 12, 9/2*e + 1/2, -e - 30, -5*e + 7, 4, -e - 13, -4*e + 19, -3/2*e + 53/2, 7*e - 10, 4*e - 6, 5*e - 8, -3*e - 16, -3*e + 26, -9*e + 17, -9*e + 2, -9*e + 9, e - 17, 7*e + 3, 8*e - 20, 8*e - 8, 2*e + 4, 5/2*e + 37/2, 6*e + 8, -7/2*e - 11/2, -5*e + 22, 10*e - 12, -20, -5*e - 9, 1/2*e + 65/2, 7/2*e + 59/2, -e + 14, 8*e + 12, -e - 5, -4*e + 2, 5*e - 5, -9*e + 2, 3*e + 9, 7*e + 1, -10*e + 14, -5*e + 2, 19/2*e - 5/2, 7*e + 3, -19/2*e - 19/2, -31/2*e + 41/2, 6*e + 2, -9/2*e - 49/2, 6*e, e - 45, 6*e - 30, -5*e + 2, 3*e - 17, -7*e + 8, -5/2*e + 19/2, -10*e + 9, 1/2*e - 39/2, 4*e - 26, -31/2*e + 25/2, 9*e + 3, 3*e - 34, e - 6, 15/2*e + 11/2, 5*e - 45, 12*e + 6, -e - 3, -e + 9, 3*e + 5, 3*e - 9, 1/2*e + 13/2, -4*e - 2, 4*e - 11, 6*e + 6, 19/2*e + 15/2, e + 21, -16, -6*e - 18, 21/2*e - 59/2, 18*e - 20, 9*e - 26, -4*e + 14, 6*e + 16, 23/2*e + 3/2, 8*e - 6, -16*e + 7, -e + 5, -5*e - 15, -7*e + 16, -6*e + 28, -11*e + 23, e - 1, 3*e - 27, 11*e + 5, -7/2*e - 79/2, 6*e - 23, 2*e - 1]; 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;