/* 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, 3, -1, -5, 0, 1]; F := NumberField(g); ZF := Integers(F); NN := ideal; primesArray := [ [5, 5, -2*w^4 + w^3 + 9*w^2 - 2*w - 3], [17, 17, -2*w^4 + w^3 + 9*w^2 - 3*w - 5], [17, 17, w^2 - 2], [23, 23, w^3 - 3*w], [29, 29, 2*w^4 - w^3 - 10*w^2 + 2*w + 4], [32, 2, 2], [37, 37, -w^4 + w^3 + 4*w^2 - 2*w], [41, 41, -3*w^4 + 2*w^3 + 14*w^2 - 5*w - 7], [43, 43, -3*w^4 + w^3 + 14*w^2 - 3*w - 6], [47, 47, -3*w^4 + 2*w^3 + 14*w^2 - 7*w - 6], [53, 53, 2*w^4 - w^3 - 8*w^2 + 2*w + 1], [53, 53, -2*w^4 + w^3 + 10*w^2 - 4*w - 6], [59, 59, -w^4 + 4*w^2 + 1], [59, 59, -3*w^4 + 2*w^3 + 14*w^2 - 6*w - 8], [61, 61, 4*w^4 - 2*w^3 - 18*w^2 + 5*w + 7], [61, 61, 3*w^4 - w^3 - 15*w^2 + 2*w + 7], [73, 73, -4*w^4 + 2*w^3 + 18*w^2 - 7*w - 6], [83, 83, -2*w^4 + 9*w^2 + 2*w - 4], [83, 83, -2*w^4 + 2*w^3 + 10*w^2 - 7*w - 6], [97, 97, -2*w^4 + w^3 + 8*w^2 - 3*w + 1], [97, 97, -w^3 + w^2 + 4*w - 1], [101, 101, 2*w^4 - 9*w^2 - w + 5], [103, 103, 2*w^4 - 2*w^3 - 9*w^2 + 8*w + 2], [107, 107, -3*w^4 + w^3 + 15*w^2 - 4*w - 8], [109, 109, -3*w^4 + w^3 + 13*w^2 - 2*w - 4], [113, 113, 4*w^4 - 3*w^3 - 18*w^2 + 8*w + 8], [121, 11, -w^4 - w^3 + 5*w^2 + 4*w - 2], [131, 131, -4*w^4 + w^3 + 18*w^2 - 5], [139, 139, 2*w^3 - w^2 - 8*w + 1], [139, 139, -2*w^4 + w^3 + 9*w^2 - 3], [149, 149, 5*w^4 - 2*w^3 - 23*w^2 + 4*w + 11], [149, 149, w^4 - 4*w^2 - 3], [149, 149, 4*w^4 - 3*w^3 - 19*w^2 + 10*w + 8], [151, 151, 2*w^4 - w^3 - 9*w^2 + 5*w + 4], [157, 157, -2*w^4 - w^3 + 10*w^2 + 5*w - 4], [157, 157, 5*w^4 - 3*w^3 - 24*w^2 + 8*w + 13], [163, 163, -2*w^4 + 11*w^2 + w - 7], [167, 167, w^4 - 3*w^2 - 2*w - 3], [167, 167, -3*w^4 + 3*w^3 + 14*w^2 - 10*w - 9], [169, 13, 3*w^4 - 2*w^3 - 14*w^2 + 6*w + 3], [191, 191, -3*w^4 + w^3 + 15*w^2 - w - 6], [193, 193, 3*w^4 - 2*w^3 - 14*w^2 + 4*w + 5], [199, 199, -5*w^4 + 2*w^3 + 23*w^2 - 3*w - 10], [223, 223, -4*w^4 + w^3 + 20*w^2 - w - 9], [223, 223, -w^4 + 3*w^2 + 2], [233, 233, w^3 - 4*w - 4], [241, 241, -3*w^4 + 2*w^3 + 15*w^2 - 7*w - 7], [243, 3, -3], [251, 251, -3*w^4 + 3*w^3 + 13*w^2 - 8*w - 6], [257, 257, -4*w^4 + w^3 + 20*w^2 - 2*w - 9], [257, 257, -3*w^4 + 2*w^3 + 15*w^2 - 5*w - 11], [269, 269, 2*w^4 - 11*w^2 - w + 6], [271, 271, w^4 + w^3 - 5*w^2 - 6*w + 2], [271, 271, 3*w^4 - w^3 - 15*w^2 + 8], [277, 277, -w^4 - w^3 + 6*w^2 + 3*w - 5], [283, 283, -5*w^4 + 3*w^3 + 23*w^2 - 10*w - 10], [293, 293, -w^4 + w^3 + 6*w^2 - 3*w - 8], [307, 307, -w^4 - w^3 + 6*w^2 + 4*w - 2], [311, 311, -w^3 + 2*w^2 + 3*w - 2], [311, 311, 2*w^4 - w^3 - 10*w^2 + 5*w + 7], [313, 313, -5*w^4 + 4*w^3 + 23*w^2 - 12*w - 11], [313, 313, -w^4 - w^3 + 5*w^2 + 3*w - 3], [347, 347, -w^4 + 2*w^3 + 3*w^2 - 7*w + 1], [353, 353, -3*w^4 + 14*w^2 + 3*w - 7], [353, 353, -3*w^4 + 3*w^3 + 13*w^2 - 9*w - 7], [367, 367, -w^4 + w^3 + 5*w^2 - 6*w - 4], [367, 367, -3*w^4 + w^3 + 15*w^2 - 3*w - 5], [379, 379, 5*w^4 - 2*w^3 - 23*w^2 + 6*w + 9], [383, 383, 4*w^4 - 2*w^3 - 19*w^2 + 7*w + 11], [397, 397, w^4 - 3*w^2 - w - 3], [397, 397, -2*w^3 + w^2 + 8*w], [401, 401, 2*w^4 - 2*w^3 - 8*w^2 + 5*w], [421, 421, -4*w^4 + 2*w^3 + 17*w^2 - 5*w - 6], [421, 421, -w^4 + 2*w^3 + 6*w^2 - 8*w - 5], [431, 431, 5*w^4 - 2*w^3 - 22*w^2 + 5*w + 7], [431, 431, -w^4 - w^3 + 6*w^2 + 5*w - 4], [439, 439, 4*w^4 - 2*w^3 - 19*w^2 + 7*w + 10], [443, 443, 4*w^4 - w^3 - 19*w^2 + 3*w + 8], [457, 457, -3*w^4 + 3*w^3 + 15*w^2 - 10*w - 9], [461, 461, -w^3 + 6*w], [461, 461, 3*w^4 - 3*w^3 - 14*w^2 + 9*w + 8], [463, 463, 5*w^4 - 3*w^3 - 23*w^2 + 7*w + 8], [499, 499, 6*w^4 - 3*w^3 - 27*w^2 + 7*w + 11], [509, 509, 2*w^4 - w^3 - 8*w^2 + w - 1], [509, 509, 3*w^4 - 2*w^3 - 13*w^2 + 6*w + 7], [521, 521, w^3 - 6*w + 1], [523, 523, 4*w^4 - 2*w^3 - 18*w^2 + 3*w + 7], [541, 541, w^2 + w - 5], [547, 547, 5*w^4 - 2*w^3 - 25*w^2 + 4*w + 12], [547, 547, -6*w^4 + 3*w^3 + 27*w^2 - 10*w - 9], [557, 557, -4*w^4 + 3*w^3 + 18*w^2 - 10*w - 9], [557, 557, -4*w^4 + w^3 + 19*w^2 - 3*w - 6], [557, 557, 3*w^4 - 2*w^3 - 14*w^2 + 8*w + 7], [563, 563, -w^4 + 3*w^3 + 4*w^2 - 11*w + 1], [569, 569, w^2 + 3*w - 2], [577, 577, -5*w^4 + 2*w^3 + 23*w^2 - 6*w - 8], [587, 587, -2*w^4 + 10*w^2 + 3*w - 6], [593, 593, 4*w^4 - 3*w^3 - 19*w^2 + 8*w + 11], [601, 601, -4*w^4 + w^3 + 18*w^2 - 3*w - 6], [601, 601, -5*w^4 + 3*w^3 + 24*w^2 - 10*w - 13], [601, 601, -w^4 + 5*w^2 + 3*w - 3], [607, 607, -3*w^4 + 2*w^3 + 15*w^2 - 8*w - 9], [613, 613, 3*w^4 - 14*w^2 - 2*w + 8], [617, 617, -4*w^4 + w^3 + 19*w^2 - 3*w - 7], [619, 619, w^3 + w^2 - 3*w - 5], [625, 5, 4*w^4 - 2*w^3 - 19*w^2 + 3*w + 8], [631, 631, 3*w^4 - w^3 - 12*w^2 - 1], [641, 641, -w^4 + 2*w^3 + 3*w^2 - 7*w], [647, 647, 2*w^2 - w - 5], [647, 647, -2*w^3 + w^2 + 8*w - 5], [647, 647, 5*w^4 - 3*w^3 - 23*w^2 + 9*w + 12], [661, 661, -8*w^4 + 3*w^3 + 39*w^2 - 7*w - 19], [677, 677, -7*w^4 + 4*w^3 + 34*w^2 - 11*w - 17], [691, 691, w^2 + 2*w - 4], [691, 691, -5*w^4 + 2*w^3 + 23*w^2 - 3*w - 8], [691, 691, -7*w^4 + 5*w^3 + 32*w^2 - 14*w - 15], [701, 701, w - 4], [709, 709, -3*w^4 + 3*w^3 + 14*w^2 - 8*w - 7], [709, 709, 5*w^4 - 2*w^3 - 24*w^2 + 5*w + 9], [709, 709, -w^4 + w^3 + 5*w^2 - 3*w - 7], [719, 719, -3*w^4 + 13*w^2 + w - 7], [719, 719, -3*w^4 + 14*w^2 - 4], [727, 727, -7*w^4 + 4*w^3 + 32*w^2 - 10*w - 16], [727, 727, -3*w^4 + w^3 + 14*w^2 - 5*w - 8], [733, 733, -3*w^4 + 2*w^3 + 15*w^2 - 8*w - 10], [733, 733, -3*w^4 + 3*w^3 + 13*w^2 - 10*w - 7], [733, 733, 8*w^4 - 4*w^3 - 38*w^2 + 9*w + 15], [739, 739, 4*w^4 - 3*w^3 - 20*w^2 + 9*w + 11], [739, 739, -w^4 + w^3 + 5*w^2 - 3*w + 1], [743, 743, -5*w^4 + 4*w^3 + 24*w^2 - 13*w - 16], [743, 743, w^4 - 7*w^2 - 2*w + 5], [751, 751, -w^4 + 2*w^3 + 3*w^2 - 7*w - 1], [757, 757, 5*w^4 - 2*w^3 - 22*w^2 + 5*w + 8], [757, 757, w^4 + w^3 - 6*w^2 - 5*w + 2], [761, 761, 8*w^4 - 3*w^3 - 38*w^2 + 8*w + 18], [761, 761, 3*w^4 - w^3 - 14*w^2 + 2*w + 10], [761, 761, -4*w^4 + 3*w^3 + 19*w^2 - 7*w - 10], [769, 769, -w^4 + 2*w^3 + 5*w^2 - 8*w - 1], [773, 773, 9*w^4 - 4*w^3 - 41*w^2 + 9*w + 15], [773, 773, 4*w^4 - 2*w^3 - 18*w^2 + 3*w + 6], [773, 773, 2*w^2 - 5], [787, 787, -w^4 + 6*w^2 - w - 7], [787, 787, w^4 - w^3 - 6*w^2 + w + 6], [821, 821, 2*w^4 - w^3 - 9*w^2 + 4*w + 8], [823, 823, 6*w^4 - w^3 - 27*w^2 - w + 8], [827, 827, -3*w^4 + 2*w^3 + 16*w^2 - 6*w - 9], [827, 827, -8*w^4 + 5*w^3 + 37*w^2 - 16*w - 17], [839, 839, 2*w^4 - 10*w^2 + w + 8], [853, 853, 2*w^4 - 2*w^3 - 11*w^2 + 7*w + 7], [857, 857, 5*w^4 - 2*w^3 - 24*w^2 + 7*w + 14], [877, 877, -w^4 + 2*w^3 + 5*w^2 - 10*w - 6], [883, 883, 3*w^4 - 3*w^3 - 15*w^2 + 12*w + 10], [887, 887, -4*w^4 + w^3 + 17*w^2 - w - 7], [907, 907, 2*w^4 - 11*w^2 - w + 2], [907, 907, -2*w^4 - w^3 + 10*w^2 + 4*w - 5], [911, 911, -9*w^4 + 4*w^3 + 43*w^2 - 9*w - 19], [919, 919, 4*w^4 - w^3 - 20*w^2 + w + 8], [937, 937, w^4 - 7*w^2 - 2*w + 4], [947, 947, 2*w^4 + 2*w^3 - 10*w^2 - 9*w + 3], [953, 953, -2*w^3 + 5*w + 4], [961, 31, -4*w^4 + w^3 + 19*w^2 - w - 4], [967, 967, 8*w^4 - 5*w^3 - 37*w^2 + 13*w + 18], [967, 967, 3*w^4 - w^3 - 13*w^2 - 2*w + 3], [971, 971, -4*w^4 + 3*w^3 + 21*w^2 - 10*w - 15], [971, 971, -3*w^4 + 12*w^2 + 3*w - 4], [971, 971, w^4 - 6*w^2 + 3*w + 6], [983, 983, -7*w^4 + 2*w^3 + 34*w^2 - 5*w - 16], [983, 983, w^4 - 7*w^2 - w + 8], [991, 991, -4*w^4 + 4*w^3 + 19*w^2 - 15*w - 12], [991, 991, -8*w^4 + 3*w^3 + 37*w^2 - 5*w - 15], [991, 991, -w^4 + w^3 + 7*w^2 - 3*w - 7], [997, 997, -8*w^4 + 5*w^3 + 37*w^2 - 16*w - 16]]; primes := [ideal : I in primesArray]; heckePol := x^2 + 4*x + 1; K := NumberField(heckePol); heckeEigenvaluesArray := [e, e - 2, -2*e - 7, -3*e - 9, -2*e - 7, 3*e + 4, 4*e + 7, e - 4, -2*e - 4, -3*e - 3, -3*e - 12, 4*e + 3, -7*e - 13, -1, -5*e - 8, 3*e + 2, e + 8, 5*e + 1, -2, e - 10, 2*e + 8, 2*e - 9, -e - 1, 7*e + 21, -2*e - 3, e - 12, 2*e - 10, e + 9, 9*e + 17, 2*e - 4, -5, -12*e - 24, e + 20, -9*e - 25, -2*e - 5, -10*e - 22, 7*e + 7, 5*e + 17, 6*e + 6, 3*e + 22, 7*e + 5, 8*e + 27, -5*e - 11, 11*e + 29, 2*e - 22, 9*e + 12, -4*e - 12, -7*e + 3, e - 7, 4*e, 2*e - 2, -4*e + 4, 5*e - 7, -7*e - 11, 4*e + 8, -9*e - 21, -e + 14, 4*e + 22, 10*e + 24, -18*e - 36, -2*e - 19, -3*e + 6, 8*e + 22, 4*e + 35, 21, 10*e + 12, 4*e + 8, -4*e + 18, -e + 19, 25, 4*e, 8*e - 8, -6*e - 13, -6*e - 11, -e + 5, -11*e - 39, 6*e - 8, -4*e - 12, -4*e - 22, -16*e - 23, 13*e + 38, 7*e + 21, -e - 1, -16*e - 32, -16*e - 22, -6*e - 6, -4*e + 12, -18*e - 28, -9*e - 23, -9*e - 11, 21*e + 40, -10*e + 4, 18*e + 40, -2*e + 12, e + 16, 14*e + 29, -8*e - 18, 4*e - 13, -2*e + 4, 21*e + 54, -15*e - 48, 4*e - 24, 2*e - 11, -e + 8, -e - 11, 13*e + 38, -9*e - 11, 10*e + 25, -18*e - 36, -4*e + 26, 9*e + 39, 9*e + 18, 5*e - 12, -2*e, e - 17, e - 39, 20*e + 35, -2*e - 44, 14*e + 34, -5*e - 18, 12*e + 2, 2*e - 20, 9*e - 3, -4*e - 40, -10*e - 52, -7*e + 4, -e - 20, -13*e - 13, 15*e + 45, 6*e + 36, -3*e + 31, -18*e - 26, -4*e + 17, 7*e - 14, 9*e, -8*e - 24, -6*e - 13, -16, -24*e - 46, 6*e + 53, 15*e + 44, 9*e + 15, 10*e + 6, 8*e + 7, -6*e - 38, 2*e + 46, -10*e - 34, 2*e - 26, -6*e - 13, -e + 10, -10*e - 2, -13*e - 45, -25*e - 47, -10*e - 48, -3*e - 27, -4*e - 32, -10*e - 40, 18*e + 37, 15*e + 39, -5*e + 12, -22*e - 28, -8*e - 10, 20*e + 40, -11*e - 55, 23*e + 31, -2*e + 14, -7*e - 21, -4*e + 4, 5*e + 27, 5*e - 19, -6*e - 48, -14*e - 46]; 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;