/* 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![31, 0, -12, 0, 1]; F := NumberField(g); ZF := Integers(F); NN := ideal; primesArray := [ [4, 2, -1/2*w^3 - 1/2*w^2 + 7/2*w + 11/2], [5, 5, -1/2*w^3 + w^2 + 5/2*w - 4], [5, 5, -1/2*w^2 - w + 3/2], [9, 3, -1/2*w^3 + 1/2*w^2 + 7/2*w - 9/2], [9, 3, -1/2*w^3 - 1/2*w^2 + 7/2*w + 9/2], [19, 19, -1/2*w^2 + w + 5/2], [19, 19, 1/2*w^2 + w - 5/2], [29, 29, -3/2*w^2 - w + 17/2], [29, 29, -3/2*w^2 + w + 17/2], [31, 31, 1/2*w^3 - 7/2*w], [59, 59, 1/2*w^2 + w - 11/2], [59, 59, 1/2*w^2 - w - 11/2], [61, 61, -1/2*w^3 + w^2 + 7/2*w - 5], [61, 61, 1/2*w^3 + w^2 - 7/2*w - 5], [71, 71, -1/2*w^3 - 2*w^2 + 11/2*w + 13], [71, 71, 3/2*w^3 + 2*w^2 - 23/2*w - 18], [79, 79, 1/2*w^3 + 1/2*w^2 - 7/2*w - 1/2], [79, 79, -2*w^2 + w + 10], [79, 79, 2*w^2 + w - 10], [79, 79, 1/2*w^3 - 1/2*w^2 - 7/2*w + 1/2], [89, 89, 1/2*w^3 - 2*w^2 - 5/2*w + 11], [89, 89, -1/2*w^2 + w + 15/2], [109, 109, -w^3 + 7*w + 3], [109, 109, 1/2*w^3 - 2*w^2 - 9/2*w + 12], [109, 109, w^3 + w^2 - 8*w - 11], [109, 109, w^3 - 7*w + 3], [121, 11, 3/2*w^2 - 19/2], [121, 11, -1/2*w^2 + 13/2], [131, 131, -1/2*w^3 + 3/2*w^2 + 7/2*w - 15/2], [131, 131, -1/2*w^3 + 9/2*w + 3], [179, 179, -w^3 - 5/2*w^2 + 9*w + 35/2], [179, 179, 1/2*w^3 + 2*w^2 - 7/2*w - 13], [179, 179, -1/2*w^3 + 2*w^2 + 7/2*w - 13], [179, 179, 3/2*w^3 + 4*w^2 - 27/2*w - 29], [181, 181, -1/2*w^3 + w^2 + 5/2*w - 7], [181, 181, 1/2*w^3 + w^2 - 5/2*w - 7], [191, 191, 2*w^2 + w - 12], [191, 191, 2*w^2 - w - 12], [211, 211, w^3 - w^2 - 7*w + 4], [211, 211, -w^3 - w^2 + 7*w + 4], [229, 229, 3/2*w^2 + w - 23/2], [229, 229, 3/2*w^2 - w - 23/2], [241, 241, 1/2*w^3 + 3/2*w^2 - 9/2*w - 17/2], [241, 241, -1/2*w^3 + 3/2*w^2 + 9/2*w - 17/2], [251, 251, w^3 - 5*w + 3], [251, 251, 3/2*w^3 - 23/2*w + 2], [251, 251, 5/2*w^2 + 3*w - 23/2], [251, 251, w^3 + 3*w^2 - 9*w - 24], [269, 269, 1/2*w^2 + 2*w - 9/2], [269, 269, 1/2*w^2 - 2*w - 9/2], [271, 271, 1/2*w^3 - 1/2*w^2 - 3/2*w - 3/2], [271, 271, w^3 + 3/2*w^2 - 6*w - 15/2], [271, 271, 1/2*w^3 + 3*w^2 - 9/2*w - 16], [271, 271, -1/2*w^3 - 2*w^2 + 5/2*w + 13], [281, 281, w^3 - 5/2*w^2 - 8*w + 33/2], [281, 281, w^2 + 2*w - 6], [281, 281, w^2 - 2*w - 6], [281, 281, w^3 + 5/2*w^2 - 8*w - 33/2], [311, 311, -5/2*w^3 - 3*w^2 + 37/2*w + 30], [311, 311, 2*w^2 - 2*w - 13], [331, 331, -1/2*w^3 + 7/2*w - 5], [331, 331, -w^3 + 5/2*w^2 + 7*w - 29/2], [331, 331, w^3 + 5/2*w^2 - 7*w - 29/2], [331, 331, 1/2*w^3 - 7/2*w - 5], [349, 349, 1/2*w^3 - 2*w^2 - 11/2*w + 16], [349, 349, w^3 + 3*w^2 - 6*w - 19], [349, 349, 1/2*w^3 - w^2 - 1/2*w - 1], [349, 349, 1/2*w^3 + 2*w^2 - 11/2*w - 16], [359, 359, 1/2*w^3 + 3/2*w^2 - 11/2*w - 15/2], [359, 359, w^3 - 4*w^2 - 2*w + 16], [361, 19, -1/2*w^2 + 15/2], [379, 379, 1/2*w^3 + 5/2*w^2 - 11/2*w - 37/2], [379, 379, -w^3 + 1/2*w^2 + 6*w - 15/2], [389, 389, w^3 - 1/2*w^2 - 7*w + 5/2], [389, 389, w^3 + 1/2*w^2 - 7*w - 5/2], [401, 401, 1/2*w^3 + 3/2*w^2 - 5/2*w - 21/2], [401, 401, -1/2*w^3 + 3/2*w^2 + 5/2*w - 21/2], [409, 409, -2*w^3 - 5*w^2 + 18*w + 38], [409, 409, 1/2*w^3 - w^2 - 13/2*w + 1], [419, 419, -1/2*w^3 + 1/2*w^2 + 5/2*w - 19/2], [419, 419, 1/2*w^3 + 1/2*w^2 - 5/2*w - 19/2], [431, 431, 1/2*w^3 - 3/2*w^2 - 7/2*w + 11/2], [431, 431, 1/2*w^3 + 3/2*w^2 - 7/2*w - 11/2], [439, 439, -1/2*w^3 + 5/2*w^2 + 5/2*w - 27/2], [439, 439, -1/2*w^3 - 5/2*w^2 + 5/2*w + 27/2], [449, 449, w^3 - 1/2*w^2 - 7*w + 7/2], [449, 449, w^3 + 1/2*w^2 - 7*w - 7/2], [461, 461, w^3 - 7/2*w^2 - 5*w + 37/2], [461, 461, -1/2*w^2 + 2*w + 21/2], [479, 479, -w^3 + 4*w^2 + 4*w - 20], [479, 479, 1/2*w^3 - 3/2*w + 8], [491, 491, 1/2*w^3 - 5/2*w^2 - 3/2*w + 29/2], [491, 491, 1/2*w^3 + 1/2*w^2 - 1/2*w - 7/2], [491, 491, 1/2*w^3 + w^2 - 11/2*w - 8], [491, 491, -1/2*w^3 + w^2 + 5/2*w - 12], [499, 499, 3*w^2 - w - 21], [499, 499, 1/2*w^3 + 5/2*w^2 - 11/2*w - 29/2], [499, 499, w^3 + 5*w^2 - 11*w - 32], [499, 499, 3*w^2 + w - 21], [509, 509, -w^3 + 3/2*w^2 + 4*w - 3/2], [509, 509, 1/2*w^3 + 3*w^2 - 3/2*w - 18], [529, 23, 1/2*w^3 - 2*w^2 - 11/2*w + 11], [529, 23, 1/2*w^3 + 2*w^2 - 11/2*w - 11], [569, 569, 1/2*w^3 + w^2 - 11/2*w - 3], [569, 569, -1/2*w^3 + w^2 + 11/2*w - 3], [571, 571, 5/2*w^2 + 2*w - 33/2], [571, 571, 2*w^3 - 5/2*w^2 - 16*w + 49/2], [571, 571, 2*w^3 + 5/2*w^2 - 16*w - 49/2], [571, 571, 5/2*w^2 - 2*w - 33/2], [599, 599, 1/2*w^3 - 1/2*w^2 - 11/2*w - 3/2], [599, 599, -1/2*w^3 - 1/2*w^2 + 11/2*w - 3/2], [601, 601, 2*w^3 + 3/2*w^2 - 15*w - 35/2], [601, 601, 5/2*w^3 + 3*w^2 - 39/2*w - 29], [619, 619, 5/2*w^3 + 5/2*w^2 - 37/2*w - 51/2], [619, 619, w^3 - 1/2*w^2 - 5*w + 11/2], [619, 619, 3/2*w^2 - 2*w - 23/2], [619, 619, w^3 + 3*w^2 - 10*w - 21], [631, 631, -5/2*w^3 + 33/2*w + 13], [631, 631, 3/2*w^3 - 5*w^2 - 13/2*w + 22], [631, 631, -2*w^3 - 2*w^2 + 14*w + 23], [631, 631, -5/2*w^2 - 5*w + 13/2], [641, 641, -1/2*w^3 + 1/2*w^2 + 11/2*w - 5/2], [641, 641, 1/2*w^3 + 1/2*w^2 - 11/2*w - 5/2], [659, 659, -3/2*w^3 - w^2 + 23/2*w + 14], [659, 659, 3/2*w^3 + 5/2*w^2 - 19/2*w - 27/2], [661, 661, -1/2*w^3 + 1/2*w^2 + 11/2*w - 9/2], [661, 661, w^3 + w^2 - 8*w - 5], [661, 661, -1/2*w^3 + 2*w^2 + 7/2*w - 8], [661, 661, -1/2*w^3 - 1/2*w^2 + 11/2*w + 9/2], [691, 691, 1/2*w^3 - 3/2*w^2 - 3/2*w + 19/2], [691, 691, 1/2*w^3 + 3/2*w^2 - 3/2*w - 19/2], [709, 709, 1/2*w^3 - 2*w^2 - 3/2*w + 12], [709, 709, 1/2*w^3 + 2*w^2 - 3/2*w - 12], [751, 751, 3/2*w^3 - w^2 - 21/2*w + 11], [751, 751, 3/2*w^3 + w^2 - 21/2*w - 11], [761, 761, 2*w^3 + 11/2*w^2 - 17*w - 85/2], [761, 761, -3/2*w^3 - 4*w^2 + 17/2*w + 23], [769, 769, w^3 - 7/2*w^2 - 8*w + 45/2], [769, 769, -1/2*w^3 - 5/2*w^2 + 5/2*w + 35/2], [769, 769, -1/2*w^3 + 5/2*w^2 + 5/2*w - 35/2], [769, 769, w^3 + 7/2*w^2 - 8*w - 45/2], [809, 809, w^3 - 7/2*w^2 - 7*w + 41/2], [809, 809, w^3 + 7/2*w^2 - 7*w - 41/2], [811, 811, -1/2*w^3 - 9/2*w^2 + 13/2*w + 59/2], [811, 811, 3*w^3 + 5*w^2 - 24*w - 45], [821, 821, -2*w^3 - 7/2*w^2 + 12*w + 33/2], [821, 821, w^3 - 4*w^2 - w + 13], [829, 829, -w^3 + 1/2*w^2 + 8*w - 1/2], [829, 829, w^3 + 1/2*w^2 - 8*w - 1/2], [839, 839, w^3 - 3/2*w^2 - 7*w + 13/2], [839, 839, w^3 + 3/2*w^2 - 7*w - 13/2], [841, 29, 5/2*w^2 - 27/2], [859, 859, 1/2*w^3 - 7/2*w - 6], [859, 859, -3/2*w^3 + 2*w^2 + 21/2*w - 15], [859, 859, 3/2*w^3 + 2*w^2 - 21/2*w - 15], [859, 859, 1/2*w^3 - 7/2*w + 6], [881, 881, -3/2*w^3 + 21/2*w + 8], [881, 881, -2*w^3 + 1/2*w^2 + 13*w + 15/2], [919, 919, -3/2*w^3 + 5/2*w^2 + 15/2*w - 19/2], [919, 919, 3/2*w^3 + w^2 - 21/2*w - 4], [929, 929, 1/2*w^3 + w^2 - 9/2*w - 1], [929, 929, 1/2*w^3 - w^2 - 9/2*w + 1], [941, 941, 2*w^3 + 7*w^2 - 19*w - 51], [941, 941, 5/2*w^2 - 3*w - 33/2], [961, 31, -w^2 + 12], [971, 971, 3/2*w^2 - 3*w - 25/2], [971, 971, w^3 + 7/2*w^2 - 6*w - 39/2], [991, 991, 1/2*w^3 - 3/2*w^2 - 13/2*w + 13/2], [991, 991, w^3 + 5/2*w^2 - 5*w - 29/2], [991, 991, w^3 - 5/2*w^2 - 5*w + 29/2], [991, 991, -3/2*w^3 + 2*w^2 + 17/2*w - 7]]; primes := [ideal : I in primesArray]; heckePol := x^2 + 6*x + 7; K := NumberField(heckePol); heckeEigenvaluesArray := [-1, e, 1, -e - 4, 2*e + 3, -e - 5, -4*e - 11, e + 8, 3*e + 13, 2*e + 5, 9*e + 28, -3*e - 16, -6*e - 14, 3*e + 3, -4*e - 21, 4*e + 14, e + 3, -5, -4*e - 8, -4, 5*e + 6, 3*e + 15, -6*e - 18, 2*e + 2, -2*e - 2, e - 5, e + 14, -5*e - 9, 3*e + 3, 6*e + 16, -12*e - 36, -8*e - 30, -8*e - 30, 9*e + 32, -9*e - 39, 3*e + 19, -3*e + 5, 11*e + 26, -4*e, 5*e + 34, -2*e - 6, -8*e - 14, e + 6, -11*e - 31, 14*e + 37, 8*e + 36, -7*e - 23, -14*e - 40, 4*e - 3, -4*e + 3, 4*e + 22, -5*e + 7, -2, -4*e - 19, -4*e - 39, -10, 9*e + 29, -6*e - 28, 4*e - 12, e - 23, -4*e - 4, -9*e - 28, -4*e - 29, 12*e + 22, -5*e - 19, -5*e - 9, -3*e - 32, 9*e + 16, -4*e + 17, -4*e - 2, -2*e - 17, -e - 13, -11*e - 45, -10*e - 45, -4*e - 11, 15*e + 37, 15*e + 37, 10*e + 46, 15*e + 34, 28, -9*e - 19, 9*e, -11*e - 40, 8*e + 42, -2*e - 18, -10*e - 50, -8*e - 30, -e - 16, 4, 15*e + 39, 16*e + 38, 3*e - 5, -22, 15*e + 42, -20*e - 59, 11*e + 24, 16*e + 66, 12*e + 46, -13*e - 22, 5*e + 23, -22*e - 69, 18*e + 48, 8*e + 52, -19*e - 61, 6*e + 32, -14*e - 54, -4*e - 21, -17*e - 56, 16*e + 35, 6*e + 52, -16*e - 42, -8*e, -23*e - 67, 20*e + 53, -4*e + 17, -6*e + 5, 17*e + 57, 29*e + 83, 20*e + 48, 2*e - 4, -12*e - 58, -9*e - 26, 3*e + 11, 4*e - 8, 3*e + 15, -20*e - 60, 22*e + 66, 10, e + 2, 20*e + 56, -6*e + 5, -9*e - 3, 10*e + 55, -e - 38, 5*e + 48, -16*e - 35, -4*e - 47, -2*e + 7, -5*e, -5*e - 7, -9*e - 21, 2*e - 22, -12*e - 36, -3*e - 11, -20*e - 50, 3*e + 1, 11*e + 34, -28*e - 72, -9*e - 17, e + 30, -10, -6*e - 50, -25*e - 59, 6*e + 21, -21*e - 41, e - 29, -35*e - 108, -28*e - 88, 19*e + 53, 16*e + 31, 6*e + 36, 5*e - 19, -18*e - 82, 9*e + 17, 7*e - 5, -4*e - 12, 25*e + 78, -e + 12, -10*e - 6, -2*e - 7, -4*e - 56]; 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;