/* 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![29, 3, -12, -1, 1]; F := NumberField(g); ZF := Integers(F); NN := ideal; primesArray := [ [4, 2, 1/2*w^3 - 2*w^2 - 2*w + 15/2], [4, 2, -w^2 + w + 8], [5, 5, -1/4*w^3 + 1/2*w^2 + 1/2*w - 9/4], [5, 5, 1/2*w^3 - w^2 - 4*w + 9/2], [19, 19, 1/4*w^3 - 3/2*w^2 - 1/2*w + 21/4], [19, 19, 1/4*w^3 - 3/2*w^2 - 1/2*w + 41/4], [29, 29, w], [29, 29, 1/4*w^3 - 1/2*w^2 - 1/2*w + 1/4], [29, 29, 1/4*w^3 - 1/2*w^2 - 5/2*w + 9/4], [29, 29, -1/2*w^3 + w^2 + 4*w - 5/2], [41, 41, 3/4*w^3 - 5/2*w^2 - 7/2*w + 47/4], [41, 41, 1/4*w^3 + 1/2*w^2 - 5/2*w - 15/4], [61, 61, -3/2*w^3 + 3*w^2 + 11*w - 21/2], [61, 61, w^3 - 2*w^2 - 4*w + 6], [79, 79, 3/4*w^3 - 5/2*w^2 - 7/2*w + 27/4], [79, 79, 1/4*w^3 + 1/2*w^2 - 5/2*w - 35/4], [81, 3, -3], [89, 89, 7/4*w^3 - 11/2*w^2 - 21/2*w + 119/4], [89, 89, 1/4*w^3 + 3/2*w^2 - 3/2*w - 23/4], [109, 109, -1/2*w^3 + 3*w^2 + 2*w - 41/2], [109, 109, -5/4*w^3 + 7/2*w^2 + 9/2*w - 45/4], [121, 11, -3/4*w^3 + 3/2*w^2 + 9/2*w - 23/4], [121, 11, -1/4*w^3 + 1/2*w^2 + 3/2*w - 21/4], [131, 131, -1/2*w^3 + w^2 + 5*w - 3/2], [131, 131, 3/4*w^3 - 1/2*w^2 - 7/2*w - 1/4], [139, 139, -5/4*w^3 + 11/2*w^2 + 9/2*w - 73/4], [139, 139, -1/4*w^3 + 7/2*w^2 - 3/2*w - 113/4], [149, 149, -1/4*w^3 + 3/2*w^2 + 1/2*w - 49/4], [149, 149, 1/4*w^3 - 3/2*w^2 - 1/2*w + 13/4], [151, 151, 1/2*w^3 - 3*w^2 - w + 23/2], [151, 151, -1/4*w^3 + 3/2*w^2 + 3/2*w - 45/4], [151, 151, 3/4*w^3 - 3/2*w^2 - 7/2*w + 11/4], [151, 151, -2*w^3 + 6*w^2 + 7*w - 20], [169, 13, -1/4*w^3 + 1/2*w^2 + 1/2*w - 25/4], [169, 13, 1/2*w^3 - w^2 - 4*w + 17/2], [179, 179, -1/4*w^3 + 1/2*w^2 + 7/2*w - 21/4], [179, 179, 1/4*w^3 - 1/2*w^2 - 7/2*w - 3/4], [181, 181, 1/2*w^3 - 3*w - 7/2], [181, 181, -5/4*w^3 + 7/2*w^2 + 15/2*w - 57/4], [191, 191, -3/4*w^3 + 5/2*w^2 + 9/2*w - 39/4], [191, 191, w^2 - 8], [199, 199, -3/4*w^3 + 7/2*w^2 + 5/2*w - 43/4], [199, 199, -1/4*w^3 + 5/2*w^2 - 1/2*w - 81/4], [199, 199, -3/4*w^3 + 7/2*w^2 + 5/2*w - 75/4], [199, 199, -1/4*w^3 + 5/2*w^2 - 1/2*w - 49/4], [229, 229, -1/2*w^3 + 2*w^2 + w - 21/2], [229, 229, -3/4*w^3 + 5/2*w^2 + 7/2*w - 55/4], [239, 239, 3/2*w^3 - 4*w^2 - 9*w + 35/2], [239, 239, 3/2*w^3 - 5*w^2 - 7*w + 45/2], [241, 241, -5/4*w^3 + 9/2*w^2 + 13/2*w - 93/4], [241, 241, -1/4*w^3 - 1/2*w^2 - 1/2*w + 3/4], [251, 251, -w^3 + 3*w^2 + 8*w - 13], [251, 251, -7/4*w^3 + 13/2*w^2 + 13/2*w - 99/4], [269, 269, -9/4*w^3 + 13/2*w^2 + 15/2*w - 85/4], [269, 269, -3/4*w^3 + 5/2*w^2 + 3/2*w - 47/4], [271, 271, 5/4*w^3 - 5/2*w^2 - 21/2*w + 53/4], [271, 271, 5/4*w^3 - 1/2*w^2 - 23/2*w - 23/4], [271, 271, 7/4*w^3 - 11/2*w^2 - 13/2*w + 83/4], [271, 271, -1/2*w^3 + w^2 - 13/2], [281, 281, 3/4*w^3 - 1/2*w^2 - 13/2*w - 1/4], [281, 281, -w^3 + 3*w^2 + 4*w - 13], [311, 311, -1/4*w^3 + 1/2*w^2 - 1/2*w - 5/4], [311, 311, 7/4*w^3 - 13/2*w^2 - 19/2*w + 155/4], [311, 311, -1/4*w^3 + 7/2*w^2 + 1/2*w - 49/4], [311, 311, -3/4*w^3 + 3/2*w^2 + 13/2*w - 23/4], [331, 331, -3/4*w^3 + 1/2*w^2 + 15/2*w + 5/4], [331, 331, -3/4*w^3 + 5/2*w^2 + 3/2*w - 39/4], [349, 349, -1/4*w^3 + 1/2*w^2 + 7/2*w - 17/4], [349, 349, 1/4*w^3 - 1/2*w^2 - 7/2*w + 1/4], [359, 359, -5/4*w^3 - 1/2*w^2 + 25/2*w + 55/4], [359, 359, w^2 - 2*w - 2], [359, 359, -9/4*w^3 + 15/2*w^2 + 17/2*w - 113/4], [359, 359, -1/4*w^3 + 3/2*w^2 - 1/2*w - 45/4], [361, 19, -w^3 + 2*w^2 + 6*w - 8], [379, 379, -5/4*w^3 + 5/2*w^2 + 17/2*w - 37/4], [379, 379, -5/4*w^3 + 7/2*w^2 + 9/2*w - 41/4], [379, 379, 5/4*w^3 - 3/2*w^2 - 21/2*w - 3/4], [379, 379, -w^3 + 2*w^2 + 5*w - 7], [389, 389, 9/4*w^3 - 17/2*w^2 - 15/2*w + 117/4], [389, 389, -3/4*w^3 - 5/2*w^2 + 21/2*w + 113/4], [401, 401, -3/4*w^3 - 7/2*w^2 + 23/2*w + 149/4], [401, 401, 11/4*w^3 - 21/2*w^2 - 19/2*w + 143/4], [409, 409, -3/4*w^3 + 5/2*w^2 + 9/2*w - 31/4], [409, 409, w^2 - 10], [421, 421, 5/4*w^3 - 5/2*w^2 - 19/2*w + 49/4], [421, 421, -1/4*w^3 + 5/2*w^2 - 1/2*w - 41/4], [421, 421, 5/4*w^3 - 5/2*w^2 - 7/2*w + 41/4], [421, 421, 9/4*w^3 - 9/2*w^2 - 35/2*w + 77/4], [431, 431, 7/4*w^3 - 9/2*w^2 - 11/2*w + 59/4], [431, 431, 5/4*w^3 - 9/2*w^2 - 13/2*w + 85/4], [431, 431, 5/4*w^3 - 5/2*w^2 - 11/2*w + 33/4], [431, 431, -2*w^2 + w + 12], [439, 439, -1/2*w^3 + w^2 + 5*w - 7/2], [439, 439, 2*w - 1], [461, 461, -7/4*w^3 + 13/2*w^2 + 21/2*w - 163/4], [461, 461, 3/2*w^3 - 5*w^2 - 4*w + 31/2], [491, 491, 5/4*w^3 - 3/2*w^2 - 17/2*w + 21/4], [491, 491, -7/4*w^3 + 9/2*w^2 + 19/2*w - 83/4], [509, 509, -3/2*w^3 + 4*w^2 + 7*w - 27/2], [509, 509, -3/2*w^3 + 3*w^2 + 10*w - 27/2], [521, 521, -5/4*w^3 + 3/2*w^2 + 11/2*w - 17/4], [521, 521, -5/2*w^3 + 6*w^2 + 17*w - 53/2], [521, 521, -1/2*w^3 + 3*w^2 + w - 31/2], [541, 541, 9/4*w^3 - 7/2*w^2 - 35/2*w + 37/4], [541, 541, w^3 - 2*w^2 - 8*w + 12], [541, 541, -1/4*w^3 - 3/2*w^2 + 7/2*w + 35/4], [541, 541, -3/4*w^3 + 9/2*w^2 + 5/2*w - 119/4], [569, 569, -w^3 + 3*w^2 + 6*w - 7], [569, 569, -7/4*w^3 + 9/2*w^2 + 23/2*w - 75/4], [599, 599, 1/4*w^3 + 5/2*w^2 - 9/2*w - 95/4], [599, 599, -7/4*w^3 + 13/2*w^2 + 15/2*w - 91/4], [619, 619, 9/4*w^3 - 13/2*w^2 - 19/2*w + 97/4], [619, 619, -7/4*w^3 + 3/2*w^2 + 29/2*w + 9/4], [619, 619, -1/4*w^3 + 3/2*w^2 - 3/2*w - 45/4], [619, 619, -1/4*w^3 - 1/2*w^2 + 9/2*w - 1/4], [631, 631, -9/4*w^3 + 13/2*w^2 + 15/2*w - 93/4], [631, 631, -13/4*w^3 + 21/2*w^2 + 39/2*w - 233/4], [631, 631, 7/4*w^3 - 9/2*w^2 - 15/2*w + 67/4], [631, 631, 1/4*w^3 + 7/2*w^2 - 3/2*w - 51/4], [641, 641, -1/4*w^3 + 5/2*w^2 + 1/2*w - 57/4], [641, 641, -w^3 + 4*w^2 + 5*w - 19], [661, 661, -2*w^3 + 20*w + 19], [661, 661, 5/4*w^3 - 11/2*w^2 - 13/2*w + 149/4], [691, 691, -5/4*w^3 + 3/2*w^2 + 13/2*w - 9/4], [691, 691, -7/4*w^3 + 11/2*w^2 + 23/2*w - 135/4], [739, 739, -2*w^3 + 7*w^2 + 10*w - 34], [739, 739, 1/4*w^3 + 5/2*w^2 - 7/2*w - 59/4], [751, 751, -1/2*w^3 + 3*w^2 + 2*w - 33/2], [751, 751, -3/4*w^3 + 7/2*w^2 + 7/2*w - 67/4], [761, 761, -w^3 + 4*w^2 + 5*w - 27], [761, 761, 7/4*w^3 - 9/2*w^2 - 15/2*w + 63/4], [769, 769, -5/4*w^3 + 1/2*w^2 + 25/2*w + 19/4], [769, 769, 3/2*w^3 - 5*w^2 - 4*w + 39/2], [769, 769, -3*w^3 + 10*w^2 + 11*w - 37], [769, 769, -7/4*w^3 + 5/2*w^2 + 27/2*w - 31/4], [811, 811, -w^3 + 3*w^2 + 6*w - 9], [811, 811, -3/4*w^3 + 7/2*w^2 + 5/2*w - 39/4], [811, 811, -1/4*w^3 + 5/2*w^2 - 1/2*w - 85/4], [811, 811, -5/4*w^3 + 7/2*w^2 + 17/2*w - 57/4], [821, 821, -3/4*w^3 + 3/2*w^2 + 3/2*w - 35/4], [821, 821, -5/4*w^3 + 11/2*w^2 + 9/2*w - 121/4], [829, 829, 7/4*w^3 - 13/2*w^2 - 19/2*w + 115/4], [829, 829, 1/4*w^3 - 7/2*w^2 - 1/2*w + 89/4], [839, 839, -3/4*w^3 + 5/2*w^2 + 3/2*w - 51/4], [839, 839, -3/4*w^3 + 1/2*w^2 + 15/2*w - 7/4], [911, 911, -3/4*w^3 + 1/2*w^2 + 11/2*w - 15/4], [911, 911, -3/4*w^3 + 7/2*w^2 + 3/2*w - 75/4], [929, 929, 9/4*w^3 - 9/2*w^2 - 35/2*w + 73/4], [929, 929, -3/4*w^3 + 7/2*w^2 + 9/2*w - 51/4], [929, 929, -3/4*w^3 + 7/2*w^2 + 9/2*w - 91/4], [929, 929, 5/2*w^3 - 4*w^2 - 19*w + 25/2], [961, 31, -5/4*w^3 + 5/2*w^2 + 15/2*w - 37/4], [961, 31, -1/2*w^3 + w^2 + 3*w - 19/2]]; primes := [ideal : I in primesArray]; heckePol := x^3 - 2*x^2 - 5*x + 8; K := NumberField(heckePol); heckeEigenvaluesArray := [-1, e, -1, 0, 2*e^2 - 3*e - 7, e^2 - 7, -3*e^2 - e + 16, -e^2 + 5, 2*e^2 - 2*e - 4, e^2 - 2*e - 1, e^2 - 1, 2*e + 2, -3*e^2 + 19, -e^2 - e + 6, e^2 + 6*e - 9, 2*e^2 - 2*e - 12, -e^2 + 4*e + 5, -e + 9, -2*e^2 + 2*e + 10, e^2 - 3*e - 8, -2*e^2 + 3*e + 1, 3*e^2 - 2*e - 7, e^2 + 3*e - 16, -3*e^2 - 2*e + 23, 5*e^2 - 6*e - 13, -3*e^2 + 23, 2*e^2 + 4*e - 22, -3*e^2 - 5*e + 22, -2*e^2 + 7*e + 9, -5*e + 3, 2*e + 4, 6*e^2 - 2*e - 26, 2*e^2 + 4*e - 6, e^2 - e, -e^2 + 4*e + 1, 7*e^2 - 3*e - 24, -4*e^2 + 26, -2*e^2 + 2*e + 2, -3*e + 15, 5*e^2 - e - 18, -6*e^2 + 32, -e^2 + 5*e + 14, -4, -2*e^2 - 2*e + 14, 5*e^2 - 4*e - 19, -2*e^2 + 16, 2*e^2 - 4*e - 8, 9*e^2 - 45, 4*e + 12, 6, 5*e^2 - 25, 9*e^2 - 7*e - 30, 5*e^2 - 2*e - 27, -7*e^2 + 8*e + 31, 6*e^2 - 24, -2*e^2 + 2*e - 4, -5*e^2 + 2*e + 35, 3*e^2 - e - 24, -3*e^2 + 5*e, e^2 - 8*e + 7, -6*e^2 + 4*e + 16, -7*e^2 - 3*e + 40, 2*e^2 - 4*e - 8, e^2 - 3*e - 24, -9*e^2 + 2*e + 49, 4*e^2 - 22, -4*e + 8, -5*e^2 + e + 22, 7*e^2 + 6*e - 41, -e^2 + 2*e + 11, -e^2 - 8*e + 5, 2*e + 16, -7*e^2 + 10*e + 31, 10*e^2 - 6*e - 30, -2*e^2 + 6*e + 10, -4*e + 12, 4*e^2 + 3*e - 33, e^2 + e + 2, -5*e^2 + 9, -2*e^2 + 18, -e^2 + 8*e - 9, -8*e^2 + 6*e + 30, -8*e + 16, 2*e^2 + 10*e - 18, -2*e - 4, -9*e^2 + 9*e + 38, -3*e^2 + 6*e + 1, -6*e + 6, 8*e^2 - 4*e - 40, -8*e^2 + 36, 2*e^2 + e + 11, -e^2 - 2*e + 25, 4*e^2 - 4, 4*e + 8, 2*e^2 - 4*e - 6, -10*e^2 + 10*e + 38, 2*e^2 + 4*e - 6, -10*e^2 + 6*e + 40, -3*e^2 + 6*e + 15, 2*e^2 - 3*e + 17, -2*e^2 - 2*e + 26, -10*e^2 + 8*e + 28, 6*e^2 + 5*e - 31, 8*e^2 - 50, 2*e^2 - 14*e + 2, 4*e^2 - 2*e - 18, -3*e^2 + 14*e + 1, -10*e^2 + 4*e + 30, -12*e^2 + 12*e + 34, 6*e^2 - 9*e - 5, -7*e^2 - 3*e + 22, -4*e^2 + 2*e - 12, e^2 - 3*e - 14, -8*e^2 + 6*e + 20, -4*e^2 - 2*e + 34, 2*e^2 - 12*e - 14, 12*e^2 + 10*e - 72, 9*e^2 - 47, -2*e^2 + 2*e - 6, -3*e^2 + 2*e + 45, e^2 - e + 22, -11*e^2 - 2*e + 57, 8*e + 10, -6*e^2 - 10*e + 24, -4*e^2 - 12*e + 24, -5*e^2 - 2*e + 13, -13*e^2 + 10*e + 59, -10*e^2 + 18*e + 40, -6*e^2 + 20*e + 36, -7*e^2 + 9*e + 22, 9*e^2 + 5*e - 38, -e^2 + 2*e - 7, 6*e^2 - 16*e - 28, -7*e^2 + 12*e + 33, 6*e^2 - 20, -5*e^2 - 4*e + 21, -8*e^2 + 10*e + 20, -5*e^2 + 12*e + 3, -3*e^2 - 1, 6*e^2 - 10*e - 18, 7*e^2 + 3*e - 54, 12*e^2 - 14*e - 50, 6*e^2 - 8*e - 26, -9*e^2 - 3*e + 52, -12*e^2 - 2*e + 60, 12*e^2 - 6*e - 70, 11*e^2 + 5*e - 72, -e^2 + 2*e - 17, -9*e^2 + 23*e + 40, -10*e^2 + 46, 5*e^2 + 12*e - 17, -10*e^2 + 4*e + 24, 3*e^2 - 14*e + 5]; 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;