/* 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![41, 13, -12, -2, 1]; F := NumberField(g); ZF := Integers(F); NN := ideal; primesArray := [ [9, 3, -w^3 + 3*w^2 + 5*w - 15], [9, 3, -w^3 + 8*w + 8], [16, 2, 2], [19, 19, w + 1], [19, 19, -w^2 + 6], [19, 19, -w^2 + 2*w + 5], [19, 19, -w + 2], [25, 5, 2*w^2 - 2*w - 13], [29, 29, -w^2 + 9], [29, 29, -w^2 + 2*w + 6], [29, 29, w^2 - 7], [29, 29, -w^2 + 2*w + 8], [31, 31, -2*w^2 + w + 12], [31, 31, 2*w^2 - 3*w - 11], [41, 41, -w], [41, 41, -w + 1], [49, 7, w^3 + 2*w^2 - 10*w - 20], [49, 7, w^3 - 5*w^2 - 3*w + 27], [61, 61, 2*w^2 - 3*w - 14], [61, 61, 2*w^2 - w - 15], [71, 71, -w^3 + w^2 + 7*w - 5], [71, 71, w^3 - 2*w^2 - 6*w + 2], [79, 79, w^3 - 2*w^2 - 6*w + 4], [79, 79, 3*w^2 - 2*w - 18], [89, 89, 2*w^3 - 6*w^2 - 11*w + 33], [89, 89, -4*w^2 + 3*w + 25], [101, 101, w^3 + w^2 - 9*w - 12], [101, 101, w^3 - 4*w^2 - 4*w + 19], [109, 109, -w^3 + 3*w^2 + 6*w - 19], [109, 109, -2*w^2 + w + 18], [121, 11, -3*w^2 + 3*w + 19], [121, 11, 3*w^2 - 3*w - 20], [131, 131, 2*w^2 - 3*w - 15], [131, 131, 2*w^2 - w - 16], [139, 139, 3*w^2 - 4*w - 21], [139, 139, -w^3 - w^2 + 7*w + 13], [151, 151, 4*w^2 - 3*w - 27], [151, 151, 2*w^3 - w^2 - 13*w - 8], [151, 151, w^3 + 3*w^2 - 13*w - 27], [151, 151, 4*w^2 - 5*w - 26], [179, 179, w^3 - 3*w^2 - 5*w + 11], [179, 179, 3*w^3 - 11*w^2 - 14*w + 61], [179, 179, 2*w^3 - 2*w^2 - 12*w + 3], [179, 179, w^3 - 8*w - 4], [181, 181, -w - 4], [181, 181, w^3 - 5*w^2 - 3*w + 25], [181, 181, w^3 + 2*w^2 - 10*w - 18], [181, 181, w - 5], [229, 229, w^2 - 2*w - 11], [229, 229, w^2 - 12], [239, 239, 6*w^2 - 7*w - 42], [239, 239, 2*w^3 - 2*w^2 - 14*w - 3], [241, 241, w^3 - 4*w^2 - 4*w + 18], [241, 241, 3*w^2 - 2*w - 16], [269, 269, 3*w^2 - 4*w - 22], [269, 269, -w^3 + 6*w + 8], [281, 281, w^3 - w^2 - 9*w + 4], [281, 281, 2*w^3 - 9*w^2 - 8*w + 49], [311, 311, -2*w^3 - w^2 + 17*w + 19], [311, 311, 2*w^3 - 7*w^2 - 9*w + 33], [331, 331, w^3 + 2*w^2 - 9*w - 21], [331, 331, w^3 - 5*w^2 - 2*w + 27], [349, 349, 2*w^3 - w^2 - 15*w - 4], [349, 349, -2*w^3 + 5*w^2 + 11*w - 18], [359, 359, -w^3 + 6*w^2 - 31], [359, 359, -w^3 - 3*w^2 + 9*w + 26], [379, 379, 2*w^3 - 5*w^2 - 11*w + 20], [379, 379, 2*w^3 - 14*w - 11], [401, 401, w^3 - 3*w^2 - 4*w + 16], [401, 401, -2*w^3 + 4*w^2 + 11*w - 16], [401, 401, 2*w^3 - 2*w^2 - 13*w - 3], [401, 401, w^3 - 7*w - 10], [409, 409, w^3 - 4*w^2 - 4*w + 17], [409, 409, 2*w^3 - 6*w^2 - 9*w + 22], [409, 409, -2*w^3 + 15*w + 9], [409, 409, -w^3 + 3*w^2 + 6*w - 12], [419, 419, -w^3 + 5*w^2 + 3*w - 24], [419, 419, w^3 + 2*w^2 - 10*w - 17], [421, 421, w^3 + 3*w^2 - 12*w - 25], [421, 421, -w^3 - w^2 + 9*w + 7], [431, 431, -w^3 - 2*w^2 + 12*w + 20], [431, 431, w^3 + 3*w^2 - 10*w - 28], [431, 431, -w^3 + 6*w^2 + w - 34], [431, 431, -w^3 + 5*w^2 + 5*w - 29], [439, 439, w^3 - 7*w^2 - 2*w + 39], [439, 439, w^3 + 4*w^2 - 13*w - 31], [449, 449, -w^3 - 4*w^2 + 13*w + 34], [449, 449, 6*w^2 - 5*w - 36], [461, 461, -w^3 + 5*w^2 + w - 25], [461, 461, 2*w^3 - 15*w - 12], [461, 461, -2*w^3 + 6*w^2 + 9*w - 25], [461, 461, w^3 + 2*w^2 - 8*w - 20], [479, 479, -w^3 - 4*w^2 + 12*w + 31], [479, 479, 2*w^3 - 15*w - 16], [479, 479, -2*w^3 + 6*w^2 + 9*w - 29], [479, 479, w^3 - 7*w^2 - w + 38], [491, 491, w^2 - 3*w - 7], [491, 491, -2*w^3 + 3*w^2 + 11*w - 2], [491, 491, 4*w^2 - 2*w - 29], [491, 491, w^2 + w - 9], [499, 499, 5*w^2 - 6*w - 33], [499, 499, 5*w^2 - 4*w - 34], [509, 509, 2*w - 3], [509, 509, -2*w - 1], [541, 541, -w^3 - 4*w^2 + 12*w + 29], [541, 541, -w^3 + 7*w^2 + w - 36], [599, 599, -w^3 - w^2 + 8*w + 7], [599, 599, w^3 - 4*w^2 - 3*w + 13], [619, 619, w^2 - 3*w - 6], [619, 619, w^2 + w - 8], [641, 641, -2*w^3 + 16*w + 11], [641, 641, -2*w^3 + 6*w^2 + 10*w - 25], [659, 659, 2*w^3 + w^2 - 16*w - 16], [659, 659, 2*w^3 - 7*w^2 - 8*w + 29], [691, 691, -w^3 + 5*w^2 + 3*w - 23], [691, 691, -w^3 + 3*w^2 + 6*w - 11], [701, 701, w^3 - w^2 - 9*w + 3], [701, 701, 2*w^3 - w^2 - 14*w - 5], [709, 709, 2*w^3 - 3*w^2 - 11*w + 6], [719, 719, w^2 - 2*w - 12], [719, 719, -w^2 + 13], [739, 739, -2*w^3 + 8*w^2 + 7*w - 36], [739, 739, w^2 + 2*w - 13], [751, 751, -2*w^3 + 5*w^2 + 10*w - 20], [751, 751, 2*w^3 - w^2 - 14*w - 7], [761, 761, w^3 + 4*w^2 - 12*w - 32], [761, 761, -w^3 + 7*w^2 + w - 39], [769, 769, -2*w^3 - 4*w^2 + 23*w + 45], [769, 769, 2*w^3 - 5*w^2 - 9*w + 21], [769, 769, 2*w^3 + 2*w^2 - 18*w - 31], [769, 769, 2*w^3 - 10*w^2 - 9*w + 62], [811, 811, -w^3 + 10*w + 5], [811, 811, -5*w^2 + 8*w + 30], [811, 811, w^3 - 8*w^2 + 2*w + 43], [811, 811, 2*w^3 - 2*w^2 - 13*w + 2], [829, 829, -2*w^3 - 2*w^2 + 18*w + 25], [829, 829, -2*w^3 + 8*w^2 + 8*w - 39], [859, 859, -w^3 - 4*w^2 + 12*w + 33], [859, 859, -w^3 + 7*w^2 + w - 40], [919, 919, w^3 - 4*w^2 - 3*w + 24], [919, 919, -w^3 + 5*w^2 + w - 26], [929, 929, 5*w^2 - 7*w - 28], [929, 929, -w^3 + 2*w^2 + 6*w - 13], [929, 929, w^3 - w^2 - 7*w - 6], [929, 929, -2*w^3 + 2*w^2 + 14*w - 5], [941, 941, -2*w^3 + 3*w^2 + 11*w - 1], [941, 941, 2*w^3 - 3*w^2 - 11*w + 11], [961, 31, 5*w^2 - 5*w - 33], [971, 971, -w^3 - 3*w^2 + 11*w + 22], [971, 971, 7*w^2 - 5*w - 45], [971, 971, 7*w^2 - 9*w - 43], [971, 971, w^3 - 6*w^2 - 2*w + 29], [991, 991, w^3 - 3*w^2 - 3*w + 15], [991, 991, -w^3 + 5*w^2 + 2*w - 29]]; primes := [ideal : I in primesArray]; heckePol := x^3 - 4*x^2 - 12*x + 36; K := NumberField(heckePol); heckeEigenvaluesArray := [e, e, -1/2*e^2 + e + 5, -1, -1/2*e^2 + 9, -1/6*e^2 + 5/3*e - 1, e - 3, -1/3*e^2 + 1/3*e + 1, e - 2, 4, -1/3*e^2 - 2/3*e + 2, 1/3*e^2 - 1/3*e - 5, -1/2*e^2 + 7, 2*e - 2, 1/6*e^2 + 4/3*e - 3, -1/3*e^2 - 2/3*e + 6, -1/3*e^2 + 4/3*e + 2, 2/3*e^2 + 1/3*e - 14, -1/3*e^2 + 7/3*e + 2, -2/3*e^2 + 5/3*e, 1/3*e^2 + 5/3*e - 4, -e^2 + 2*e + 10, -1/6*e^2 - 4/3*e + 11, 0, -1/3*e^2 - 5/3*e + 8, 2/3*e^2 + 7/3*e - 10, 4/3*e^2 - 10/3*e - 14, -5/3*e^2 + 2/3*e + 22, -1/2*e^2 + 17, 1/2*e^2 - 11, 4/3*e^2 - 4/3*e - 18, 2/3*e^2 - 5/3*e - 16, -1/3*e^2 + 1/3*e - 4, e^2 - e - 6, 1/3*e^2 + 2/3*e + 10, -5/3*e^2 + 8/3*e + 13, -1/3*e^2 + 7/3*e + 12, -2/3*e^2 - 7/3*e + 19, 4/3*e^2 - 7/3*e - 8, -1/3*e^2 - 5/3*e + 2, 1/3*e^2 - 13/3*e - 5, 12, 1/2*e^2 - e - 19, 2/3*e^2 + 7/3*e - 17, -e^2 + 6, 1/3*e^2 + 2/3*e - 2, -e^2 - e + 7, -4/3*e^2 + 4/3*e + 9, 4*e, -e^2 - 3*e + 25, -2/3*e^2 + 20/3*e + 4, 2*e^2 - 4*e - 20, 2/3*e^2 - 5/3*e - 28, -1/3*e^2 - 5/3*e, 2*e^2 + e - 40, 3/2*e^2 - 2*e - 19, -7/6*e^2 + 11/3*e - 5, 4/3*e^2 - 13/3*e - 8, -5/2*e^2 + 4*e + 23, -4*e + 20, -5/3*e^2 - 10/3*e + 22, 11/3*e^2 - 11/3*e - 46, -1/3*e^2 + 16/3*e + 3, 3*e^2 - 6*e - 22, -1/3*e^2 + 22/3*e - 9, -4*e - 8, 2*e^2 + e - 34, -1/2*e^2 + 5*e + 17, e^2 - 37, 2*e + 2, -1/3*e^2 + 4/3*e, e^2 + 6*e - 22, -1/2*e^2 - 2*e + 15, 5/6*e^2 + 11/3*e - 19, -3/2*e^2 + 5*e + 11, 11/3*e^2 - 2/3*e - 50, -4/3*e^2 + 7/3*e + 29, 1/3*e^2 - 16/3*e - 3, 8/3*e^2 - 2/3*e - 38, e^2 - 3*e - 2, -1/3*e^2 - 5/3*e - 7, -1/3*e^2 - 17/3*e + 14, 1/3*e^2 - 7/3*e - 6, 8/3*e^2 - 17/3*e - 14, 2/3*e^2 + 4/3*e + 6, -11/6*e^2 + 25/3*e + 21, -19/6*e^2 + 5/3*e + 41, 2/3*e^2 + 7/3*e - 26, -1/3*e^2 + 16/3*e - 3, -5/3*e^2 + 26/3*e + 10, 1/3*e^2 - 1/3*e + 4, 4*e - 6, 7/3*e^2 - 31/3*e - 18, 4/3*e^2 + 5/3*e - 24, -1/3*e^2 - 2/3*e + 12, 3*e^2 - 7*e - 38, -5/3*e^2 - 7/3*e + 50, -8/3*e^2 + 8/3*e + 43, -2*e^2 + 6*e + 23, 17/6*e^2 - 7/3*e - 47, 7/3*e^2 - 7/3*e - 24, -5*e + 25, 8/3*e^2 - 8/3*e - 34, -4/3*e^2 + 22/3*e + 16, e^2 - 4*e - 14, -2*e^2 + 10*e + 18, 4/3*e^2 + 8/3*e - 24, 1/6*e^2 + 7/3*e + 3, 10/3*e^2 - 16/3*e - 32, -5/3*e^2 + 5/3*e - 5, -5/3*e^2 + 29/3*e + 8, -3*e^2 + 9*e + 34, -e^2 - e, e^2 - 3*e + 26, 11/6*e^2 + 14/3*e - 53, 2/3*e^2 - 23/3*e + 2, 10/3*e^2 - 10/3*e - 50, 11/6*e^2 - 19/3*e - 1, 2*e^2 - 9*e - 23, 10/3*e^2 - 4/3*e - 40, e^2 + e - 22, -7/3*e^2 - 5/3*e + 60, 1/3*e^2 + 17/3*e - 6, -1/6*e^2 - 19/3*e + 29, -25/6*e^2 + 5/3*e + 45, 2/3*e^2 - 5/3*e - 27, -1/3*e^2 - 17/3*e + 20, 8/3*e^2 + 4/3*e - 65, 2/3*e^2 - 2/3*e - 55, 8/3*e^2 - 17/3*e - 22, 4/3*e^2 - 16/3*e + 4, 2*e^2 - 2*e - 18, 3*e + 8, 2/3*e^2 + 7/3*e - 22, -13/3*e^2 - 2/3*e + 66, -1/3*e^2 - 23/3*e + 14, -2*e^2 - e + 58, 2/3*e^2 - 29/3*e - 4, 3*e^2 - 5*e - 48, 3*e^2 - 12*e - 36, -16/3*e^2 + 7/3*e + 64, -14/3*e^2 + 2/3*e + 70, -5*e^2 + 8*e + 46, -5/3*e^2 + 14/3*e + 12, 4/3*e^2 - 19/3*e - 14, 11/3*e^2 + 16/3*e - 68, -1/3*e^2 + 4/3*e + 34, 13/3*e^2 + 8/3*e - 59, 2/3*e^2 - 17/3*e - 14, -10/3*e^2 + 7/3*e + 34, 8/3*e^2 - 11/3*e - 4, -17/6*e^2 + 7/3*e + 17, 8/3*e^2 - 20/3*e - 16, 11/3*e^2 - 35/3*e - 13]; 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;