/* 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![3, 4, -4, -2, 1]; F := NumberField(g); ZF := Integers(F); NN := ideal; primesArray := [ [2, 2, w - 1], [3, 3, w], [5, 5, -w + 2], [11, 11, w + 2], [27, 3, -w^3 + 2*w^2 + 4*w - 4], [29, 29, -w^2 + 3*w + 1], [31, 31, w^3 - 2*w^2 - 2*w + 2], [31, 31, -w^2 + 2*w + 4], [47, 47, w^3 - w^2 - 4*w + 1], [49, 7, 2*w^3 - 2*w^2 - 8*w - 1], [49, 7, w^3 - w^2 - 3*w - 2], [53, 53, w^3 - 3*w^2 - w + 2], [53, 53, w^3 - 5*w - 5], [61, 61, 2*w - 1], [61, 61, -w^3 + 4*w^2 - 4], [67, 67, 3*w^3 - 3*w^2 - 13*w - 4], [73, 73, -w^3 + 4*w^2 - 10], [73, 73, w^2 - w + 1], [83, 83, -4*w^3 + 5*w^2 + 17*w + 1], [83, 83, 3*w^3 - 3*w^2 - 14*w - 5], [89, 89, w^3 - w^2 - 4*w + 5], [89, 89, w^3 - 3*w^2 - w + 8], [97, 97, -w^3 + 7*w + 5], [97, 97, 2*w^3 - 3*w^2 - 7*w + 1], [103, 103, -3*w^3 + 8*w^2 + 7*w - 19], [113, 113, -w^2 + 2*w - 2], [125, 5, 2*w^3 - 5*w^2 - 3*w + 7], [127, 127, 2*w^2 - 3*w - 4], [137, 137, -w^3 + 3*w^2 + 3*w - 4], [137, 137, w^3 - w^2 - 6*w - 1], [149, 149, 2*w^3 - 3*w^2 - 5*w - 1], [151, 151, -w^3 + 3*w^2 - 5], [157, 157, -w^3 + 2*w^2 + w - 5], [163, 163, 4*w^3 - 4*w^2 - 18*w - 7], [167, 167, -3*w^3 + 4*w^2 + 13*w - 1], [167, 167, 2*w^2 - 4*w - 1], [173, 173, w^3 - 5*w - 1], [173, 173, 2*w^3 - 3*w^2 - 9*w + 1], [179, 179, -2*w^3 + 3*w^2 + 8*w - 4], [181, 181, 2*w^2 - 2*w - 5], [193, 193, 4*w^3 - 9*w^2 - 11*w + 17], [197, 197, w^3 - w^2 - 6*w + 1], [197, 197, -w^3 + 5*w^2 - w - 4], [199, 199, -3*w^3 + 4*w^2 + 11*w + 5], [211, 211, -2*w^3 + 5*w^2 + 6*w - 8], [227, 227, w^2 - 3*w - 5], [233, 233, 2*w^3 - 6*w^2 - 5*w + 16], [233, 233, -5*w^3 + 13*w^2 + 13*w - 26], [251, 251, -2*w^3 + 4*w^2 + 5*w - 4], [251, 251, -w^3 + 5*w^2 + w - 8], [251, 251, w^2 + w - 5], [251, 251, -w^3 + 2*w^2 + 3*w - 7], [257, 257, w^3 - 5*w^2 + 2*w + 11], [263, 263, -3*w^3 + 8*w^2 + 9*w - 17], [269, 269, -3*w^3 + 2*w^2 + 13*w + 7], [269, 269, 3*w^3 - 4*w^2 - 13*w - 1], [271, 271, 2*w^3 - 5*w^2 - 5*w + 7], [277, 277, -w^3 + w^2 + 5*w - 4], [283, 283, 3*w - 2], [293, 293, 3*w^3 - 2*w^2 - 15*w - 5], [307, 307, -w - 4], [307, 307, -2*w^3 + 11*w + 8], [313, 313, -2*w^3 + 2*w^2 + 7*w - 2], [347, 347, -w^3 + 3*w^2 + w - 10], [347, 347, 3*w^3 - 3*w^2 - 11*w - 4], [349, 349, -w^3 + w^2 + 4*w + 5], [349, 349, 2*w^2 - 2*w - 11], [353, 353, 2*w^3 - 7*w^2 - 3*w + 17], [353, 353, w^3 - w^2 - 6*w - 5], [359, 359, 2*w^2 - 4*w - 7], [359, 359, 3*w^2 - 3*w - 13], [361, 19, 6*w^3 - 6*w^2 - 28*w - 7], [361, 19, 2*w^2 - w - 8], [367, 367, -2*w^3 + w^2 + 9*w + 7], [367, 367, -4*w^3 + 5*w^2 + 16*w + 4], [373, 373, -2*w^3 + 3*w^2 + 6*w - 2], [373, 373, -w^3 + 3*w^2 + 3*w - 2], [373, 373, -2*w^3 + 7*w^2 + w - 13], [373, 373, 3*w^3 - 9*w^2 - 7*w + 22], [379, 379, -2*w^3 + 6*w^2 + 2*w - 11], [379, 379, 2*w^3 - 5*w^2 - 7*w + 7], [409, 409, -w^3 + 4*w^2 + 2*w - 14], [433, 433, -2*w^3 + 4*w^2 + 4*w - 5], [433, 433, 3*w^2 - 4*w - 10], [443, 443, -w^3 + 3*w^2 - 7], [443, 443, -w^3 + 3*w^2 + 4*w - 11], [457, 457, -3*w^3 + 5*w^2 + 10*w - 5], [461, 461, -2*w^3 + 3*w^2 + 8*w + 4], [463, 463, -5*w^3 + 3*w^2 + 25*w + 16], [479, 479, 3*w^2 - 6*w - 8], [487, 487, w^3 - 3*w^2 - 5*w + 8], [491, 491, 2*w^3 - 4*w^2 - 3*w + 2], [499, 499, w^3 - w^2 - 7*w + 4], [499, 499, w^3 - 6*w - 8], [521, 521, 2*w^3 - 4*w^2 - 8*w + 7], [521, 521, 3*w^3 - 5*w^2 - 8*w - 1], [521, 521, w^3 - 5*w + 1], [521, 521, w^3 - 8*w + 2], [523, 523, -2*w^3 + 5*w^2 + 4*w - 4], [547, 547, -2*w^3 + 4*w^2 + 6*w - 1], [547, 547, -w^3 - w^2 + 6*w + 11], [563, 563, -2*w^3 + 8*w^2 - 3*w - 8], [569, 569, 3*w^3 - 7*w^2 - 10*w + 13], [571, 571, -3*w^3 + 4*w^2 + 11*w - 1], [577, 577, -w^3 + 5*w^2 - 3*w - 10], [601, 601, -2*w^3 + 6*w^2 + 4*w - 17], [607, 607, 2*w^3 - 12*w - 5], [613, 613, 6*w^3 - 5*w^2 - 27*w - 11], [613, 613, 2*w + 5], [631, 631, 5*w^3 - 14*w^2 - 11*w + 29], [641, 641, w^3 + w^2 - 5*w - 8], [641, 641, -w^3 + 5*w^2 - 13], [643, 643, w^2 + w - 7], [643, 643, -3*w^3 + 3*w^2 + 15*w + 8], [661, 661, 3*w^3 - 2*w^2 - 14*w - 4], [691, 691, -2*w^3 + 3*w^2 + 9*w - 7], [691, 691, 2*w^3 - 5*w^2 - 3*w + 11], [709, 709, 7*w^3 - 16*w^2 - 20*w + 32], [709, 709, -w^3 + 4*w^2 + 2*w - 4], [709, 709, -2*w^3 + 3*w^2 + 4*w - 2], [719, 719, -2*w^3 + 3*w^2 + 7*w - 7], [719, 719, -w^3 + 4*w^2 - 14], [739, 739, 5*w^3 - 3*w^2 - 24*w - 17], [739, 739, -4*w^3 + 10*w^2 + 10*w - 17], [743, 743, 2*w^3 - 2*w^2 - 11*w - 2], [757, 757, -3*w^3 + 5*w^2 + 11*w - 2], [761, 761, w^3 - 3*w - 5], [761, 761, w^2 - 5*w - 1], [769, 769, -w^3 - w^2 + 9*w + 8], [773, 773, -2*w^3 + 4*w^2 + 7*w - 2], [797, 797, -2*w^3 + w^2 + 12*w + 10], [797, 797, -2*w^3 + 5*w^2 + 3*w + 1], [809, 809, 3*w^2 - 4*w - 8], [821, 821, -3*w^3 + 6*w^2 + 9*w - 5], [823, 823, -2*w^3 + 5*w^2 + w - 7], [823, 823, -3*w^3 + 6*w^2 + 6*w - 10], [827, 827, w^3 + 2*w^2 - 5*w - 7], [827, 827, w^3 - 2*w^2 - 6*w - 4], [829, 829, 3*w^3 - w^2 - 15*w - 14], [829, 829, w^3 + 2*w^2 - 7*w - 13], [839, 839, 4*w^3 - 11*w^2 - 8*w + 26], [853, 853, w^3 - 4*w - 8], [863, 863, 5*w^3 - 2*w^2 - 26*w - 14], [863, 863, 2*w^3 - 5*w^2 - 5*w + 5], [881, 881, 2*w^3 + w^2 - 11*w - 11], [883, 883, -6*w^3 + 15*w^2 + 14*w - 32], [883, 883, -w^3 + 2*w^2 + 2*w - 8], [887, 887, w^3 - w^2 - 7*w + 2], [907, 907, 3*w^3 - 3*w^2 - 10*w - 5], [907, 907, w^3 - 2*w^2 - 2*w - 4], [919, 919, 3*w^3 - 3*w^2 - 11*w - 2], [919, 919, -4*w^3 + 10*w^2 + 7*w - 16], [929, 929, 3*w^3 - 3*w^2 - 10*w + 1], [937, 937, 6*w^3 - 8*w^2 - 24*w + 1], [947, 947, 3*w^3 - 6*w^2 - 8*w + 8], [953, 953, 4*w - 1], [953, 953, 4*w^3 - 9*w^2 - 10*w + 16], [961, 31, -w^3 + 6*w - 2], [967, 967, 2*w^3 - 8*w - 7], [967, 967, 4*w^3 - 9*w^2 - 12*w + 14], [971, 971, 5*w^3 - 6*w^2 - 20*w - 4]]; primes := [ideal : I in primesArray]; heckePol := x^3 - 10*x - 5; K := NumberField(heckePol); heckeEigenvaluesArray := [1, e, 1, -e^2 + e + 5, -e^2 + 6, -8, e^2 - 3, -2*e + 2, -3*e + 3, -e - 3, e^2 - 3*e - 11, e^2 - 2*e - 11, 4*e, -e^2 + 4*e + 5, -e^2 + 2*e + 13, -2*e^2 + 2*e + 16, e^2 + e - 3, -e^2 + 14, -e^2 - e + 9, -e^2 - e + 9, e^2 - 3*e - 9, e^2 - 3*e - 9, -e^2 - 2*e + 8, 3*e^2 - 2*e - 18, 2*e^2 - 3*e - 11, -3*e^2 + 3*e + 17, -2*e^2 + 3*e + 13, e^2 - 4*e - 5, -e^2 - 2*e + 10, -3*e^2 + e + 11, -2*e + 6, -2*e^2 + 2*e + 24, 4*e - 10, 3*e^2 + e - 21, 2*e^2 - 5*e - 15, 2*e^2 + e - 1, -e^2 + 2*e + 11, -3*e^2 + 13, e^2 - 2*e - 18, 8*e - 2, -3*e^2 + 2*e + 6, 2*e^2 - 4*e - 8, -2*e^2 - 4*e + 18, 2*e^2 - 22, 5*e + 2, e^2 - 5*e - 15, -e + 10, e^2 - 7*e - 1, 4*e^2 - 3*e - 28, 3*e^2 - 4*e - 27, 2*e^2 - 2*e, -2*e^2 + 7*e + 28, -2*e^2 + e + 20, -2*e^2 + 2*e + 22, e^2 + 7, -2*e^2 - 4*e + 14, 3*e^2 - 2*e - 15, 6*e - 12, 5*e - 2, 2*e^2 - 5*e - 3, -e^2 - 3*e + 13, 4, e^2 - e - 21, -e^2 + 3*e + 29, -3*e^2 + 5*e + 15, 4*e^2 - 18, 2*e^2 - 4*e - 8, -e^2 - 2*e + 17, -e^2 - 5*e + 29, 2*e^2 + 5*e - 15, 3*e - 13, 2*e + 12, 3*e^2 + 4*e - 25, 2*e^2 - 6*e - 20, -7*e - 3, 4*e^2 - 8*e - 38, 2*e^2 + 2*e - 8, 8*e, 4*e^2 - 13*e - 37, -10*e + 2, 3*e^2 - 3*e - 17, -2*e^2 + 3*e + 12, e^2 - 9*e - 21, -3*e^2 + 8*e + 32, 3*e^2 + e - 7, -3*e^2 - e + 21, -2*e^2 - 4*e + 12, -3*e^2 + 35, -4*e - 14, 2*e^2 - e + 15, 4*e^2 - 13*e - 37, e^2 - e - 33, e^2 - 9*e + 7, -e + 10, 7*e^2 - 5*e - 45, -4*e^2 - 2*e + 24, -5*e^2 + 7*e + 23, -7*e^2 + 3*e + 33, 5*e^2 + 2*e - 39, -4*e^2 - e + 27, -3*e^2 + 6*e + 21, 6*e^2 - 12*e - 54, 4*e^2 - 26, -5*e^2 - 3*e + 37, -3*e^2 - 5*e + 19, e^2 - 6*e - 17, 7*e^2 - 2*e - 47, -3*e^2 + 4*e + 19, 4*e^2 - 20, 2*e^2 + 8*e - 40, 3*e^2 - 4*e - 17, 2*e^2 - 2*e + 10, 2*e^2 + 7*e - 24, -2*e^2 + 8*e - 2, -7*e^2 + 14*e + 53, e^2 - e - 23, 2*e^2 + 2*e - 32, 2*e^2 + 8*e - 38, 9*e + 9, e^2 + 8*e - 3, 2*e^2 + 6*e - 20, 4*e + 20, 8*e^2 - 8*e - 40, -7*e - 11, 4*e^2 + 8*e - 36, 10*e - 4, 4*e^2 - 4*e - 46, -6*e^2 + 11*e + 35, 2*e^2 + 2*e - 30, 7*e^2 + 2*e - 49, -e + 23, -4*e^2 - 4*e + 42, -4*e^2 + 7*e + 10, -4*e^2 - 4*e + 28, -4*e^2 + 4*e + 36, 3*e^2 - 4*e - 25, -4*e^2 + 11*e + 12, -e^2 - 8*e + 21, -6*e^2 + 4*e + 36, 6*e^2 + 9*e - 43, -7*e^2 + 2*e + 51, e^2 - 8*e - 23, -2*e^2 - 13*e + 17, -2*e^2 - 2*e - 8, 6*e^2 - 11*e - 63, -4*e^2 + 4*e + 20, -e^2 - 11*e + 13, 4*e^2 - 2*e - 42, -5*e^2 - e + 23, 6*e^2 - 17*e - 51, -6*e^2 - 7*e + 37, -2*e^2 + 6*e + 16, -e^2 + 2*e + 45, -6*e^2 - e + 50, -6*e^2 + 9*e + 39, 5*e^2 - 9*e - 59, 3*e^2 - 44, e^2 + 11*e - 29, -8*e^2 + 32, 10*e + 16, -e^2 - 15*e + 3]; 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;