/* 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![36, 6, -13, -1, 1]; F := NumberField(g); ZF := Integers(F); NN := ideal; primesArray := [ [4, 2, 1/3*w^3 - 4/3*w^2 - 4/3*w + 6], [4, 2, -1/3*w^3 - 2/3*w^2 + 10/3*w + 7], [9, 3, -1/2*w^3 + 3/2*w^2 + 7/2*w - 9], [9, 3, 1/3*w^3 + 2/3*w^2 - 7/3*w - 5], [11, 11, -1/6*w^3 + 1/6*w^2 + 1/6*w], [19, 19, w + 1], [19, 19, 1/6*w^3 - 1/6*w^2 - 13/6*w + 2], [25, 5, -1/3*w^3 + 1/3*w^2 + 7/3*w - 1], [29, 29, -1/6*w^3 + 1/6*w^2 + 13/6*w], [29, 29, w - 1], [31, 31, 1/3*w^3 - 1/3*w^2 - 10/3*w + 3], [31, 31, 1/6*w^3 - 1/6*w^2 - 1/6*w + 2], [41, 41, -1/2*w^3 - 1/2*w^2 + 9/2*w + 5], [41, 41, -1/2*w^3 + 3/2*w^2 + 5/2*w - 8], [59, 59, 1/3*w^3 - 1/3*w^2 - 10/3*w - 1], [59, 59, -1/3*w^3 + 4/3*w^2 + 7/3*w - 7], [59, 59, 1/2*w^3 - 1/2*w^2 - 5/2*w + 2], [79, 79, w^2 - 11], [79, 79, 1/6*w^3 - 7/6*w^2 - 7/6*w + 3], [89, 89, -1/6*w^3 + 1/6*w^2 + 19/6*w - 5], [89, 89, 1/6*w^3 - 1/6*w^2 - 19/6*w - 3], [109, 109, -1/6*w^3 + 7/6*w^2 + 1/6*w - 9], [109, 109, -7/6*w^3 + 19/6*w^2 + 49/6*w - 20], [109, 109, -5/6*w^3 + 17/6*w^2 + 23/6*w - 12], [109, 109, 1/6*w^3 + 5/6*w^2 - 13/6*w - 4], [121, 11, 1/6*w^3 - 1/6*w^2 - 7/6*w - 3], [139, 139, 1/3*w^3 - 4/3*w^2 + 5/3*w - 1], [139, 139, -5/3*w^3 - 7/3*w^2 + 50/3*w + 29], [169, 13, w^3 + w^2 - 10*w - 13], [169, 13, -5/6*w^3 + 17/6*w^2 + 17/6*w - 12], [179, 179, -1/3*w^3 + 4/3*w^2 + 1/3*w - 7], [179, 179, -2/3*w^3 + 2/3*w^2 + 17/3*w - 5], [181, 181, -w^3 + 3*w^2 + 4*w - 13], [181, 181, -1/6*w^3 + 7/6*w^2 + 1/6*w - 11], [181, 181, 7/6*w^3 + 11/6*w^2 - 79/6*w - 25], [181, 181, 1/6*w^3 + 5/6*w^2 - 13/6*w - 2], [191, 191, -5/6*w^3 - 1/6*w^2 + 53/6*w + 7], [191, 191, 1/6*w^3 + 11/6*w^2 - 19/6*w - 16], [211, 211, -1/6*w^3 + 1/6*w^2 - 5/6*w - 2], [211, 211, -1/2*w^3 + 1/2*w^2 + 9/2*w + 2], [211, 211, 1/3*w^3 - 1/3*w^2 - 4/3*w - 3], [211, 211, -1/2*w^3 + 1/2*w^2 + 11/2*w - 4], [229, 229, 5/6*w^3 + 1/6*w^2 - 53/6*w - 9], [229, 229, 1/2*w^3 - 3/2*w^2 - 1/2*w + 2], [239, 239, 5/6*w^3 + 7/6*w^2 - 59/6*w - 19], [239, 239, 1/2*w^3 - 5/2*w^2 + 1/2*w + 5], [241, 241, 1/6*w^3 - 1/6*w^2 - 13/6*w - 4], [241, 241, w - 5], [269, 269, -1/6*w^3 + 7/6*w^2 + 1/6*w - 2], [269, 269, 1/3*w^3 - 7/3*w^2 - 1/3*w + 7], [271, 271, 5/3*w^3 + 7/3*w^2 - 47/3*w - 25], [271, 271, -5/3*w^3 + 17/3*w^2 + 23/3*w - 27], [281, 281, 1/6*w^3 + 5/6*w^2 - 1/6*w - 7], [281, 281, -1/2*w^3 + 3/2*w^2 + 9/2*w - 8], [311, 311, 11/6*w^3 + 7/6*w^2 - 113/6*w - 23], [311, 311, -4/3*w^3 + 13/3*w^2 + 10/3*w - 13], [311, 311, -2/3*w^3 + 5/3*w^2 + 20/3*w - 17], [311, 311, 1/6*w^3 + 5/6*w^2 + 5/6*w + 1], [349, 349, -1/2*w^3 + 1/2*w^2 + 11/2*w - 1], [349, 349, -5/6*w^3 + 17/6*w^2 + 29/6*w - 14], [349, 349, 1/6*w^3 - 1/6*w^2 + 5/6*w - 1], [349, 349, -2/3*w^3 - 4/3*w^2 + 17/3*w + 13], [359, 359, -1/6*w^3 + 13/6*w^2 + 7/6*w - 18], [359, 359, -1/6*w^3 - 11/6*w^2 + 13/6*w + 18], [361, 19, 2/3*w^3 - 2/3*w^2 - 14/3*w + 1], [379, 379, 1/2*w^3 + 1/2*w^2 - 7/2*w - 7], [379, 379, -5/6*w^3 + 11/6*w^2 + 23/6*w - 7], [379, 379, w^3 - 9*w - 5], [379, 379, -2/3*w^3 + 5/3*w^2 + 14/3*w - 7], [401, 401, -1/3*w^3 + 7/3*w^2 + 4/3*w - 17], [401, 401, -4/3*w^3 - 8/3*w^2 + 43/3*w + 31], [419, 419, 1/6*w^3 - 1/6*w^2 + 5/6*w], [419, 419, 1/2*w^3 - 1/2*w^2 - 11/2*w + 2], [421, 421, -5/6*w^3 - 7/6*w^2 + 47/6*w + 11], [421, 421, 1/3*w^3 - 1/3*w^2 - 19/3*w - 7], [431, 431, 5/6*w^3 + 1/6*w^2 - 41/6*w - 6], [431, 431, 2/3*w^3 - 8/3*w^2 - 8/3*w + 15], [431, 431, 5/6*w^3 - 11/6*w^2 - 29/6*w + 7], [431, 431, 1/2*w^3 - 5/2*w^2 + 5/2*w + 2], [439, 439, 5/6*w^3 + 1/6*w^2 - 41/6*w - 4], [439, 439, 1/2*w^3 - 1/2*w^2 - 9/2*w + 8], [449, 449, 5/6*w^3 - 17/6*w^2 - 29/6*w + 18], [449, 449, 11/6*w^3 - 41/6*w^2 - 41/6*w + 29], [449, 449, -7/6*w^3 + 31/6*w^2 + 7/6*w - 16], [449, 449, 5/3*w^3 + 7/3*w^2 - 56/3*w - 33], [461, 461, -1/6*w^3 + 1/6*w^2 + 19/6*w - 3], [461, 461, 1/6*w^3 - 1/6*w^2 - 19/6*w - 1], [479, 479, -2*w - 1], [479, 479, 1/3*w^3 - 1/3*w^2 - 13/3*w + 3], [491, 491, 2/3*w^3 + 1/3*w^2 - 14/3*w - 7], [491, 491, 5/6*w^3 - 11/6*w^2 - 35/6*w + 7], [509, 509, 5/6*w^3 - 11/6*w^2 - 29/6*w + 8], [509, 509, 5/6*w^3 + 1/6*w^2 - 41/6*w - 5], [521, 521, -1/6*w^3 + 7/6*w^2 - 17/6*w + 1], [521, 521, -1/6*w^3 + 7/6*w^2 - 11/6*w - 3], [521, 521, -1/6*w^3 + 7/6*w^2 + 19/6*w - 5], [521, 521, 2/3*w^3 + 1/3*w^2 - 26/3*w - 11], [541, 541, 1/6*w^3 + 5/6*w^2 - 31/6*w - 17], [541, 541, 5/6*w^3 - 17/6*w^2 - 47/6*w + 23], [541, 541, 3*w^3 + 3*w^2 - 32*w - 47], [541, 541, 2/3*w^3 + 4/3*w^2 - 14/3*w - 11], [571, 571, -1/3*w^3 + 1/3*w^2 + 13/3*w - 1], [571, 571, 2*w - 1], [571, 571, -1/3*w^3 + 4/3*w^2 + 7/3*w - 1], [571, 571, 1/6*w^3 + 5/6*w^2 - 7/6*w - 13], [599, 599, 1/2*w^3 + 1/2*w^2 - 9/2*w - 2], [599, 599, -1/6*w^3 + 1/6*w^2 + 19/6*w - 2], [599, 599, 1/6*w^3 - 1/6*w^2 - 19/6*w], [599, 599, 1/2*w^3 - 3/2*w^2 - 5/2*w + 11], [601, 601, 1/6*w^3 + 11/6*w^2 - 7/6*w - 15], [601, 601, -1/3*w^3 + 7/3*w^2 - 5/3*w - 5], [601, 601, 2/3*w^3 + 4/3*w^2 - 26/3*w - 19], [601, 601, 1/2*w^3 - 5/2*w^2 - 7/2*w + 13], [659, 659, w^2 - 13], [659, 659, -5/6*w^3 + 11/6*w^2 + 29/6*w - 12], [659, 659, -1/6*w^3 + 7/6*w^2 + 7/6*w - 1], [659, 659, 5/6*w^3 + 1/6*w^2 - 41/6*w - 1], [691, 691, 1/2*w^3 - 1/2*w^2 - 11/2*w + 10], [691, 691, -1/6*w^3 + 1/6*w^2 - 5/6*w - 8], [701, 701, -2*w^2 + w + 11], [701, 701, -1/6*w^3 + 13/6*w^2 + 7/6*w - 9], [701, 701, -1/6*w^3 + 13/6*w^2 + 1/6*w - 16], [701, 701, -w^3 + w^2 + 9*w - 1], [709, 709, -2/3*w^3 + 11/3*w^2 + 14/3*w - 21], [709, 709, 1/3*w^3 + 5/3*w^2 + 2/3*w - 5], [709, 709, 7/6*w^3 - 25/6*w^2 - 43/6*w + 25], [709, 709, 2/3*w^3 - 2/3*w^2 - 23/3*w - 1], [719, 719, 2*w^2 - 2*w - 19], [719, 719, -2*w^2 + 2*w + 7], [739, 739, 5/6*w^3 - 5/6*w^2 - 29/6*w + 4], [739, 739, -5/6*w^3 + 11/6*w^2 + 53/6*w - 17], [739, 739, -1/6*w^3 - 5/6*w^2 - 11/6*w], [739, 739, -w^3 + w^2 + 8*w - 5], [751, 751, -1/6*w^3 + 1/6*w^2 + 25/6*w + 8], [751, 751, -1/3*w^3 + 1/3*w^2 + 16/3*w - 11], [761, 761, -2/3*w^3 + 5/3*w^2 + 8/3*w - 9], [761, 761, 5/6*w^3 + 1/6*w^2 - 47/6*w - 3], [769, 769, 1/3*w^3 - 7/3*w^2 - 7/3*w + 11], [769, 769, -4/3*w^3 - 8/3*w^2 + 46/3*w + 33], [769, 769, -1/2*w^3 + 5/2*w^2 + 5/2*w - 20], [769, 769, 2*w^2 - 17], [809, 809, 1/6*w^3 + 11/6*w^2 - 31/6*w - 15], [809, 809, -5/6*w^3 - 1/6*w^2 + 35/6*w + 3], [809, 809, 1/6*w^3 + 11/6*w^2 - 31/6*w - 9], [809, 809, w^3 - 2*w^2 - 7*w + 11], [811, 811, -1/6*w^3 - 5/6*w^2 + 25/6*w + 7], [811, 811, 1/6*w^3 + 5/6*w^2 - 25/6*w - 15], [811, 811, -1/6*w^3 - 5/6*w^2 + 25/6*w - 4], [811, 811, 1/6*w^3 + 5/6*w^2 - 25/6*w - 4], [821, 821, -1/2*w^3 - 5/2*w^2 + 13/2*w + 16], [821, 821, 1/6*w^3 - 13/6*w^2 - 7/6*w + 21], [821, 821, 3/2*w^3 + 1/2*w^2 - 35/2*w - 20], [821, 821, -1/6*w^3 + 13/6*w^2 + 7/6*w - 7], [829, 829, -1/6*w^3 + 19/6*w^2 - 11/6*w - 23], [829, 829, 5/6*w^3 - 17/6*w^2 - 5/6*w + 8], [829, 829, -4/3*w^3 - 2/3*w^2 + 43/3*w + 15], [829, 829, -1/6*w^3 - 17/6*w^2 + 25/6*w + 16], [839, 839, 1/3*w^3 - 7/3*w^2 + 2/3*w + 5], [839, 839, 1/2*w^3 + 3/2*w^2 - 13/2*w - 20], [841, 29, -5/6*w^3 + 5/6*w^2 + 35/6*w - 4], [859, 859, 1/6*w^3 + 5/6*w^2 - 37/6*w + 7], [859, 859, 13/6*w^3 + 17/6*w^2 - 127/6*w - 33], [881, 881, -2/3*w^3 + 2/3*w^2 + 20/3*w + 5], [881, 881, 17/6*w^3 + 19/6*w^2 - 167/6*w - 42], [911, 911, -1/6*w^3 + 13/6*w^2 - 11/6*w - 6], [911, 911, 3/2*w^3 + 1/2*w^2 - 33/2*w - 17], [911, 911, 5/6*w^3 - 17/6*w^2 + 1/6*w + 5], [911, 911, 7/6*w^3 - 1/6*w^2 - 61/6*w - 1], [929, 929, -7/6*w^3 - 11/6*w^2 + 67/6*w + 22], [929, 929, -1/6*w^3 + 1/6*w^2 - 11/6*w + 6], [941, 941, 11/6*w^3 + 19/6*w^2 - 107/6*w - 34], [941, 941, 4/3*w^3 - 10/3*w^2 - 25/3*w + 19], [941, 941, -11/6*w^3 + 41/6*w^2 + 47/6*w - 31], [941, 941, 1/2*w^3 + 1/2*w^2 - 13/2*w - 13], [961, 31, -1/3*w^3 + 1/3*w^2 + 7/3*w + 5], [991, 991, -1/6*w^3 - 5/6*w^2 + 25/6*w + 6], [991, 991, 1/6*w^3 + 5/6*w^2 - 25/6*w - 5]]; primes := [ideal : I in primesArray]; heckePol := x^2 - 3*x - 2; K := NumberField(heckePol); heckeEigenvaluesArray := [e, -1, 3, -e - 2, 2, -e + 7, -2*e + 2, e - 7, -e + 6, -2*e + 1, -2*e + 4, 4*e - 4, -2*e + 3, -e + 8, -3*e + 13, 2*e, -5*e + 3, 5*e - 3, -2*e, 5*e - 4, 9, 3*e - 10, -2*e + 3, 5*e, 5*e, 7*e - 10, -6, -3*e + 17, -e, 11*e - 16, -4*e + 10, -e - 13, -7*e + 16, -2*e, -6*e + 21, 3*e - 13, e + 11, 3*e - 17, -3*e + 9, 4*e - 4, -9*e + 7, 5*e + 11, 17, 7*e - 24, -18, -4*e, -4*e + 3, 7*e - 18, -5*e + 8, 7*e - 8, -e - 3, 10*e - 24, -3*e + 20, -e - 8, -4*e - 4, 7*e - 25, -e - 17, -4*e + 6, e - 3, -3*e + 30, -6*e, 2*e - 21, -3*e - 21, 12*e - 22, 14*e - 27, -4*e - 2, 10*e - 18, -13*e + 19, -14*e + 24, -2*e + 8, 18, 2*e - 34, 8*e - 4, 3*e + 16, 6*e - 7, -3*e - 25, e + 13, 4*e + 10, e - 25, 4*e - 8, -7*e + 13, -3*e + 14, 4*e - 27, 17*e - 27, -2*e - 8, -9*e + 14, -5*e - 4, 12*e - 6, -6*e - 20, -14*e + 24, -5*e - 7, -20*e + 29, 3*e - 8, e + 2, 6, -19*e + 25, -9*e + 28, 3*e - 20, e + 14, 5*e + 28, e - 24, e - 19, 4*e - 4, -2*e + 8, -4*e - 2, -10*e - 2, 13*e - 15, 2*e + 6, -2*e, -5*e + 12, 6*e - 16, -16*e + 26, e + 4, -17*e + 37, -2*e - 4, -4*e + 26, 9*e + 13, 2*e - 2, -3*e + 49, -13*e + 6, -8*e + 38, -11*e + 16, -10*e + 28, 13*e - 24, -8*e + 3, -3*e + 28, -4*e + 43, -6*e - 6, 16*e - 10, 3*e - 1, 7*e + 27, -e - 13, -4*e + 2, 17*e - 37, 2*e - 36, 7*e - 33, -16*e + 42, -7*e + 20, 12*e - 7, 10*e - 17, -21*e + 26, 10, -12*e + 3, 4*e - 46, 2*e - 3, 17*e - 41, 10*e + 14, 2*e + 12, -12*e + 42, -2*e + 8, 6*e + 12, -12*e + 34, 2*e - 8, -2*e + 24, 17*e - 24, 9*e + 12, -12*e + 50, -19*e + 21, 6*e - 6, -12*e + 2, 2*e - 30, -6*e + 6, -14*e + 5, -9*e + 30, 16*e - 26, -18*e + 16, 2*e + 40, 2*e - 20, -2*e + 4, 20*e - 38, -21*e + 42, -11*e + 10, -17*e + 24, 24*e - 43, -e - 29, 8*e - 36, -10*e + 26]; 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;