/* 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, -1, -5, 0, 1]; F := NumberField(g); ZF := Integers(F); NN := ideal; primesArray := [ [2, 2, w + 1], [5, 5, w^3 - 4*w], [8, 2, w^3 - w^2 - 4*w + 3], [11, 11, w^3 - 5*w + 1], [17, 17, -w^3 - w^2 + 5*w + 4], [23, 23, -w^2 + 2], [29, 29, -w^2 - w + 3], [31, 31, -w^3 + 6*w + 2], [43, 43, w^3 - 6*w], [47, 47, 2*w^3 - 9*w], [47, 47, -2*w^3 + w^2 + 8*w - 2], [53, 53, -4*w^3 + 2*w^2 + 18*w - 5], [59, 59, w^2 - w - 5], [59, 59, 3*w^3 - 15*w - 5], [71, 71, w^3 - 3*w - 3], [81, 3, -3], [83, 83, -2*w^3 + 8*w + 3], [89, 89, -2*w^3 + 11*w - 2], [101, 101, 2*w^3 - w^2 - 10*w], [101, 101, 2*w^3 - 2*w^2 - 10*w + 3], [107, 107, 3*w^3 - 15*w - 1], [107, 107, 4*w^3 - 2*w^2 - 18*w + 3], [109, 109, 2*w^3 - 10*w + 3], [109, 109, 3*w^3 - 2*w^2 - 13*w + 3], [113, 113, 3*w^3 - w^2 - 15*w + 2], [113, 113, 3*w^3 - 13*w - 5], [121, 11, 3*w^3 - 13*w - 1], [125, 5, -2*w^3 + w^2 + 7*w + 1], [127, 127, 2*w^3 - 8*w - 1], [127, 127, -w^3 + 2*w^2 + 3*w - 3], [137, 137, 2*w^3 - 10*w + 1], [137, 137, 2*w^3 - 11*w], [139, 139, 2*w^3 - 9*w - 6], [157, 157, -4*w^3 - w^2 + 19*w + 7], [163, 163, 5*w^3 - 2*w^2 - 25*w + 7], [167, 167, w^2 + w - 5], [167, 167, -w^3 + 2*w^2 + 4*w - 6], [169, 13, -w^3 + w^2 + 3*w - 4], [169, 13, w^2 - 2*w - 4], [173, 173, -2*w^3 + w^2 + 11*w - 7], [173, 173, w - 4], [181, 181, w + 4], [181, 181, -2*w - 5], [191, 191, -w^3 + 2*w^2 + 6*w - 6], [191, 191, 2*w^3 - w^2 - 11*w + 1], [193, 193, -3*w^3 + 16*w], [227, 227, 6*w^3 - 3*w^2 - 27*w + 5], [227, 227, 2*w^3 - 11*w - 2], [229, 229, -2*w^3 + w^2 + 10*w - 6], [233, 233, 4*w^3 - 3*w^2 - 17*w + 5], [233, 233, 2*w^3 + w^2 - 7*w - 5], [233, 233, w^3 - 7*w - 1], [233, 233, 2*w^3 - 7*w], [239, 239, 2*w^2 - 2*w - 7], [239, 239, -4*w^3 + w^2 + 18*w], [241, 241, w^3 - 5*w - 5], [263, 263, -4*w^3 + w^2 + 20*w - 4], [269, 269, w^3 + 2*w^2 - 6*w - 6], [271, 271, 2*w^3 + w^2 - 12*w - 8], [277, 277, w^3 + w^2 - 7*w - 6], [283, 283, 6*w^3 - 3*w^2 - 27*w + 7], [283, 283, -3*w^3 + 3*w^2 + 13*w - 8], [293, 293, -2*w^3 + w^2 + 9*w + 3], [293, 293, 4*w^3 - w^2 - 19*w + 3], [313, 313, 2*w^2 - w - 4], [313, 313, -2*w^3 + 2*w^2 + 8*w - 1], [317, 317, 3*w^3 + w^2 - 13*w - 10], [331, 331, w^3 + 2*w^2 - 4*w - 6], [349, 349, -w^3 + 3*w^2 + w - 4], [353, 353, 3*w^3 - 14*w], [353, 353, -2*w^3 + w^2 + 7*w + 5], [361, 19, -5*w^3 + w^2 + 23*w - 2], [361, 19, -2*w^3 + 7*w + 6], [373, 373, -w^3 + 4*w - 4], [379, 379, -w^3 - 2*w^2 + 5*w + 7], [383, 383, w^2 - 2*w - 6], [389, 389, -4*w^3 + 2*w^2 + 16*w - 5], [397, 397, 5*w^3 - 2*w^2 - 24*w + 2], [397, 397, 3*w^3 + 2*w^2 - 16*w - 14], [401, 401, 2*w^2 - 5], [419, 419, -w^3 - w^2 + 9*w + 6], [439, 439, 3*w^3 - w^2 - 15*w - 2], [449, 449, 4*w^3 + w^2 - 17*w - 5], [449, 449, 4*w^3 - w^2 - 17*w - 5], [467, 467, -3*w^3 + 16*w - 2], [467, 467, 2*w^3 + w^2 - 10*w - 2], [479, 479, 4*w^3 - 19*w - 8], [491, 491, 3*w - 4], [491, 491, -w^3 + 2*w^2 + 5*w - 11], [509, 509, -7*w^3 + 3*w^2 + 33*w - 10], [509, 509, 4*w^3 - w^2 - 21*w - 3], [523, 523, -w^3 - 2*w^2 + 6*w + 2], [541, 541, -5*w^3 + 2*w^2 + 26*w - 8], [541, 541, 2*w^3 + w^2 - 9*w - 1], [571, 571, -4*w^3 + 3*w^2 + 20*w - 14], [571, 571, -3*w^3 - w^2 + 15*w + 4], [593, 593, w^3 - 4*w - 6], [613, 613, 4*w^3 - 2*w^2 - 19*w + 2], [617, 617, -w^3 + 3*w - 5], [617, 617, -w^3 + 2*w^2 + 3*w - 9], [617, 617, 8*w^3 - 3*w^2 - 38*w + 8], [617, 617, w^3 - 8*w], [619, 619, 6*w^3 - 3*w^2 - 26*w + 4], [631, 631, 3*w^3 + w^2 - 17*w - 8], [631, 631, w^2 - 3*w - 5], [641, 641, -3*w^3 + 2*w^2 + 16*w - 10], [643, 643, -2*w^3 + 3*w^2 + 7*w - 9], [647, 647, w^3 - w^2 - 3*w - 4], [653, 653, 2*w^3 + w^2 - 11*w - 1], [653, 653, w^3 + 2*w^2 - 7*w - 9], [653, 653, -4*w^3 - w^2 + 17*w + 3], [653, 653, 3*w^3 - 2*w^2 - 13*w + 1], [661, 661, 2*w^3 - 3*w^2 - 8*w + 8], [673, 673, 3*w^3 - 12*w - 2], [673, 673, 2*w^3 - w^2 - 12*w], [683, 683, -w^3 + 2*w^2 + 2*w - 6], [691, 691, -5*w^3 + 22*w + 8], [691, 691, 2*w^3 - 12*w - 3], [719, 719, 6*w^3 + w^2 - 28*w - 8], [733, 733, -3*w^2 + 3*w + 7], [733, 733, 3*w^3 - 14*w + 2], [733, 733, -w^3 + w^2 + 7*w - 8], [733, 733, 2*w^3 - 6*w - 5], [751, 751, 3*w^3 + 3*w^2 - 13*w - 12], [751, 751, 5*w^3 - 2*w^2 - 25*w + 5], [751, 751, -4*w^3 + 3*w^2 + 20*w - 12], [751, 751, 2*w^3 + w^2 - 9*w + 1], [757, 757, -3*w^3 + w^2 + 11*w + 2], [773, 773, w^3 - w^2 - 7*w + 6], [787, 787, -9*w^3 + 4*w^2 + 43*w - 13], [787, 787, w^2 + 2*w - 6], [797, 797, -w^3 + 4*w^2 - 2*w - 6], [797, 797, 2*w^3 - w^2 - 9*w + 7], [821, 821, -6*w^3 + 27*w + 2], [823, 823, 8*w^3 - 4*w^2 - 37*w + 8], [827, 827, -3*w^3 + 3*w^2 + 15*w - 4], [829, 829, w^3 + w^2 - 3*w - 8], [839, 839, 2*w^3 - 3*w^2 - 8*w + 6], [839, 839, 8*w^3 - 2*w^2 - 38*w + 3], [859, 859, 4*w^3 - 2*w^2 - 18*w + 1], [859, 859, -4*w^3 + 4*w^2 + 17*w - 10], [863, 863, -4*w^3 + w^2 + 19*w + 3], [877, 877, -4*w^3 + w^2 + 18*w + 4], [883, 883, -6*w^3 + 3*w^2 + 31*w - 13], [883, 883, 4*w^3 - w^2 - 17*w - 1], [887, 887, 3*w^3 - 4*w^2 - 11*w + 11], [907, 907, 5*w^3 - 4*w^2 - 21*w + 11], [907, 907, -2*w^3 + 2*w^2 + 8*w - 11], [911, 911, 2*w^3 - 2*w^2 - 11*w], [919, 919, 4*w^3 - 17*w - 2], [937, 937, 3*w^3 - 2*w^2 - 15*w + 1], [937, 937, 3*w^3 - 17*w + 1], [941, 941, 4*w^3 - w^2 - 16*w - 4], [953, 953, -2*w^3 + 2*w^2 + 13*w - 6], [971, 971, -3*w^3 + 11*w + 9], [977, 977, 8*w^3 - 4*w^2 - 39*w + 16], [983, 983, 4*w^3 - w^2 - 21*w + 3], [983, 983, 2*w^3 - 3*w^2 - 9*w + 7], [997, 997, w^3 - w^2 - w - 6], [997, 997, w^3 - 9*w - 3]]; primes := [ideal : I in primesArray]; heckePol := x^3 - x^2 - 14*x + 16; K := NumberField(heckePol); heckeEigenvaluesArray := [1, e, 1, -1/2*e^2 - 1/2*e + 5, -1/2*e^2 + 1/2*e + 5, -e^2 - e + 10, e^2 + e - 12, e^2 - 4, 1/2*e^2 - 1/2*e + 1, -e - 2, -e - 2, -2, -1/2*e^2 - 3/2*e + 3, -1/2*e^2 - 3/2*e + 3, e^2 - e - 14, 4*e + 2, -1/2*e^2 + 5/2*e + 3, 1/2*e^2 - 3/2*e - 3, -e - 4, -2*e + 2, -1/2*e^2 - 5/2*e + 1, 1/2*e^2 + 5/2*e - 9, 2*e^2 - 18, -e + 4, -1/2*e^2 - 3/2*e + 1, 1/2*e^2 + 7/2*e - 9, -1/2*e^2 - 3/2*e + 9, 2*e^2 + 4*e - 26, 2*e^2 + 3*e - 18, e^2 - 2*e - 8, 3/2*e^2 + 5/2*e - 15, 1/2*e^2 - 5/2*e - 5, 1/2*e^2 - 5/2*e - 3, e^2 + 3*e - 8, -1/2*e^2 - 7/2*e + 7, -2*e^2 + 16, 2*e^2 + 2*e - 28, -2*e + 14, 3/2*e^2 - 3/2*e - 15, e, -2*e^2 + e + 16, e + 8, 2*e + 2, -4*e - 8, -e^2 + 4, -3/2*e^2 - 9/2*e + 23, e^2 - 4*e - 8, 4, e^2 + 5*e - 4, e^2 - 4*e - 2, -1/2*e^2 - 7/2*e + 21, -e^2 - 4*e + 14, -3/2*e^2 - 11/2*e + 13, 16, -3*e^2 - 2*e + 24, -7/2*e^2 - 13/2*e + 43, -3*e^2 + 2*e + 24, 3*e^2 + 5*e - 36, -2*e^2 - 2*e + 20, -e^2 + 3*e + 16, 1/2*e^2 + 7/2*e - 7, 3/2*e^2 - 1/2*e - 19, e^2 + 8*e - 14, 14, 1/2*e^2 - 1/2*e - 9, 3*e^2 - 18, -e^2 - 7*e + 4, 5/2*e^2 - 11/2*e - 33, -3*e^2 - 4*e + 34, 1/2*e^2 - 5/2*e - 13, -1/2*e^2 + 5/2*e - 7, -7/2*e^2 - 7/2*e + 33, -7/2*e^2 - 9/2*e + 39, 2*e + 26, -3/2*e^2 + 1/2*e + 11, e^2 + 6*e - 24, -e^2 - 4*e + 2, 2*e^2 + 2*e - 22, 2*e - 6, 2*e^2 - 6*e - 26, -1/2*e^2 + 9/2*e - 9, -8, 9/2*e^2 + 5/2*e - 35, -1/2*e^2 + 9/2*e + 21, e^2 - 16, 4*e - 4, e^2 - 5*e - 30, -e^2 - 6*e + 4, -3/2*e^2 - 21/2*e + 21, -4*e^2 + e + 32, e^2 - e - 24, 5/2*e^2 - 9/2*e - 15, -4*e^2 - 7*e + 56, 2*e^2 - 5*e - 4, -1/2*e^2 + 13/2*e + 19, 5/2*e^2 - 3/2*e - 41, 5/2*e^2 + 15/2*e - 17, e^2 + 2*e + 6, -2*e + 14, 3/2*e^2 + 15/2*e - 13, 9/2*e^2 - 9/2*e - 49, -e^2 + 2*e + 26, -3/2*e^2 + 9/2*e + 3, 3*e^2 + 7*e - 22, -4*e - 16, 1/2*e^2 + 11/2*e + 3, 3/2*e^2 - 7/2*e - 33, e^2 + 10*e - 8, -6*e^2 - 2*e + 42, -5*e^2 - e + 56, -3*e^2 + 3*e + 16, -2*e^2 + 4*e + 30, 3*e^2 + 7*e - 48, -3/2*e^2 + 1/2*e + 25, -8*e - 6, 5/2*e^2 + 3/2*e - 3, 3/2*e^2 + 19/2*e - 7, -3/2*e^2 - 3/2*e - 1, 4*e^2 + e - 46, 4*e^2 - 2*e - 14, 2*e^2 - 3*e + 8, -2*e^2 - e + 28, -3*e^2 - 2*e + 14, -5*e^2 - 4*e + 60, -6*e^2 + 4*e + 48, -e^2 + 7*e + 18, -e^2 - 11*e + 14, -3*e^2 + 2*e + 14, -e^2 + 11*e + 16, 7/2*e^2 + 25/2*e - 57, -9/2*e^2 - 9/2*e + 53, -3*e^2 - 3*e + 28, -4*e^2 - 4*e + 14, 5*e^2 - 5*e - 56, e^2 - 3*e - 34, -7/2*e^2 - 1/2*e + 33, 2*e^2 + 4*e + 6, 4*e^2 + 3*e - 50, -4*e - 32, -4*e^2 - 10*e + 56, -1/2*e^2 - 7/2*e + 31, 5*e^2 + 3*e - 62, 2*e^2 + 10*e - 38, -2*e^2 + 4*e + 36, -12, -3*e^2 - 10*e + 48, -7/2*e^2 + 23/2*e + 41, 3/2*e^2 + 9/2*e - 41, -3*e^2 + 3*e + 50, 24, 6*e^2 + 8*e - 54, 2*e^2 - 4*e - 6, -4*e^2 - 12*e + 38, -3*e^2 - 10*e + 58, 7/2*e^2 + 9/2*e - 49, 1/2*e^2 + 7/2*e + 15, -e^2 - 7*e - 2, e^2 + 3*e - 22, -4*e^2 - 3*e + 40, 2*e^2 - 26]; 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;