/* 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![7, 6, -5, -2, 1]; F := NumberField(g); ZF := Integers(F); NN := ideal; primesArray := [ [4, 2, -w^2 + w + 3], [7, 7, w], [7, 7, -w^2 + 2*w + 1], [7, 7, w^2 - 2], [7, 7, w - 1], [23, 23, -w^3 + w^2 + 3*w - 1], [23, 23, w^3 - 2*w^2 - 2*w + 2], [31, 31, w^2 - 5], [31, 31, -w^2 + 2*w + 4], [41, 41, -w^3 + 2*w^2 + 2*w - 6], [41, 41, w^3 - w^2 - 3*w - 3], [47, 47, w^2 - 2*w - 5], [47, 47, w^2 - 6], [71, 71, -w^3 + 2*w^2 + 3*w - 1], [71, 71, -w^3 + w^2 + 4*w - 3], [79, 79, -w - 3], [79, 79, w - 4], [81, 3, -3], [89, 89, w^2 - 3*w - 2], [89, 89, w^2 + w - 4], [97, 97, 2*w^3 - 5*w^2 - 4*w + 9], [97, 97, -2*w^3 + w^2 + 8*w + 2], [113, 113, w^3 - 2*w^2 - 4*w + 2], [113, 113, w^3 - w^2 - 5*w + 3], [121, 11, 2*w^2 - w - 9], [121, 11, -2*w^2 + 3*w + 8], [127, 127, w^3 - 3*w^2 - 2*w + 5], [127, 127, w^3 - 5*w - 1], [137, 137, 2*w - 1], [167, 167, 2*w^3 - 2*w^2 - 7*w - 2], [167, 167, w^3 - 7*w - 4], [167, 167, 2*w^3 - w^2 - 9*w - 2], [167, 167, 2*w^3 - 4*w^2 - 5*w + 9], [191, 191, 2*w^3 - 4*w^2 - 5*w + 5], [191, 191, -2*w^3 + 2*w^2 + 7*w - 2], [193, 193, -2*w^3 + 3*w^2 + 6*w - 6], [193, 193, -2*w^3 + 2*w^2 + 7*w - 4], [193, 193, -2*w^3 + 4*w^2 + 5*w - 3], [193, 193, 2*w^3 - 3*w^2 - 6*w + 1], [199, 199, -w^3 - 2*w^2 + 6*w + 10], [199, 199, -w^3 + 5*w^2 - w - 13], [223, 223, -w^3 + 2*w^2 + 3*w - 8], [223, 223, w^3 - w^2 - 4*w - 4], [233, 233, -w^2 - 1], [233, 233, w^2 - 2*w + 2], [239, 239, 3*w^2 - 2*w - 13], [239, 239, 3*w^2 - 4*w - 12], [241, 241, w^3 - w^2 - 6*w + 3], [241, 241, w^3 - 2*w^2 - 5*w + 3], [257, 257, -w^3 + 3*w^2 + 4*w - 9], [257, 257, -2*w^3 + 4*w^2 + 8*w - 11], [257, 257, -w^3 + 2*w^2 + 4], [257, 257, w^3 - 7*w - 3], [263, 263, -w^3 + w^2 + 3*w + 5], [263, 263, w^3 - 5*w^2 + 12], [263, 263, -w^3 - 2*w^2 + 7*w + 8], [263, 263, -w^3 + 7*w + 2], [271, 271, -w^3 + 3*w^2 + 2*w - 3], [271, 271, w^3 - 5*w + 1], [289, 17, 3*w^2 - 3*w - 8], [289, 17, 3*w^2 - 3*w - 10], [311, 311, -2*w^3 + 2*w^2 + 7*w - 1], [311, 311, -w^3 + 5*w^2 - w - 11], [311, 311, w^3 + 2*w^2 - 6*w - 8], [311, 311, -2*w^3 + 4*w^2 + 5*w - 6], [337, 337, w^3 - w^2 - 2*w - 4], [337, 337, 2*w^3 - 9*w - 4], [337, 337, 2*w^3 - 6*w^2 - 3*w + 11], [337, 337, -w^3 + 2*w^2 + w - 6], [353, 353, -w^3 + 4*w^2 - 12], [353, 353, w^3 + w^2 - 5*w - 9], [359, 359, 2*w^3 - 4*w^2 - 6*w + 5], [359, 359, 2*w^3 - 2*w^2 - 8*w + 3], [361, 19, -w^3 + 5*w^2 - 13], [361, 19, w^3 + 2*w^2 - 7*w - 9], [367, 367, 2*w^3 - 10*w - 5], [367, 367, w^3 - w^2 - 6*w + 2], [367, 367, -w^3 + 2*w^2 + 5*w - 4], [367, 367, 2*w^3 - 6*w^2 - 4*w + 13], [401, 401, -w^3 + 2*w^2 + 5*w - 5], [401, 401, -w^3 + w^2 + 6*w - 1], [409, 409, 2*w^3 - 3*w^2 - 6*w + 4], [409, 409, 3*w^3 - 3*w^2 - 12*w + 1], [409, 409, -3*w^3 + 6*w^2 + 9*w - 11], [409, 409, -2*w^3 + 3*w^2 + 6*w - 3], [431, 431, 3*w^2 - 5*w - 10], [431, 431, w^3 + w^2 - 8*w - 3], [457, 457, -2*w^3 + 4*w^2 + 4*w - 5], [457, 457, -2*w^3 + 2*w^2 + 6*w - 1], [463, 463, -2*w^3 + 7*w^2 + w - 16], [463, 463, 3*w^3 - 6*w^2 - 8*w + 8], [503, 503, -w^3 + 3*w^2 + 2*w - 12], [503, 503, -w^3 + 4*w^2 + 4*w - 10], [521, 521, w^3 + w^2 - 6*w - 2], [521, 521, -w^3 + 4*w^2 + w - 6], [529, 23, w^2 - w - 8], [569, 569, w^3 - 3*w - 6], [569, 569, -w^3 + 3*w^2 - 8], [577, 577, -w^3 + 4*w^2 - w - 10], [577, 577, w^3 + w^2 - 4*w - 8], [593, 593, -w^3 + 3*w^2 - 12], [593, 593, w^3 - 3*w - 10], [599, 599, w^3 + 3*w^2 - 7*w - 9], [599, 599, -w^3 + 3*w^2 + 3*w - 13], [601, 601, w^2 + 2*w - 4], [601, 601, w^2 - 4*w - 1], [607, 607, 2*w^2 - 13], [607, 607, w^3 + 2*w^2 - 7*w - 5], [607, 607, 2*w^3 - 3*w^2 - 8*w + 8], [607, 607, 2*w^2 - 4*w - 11], [617, 617, w^3 + w^2 - 9*w - 1], [617, 617, w^3 - w^2 - 4*w - 5], [617, 617, -w^3 + 2*w^2 + 3*w - 9], [617, 617, -w^3 + 4*w^2 + 4*w - 8], [625, 5, -5], [631, 631, -w^3 + 5*w^2 - 2*w - 13], [631, 631, w^3 + 2*w^2 - 5*w - 11], [641, 641, w^2 - 2*w + 3], [641, 641, -w^3 + 6*w - 2], [641, 641, -w^3 + 3*w^2 + 3*w - 3], [641, 641, -w^2 - 2], [647, 647, -2*w^3 + 5*w^2 + 4*w - 6], [647, 647, 2*w^3 - 4*w^2 - 5*w - 1], [647, 647, 3*w^3 - 7*w^2 - 7*w + 13], [647, 647, -2*w^3 + w^2 + 8*w - 1], [673, 673, -w^3 + 7*w - 2], [673, 673, -w^3 + 3*w^2 + 4*w - 4], [719, 719, -2*w^3 + 5*w^2 + 3*w - 12], [719, 719, 4*w^2 - 5*w - 10], [719, 719, -4*w^2 + 3*w + 11], [719, 719, 2*w^3 - w^2 - 7*w - 6], [727, 727, -w - 5], [727, 727, w - 6], [743, 743, w^2 + 2*w - 11], [743, 743, w^3 + 4*w^2 - 11*w - 11], [751, 751, -2*w^2 + w + 13], [751, 751, 2*w^2 - 3*w - 12], [769, 769, 2*w^3 - 6*w^2 - 3*w + 17], [769, 769, 3*w^3 - 2*w^2 - 11*w + 2], [809, 809, w^3 + 3*w^2 - 6*w - 11], [809, 809, -3*w^3 + 5*w^2 + 8*w - 11], [823, 823, -w^3 + w^2 + 2*w - 6], [823, 823, 4*w^2 - 5*w - 11], [823, 823, -4*w^2 + 3*w + 12], [823, 823, -w^3 + 4*w^2 + 4*w - 12], [839, 839, -2*w^3 + w^2 + 6*w + 5], [839, 839, -3*w^3 + 8*w^2 + 7*w - 17], [839, 839, 3*w^3 - w^2 - 14*w - 5], [839, 839, -2*w^3 + 5*w^2 + 2*w - 10], [857, 857, w^3 + w^2 - 8*w - 2], [857, 857, -w^3 + 4*w^2 + 3*w - 8], [863, 863, -w^3 + w^2 - w - 1], [863, 863, w^3 - 2*w^2 + 2*w - 2], [911, 911, -w^3 + 3*w^2 - 11], [911, 911, w^3 - 3*w - 9], [919, 919, -2*w^3 + w^2 + 8*w - 2], [919, 919, -2*w^3 + 5*w^2 + 4*w - 5], [929, 929, -2*w^3 + 2*w^2 + 9*w - 4], [929, 929, 2*w^3 - 9*w - 12], [929, 929, 2*w^3 - 6*w^2 - 3*w + 19], [929, 929, -2*w^3 + 4*w^2 + 7*w - 5], [937, 937, -w^3 + 2*w^2 - 6], [937, 937, -w^3 + 3*w^2 - 10], [937, 937, w^3 - 3*w - 8], [937, 937, w^3 - w^2 - w - 5], [953, 953, 2*w^3 - 6*w^2 - 3*w + 18], [953, 953, -3*w^3 + 3*w^2 + 11*w - 5], [961, 31, 4*w^2 - 4*w - 11], [967, 967, -w^3 + 7*w - 3], [967, 967, -2*w^3 + 2*w^2 + 11*w + 2], [967, 967, -w^3 - 4*w^2 + 9*w + 9], [967, 967, -w^3 + 3*w^2 + 4*w - 3], [977, 977, 2*w^2 - 5*w - 8], [977, 977, -w^3 + 2*w^2 - w + 6], [977, 977, -w^3 + w^2 - 6], [977, 977, 2*w^2 + w - 11], [983, 983, -w^3 + 6*w^2 - 2*w - 16], [983, 983, w^3 + 3*w^2 - 7*w - 13]]; primes := [ideal : I in primesArray]; heckePol := x^2 - 4*x - 1; K := NumberField(heckePol); heckeEigenvaluesArray := [0, e, -1/2*e + 5/2, 1/2*e - 9/2, -3, 1/2*e + 3/2, -5/2*e + 5/2, -3*e + 6, -5, 2*e + 1, -5, 3/2*e - 13/2, -1/2*e - 5/2, -1, -e - 4, 3/2*e - 23/2, -7/2*e + 7/2, e - 10, -11/2*e + 15/2, -3/2*e - 1/2, 7/2*e - 29/2, -5/2*e + 15/2, 4, -4*e + 12, 3/2*e + 29/2, 11/2*e - 27/2, 9, 5*e - 16, -7*e + 7, 13/2*e - 43/2, 3/2*e + 5/2, -7/2*e - 5/2, 13/2*e - 23/2, -3/2*e - 7/2, 5/2*e - 43/2, -6*e + 3, 4*e - 9, -2*e - 7, 6*e - 21, -5*e + 6, -6*e + 3, 7*e - 10, 9, -6*e + 16, 8*e - 22, -11/2*e + 37/2, -3/2*e + 1/2, -7*e + 14, 3*e + 4, -4*e - 2, -9, 8*e - 5, -4*e + 18, -e - 7, -13/2*e + 23/2, -13/2*e + 3/2, 9*e - 17, 11/2*e - 5/2, 3/2*e - 9/2, 5/2*e - 25/2, 1/2*e - 31/2, 15/2*e - 5/2, -3*e + 1, -e - 13, -13/2*e + 11/2, 23/2*e - 37/2, -19/2*e + 33/2, 17/2*e - 19/2, -5/2*e - 1/2, -13/2*e + 25/2, 15/2*e - 11/2, -13, 5*e - 18, -9/2*e + 5/2, -21/2*e + 49/2, 6*e - 9, -4*e - 3, 9*e - 4, 11*e - 14, 3*e + 17, -e + 25, 4*e + 1, 25/2*e - 53/2, 5/2*e + 47/2, -4*e + 37, -3/2*e - 47/2, -11/2*e + 29/2, 18*e - 36, -2*e + 24, 10*e - 3, 3*e - 4, -3/2*e + 31/2, 11/2*e - 27/2, 12*e - 11, -6*e + 35, -11/2*e + 57/2, -13/2*e - 21/2, -13/2*e + 59/2, -10*e + 28, -12*e + 22, 13*e - 33, -5*e + 13, 15/2*e - 87/2, -31/2*e + 75/2, -13/2*e - 19/2, -9/2*e + 33/2, 13/2*e - 67/2, 12*e - 25, -5*e - 16, 1/2*e + 37/2, -9/2*e + 75/2, -e + 15, 5*e - 27, -1/2*e + 59/2, -19/2*e + 15/2, 3*e + 6, -10*e + 27, -7/2*e - 27/2, 7*e - 48, 3*e - 20, 33/2*e - 67/2, 11/2*e - 57/2, 3*e + 4, -10*e + 25, -5/2*e + 35/2, 3/2*e - 57/2, 23/2*e - 37/2, -29/2*e + 53/2, -27/2*e + 91/2, -9/2*e + 85/2, 9/2*e - 93/2, -13/2*e - 19/2, -11/2*e - 33/2, 7*e - 23, e + 19, -e - 6, -43, 13/2*e + 17/2, 1/2*e - 59/2, -e + 18, 11*e - 6, 27/2*e - 75/2, -43/2*e + 89/2, -3/2*e + 109/2, 1/2*e - 13/2, -19*e + 26, 8*e - 4, 6*e - 50, 10*e - 47, -21/2*e + 93/2, -17/2*e - 15/2, 1/2*e - 109/2, 7/2*e - 31/2, 5/2*e - 109/2, -1/2*e + 13/2, 20*e - 29, 5*e - 34, -7/2*e - 37/2, 5*e + 26, -5*e + 16, 41/2*e - 93/2, 15/2*e + 19/2, -1/2*e - 35/2, 3/2*e - 63/2, -13/2*e - 25/2, -13*e - 2, -3*e + 48, 20*e - 29, 3*e - 46, 2*e - 7, -9*e + 40, 8*e - 31, e + 1, 4*e + 3, 12*e - 13, 19*e - 45, -4*e - 26, -14]; 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;