/* 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^3 + 3*x^2 - 4*x - 7; K := NumberField(heckePol); heckeEigenvaluesArray := [-1, e, -e^2 - e + 5, -e^2 - e + 5, e, e^2 + 4*e - 2, e^2 + 4*e - 2, 2*e + 6, 2*e + 6, 2*e - 4, 2*e - 4, -2*e^2 - 6*e + 4, -2*e^2 - 6*e + 4, -e^2 - 2*e + 2, -e^2 - 2*e + 2, -2*e^2 - 4*e + 10, -2*e^2 - 4*e + 10, 3*e^2 + 5*e - 5, -2*e^2 - 4*e, -2*e^2 - 4*e, 2*e^2 + 3*e - 14, 2*e^2 + 3*e - 14, -e^2 - 2, -e^2 - 2, 2*e - 4, 2*e - 4, 4*e^2 + 4*e - 20, 4*e^2 + 4*e - 20, 4*e^2 - 28, e^2 - e + 7, -3*e^2 - 10*e + 10, -3*e^2 - 10*e + 10, e^2 - e + 7, 6*e + 4, 6*e + 4, 3*e^2 - 2*e - 22, -2*e^2 - 5*e + 2, -2*e^2 - 5*e + 2, 3*e^2 - 2*e - 22, -e - 2, -e - 2, -2*e^2 + 22, -2*e^2 + 22, -2*e^2 + 2, -2*e^2 + 2, 2*e^2 - 18, 2*e^2 - 18, e^2 - 3*e - 3, e^2 - 3*e - 3, e^2 + 3*e - 15, -e^2 - 3*e - 9, -e^2 - 3*e - 9, e^2 + 3*e - 15, 5*e^2 + 8*e - 10, -4*e^2 - 7*e + 26, -4*e^2 - 7*e + 26, 5*e^2 + 8*e - 10, 4*e^2 + 6*e - 22, 4*e^2 + 6*e - 22, 30, -4*e^2 - 8*e + 30, -4*e^2 - 8*e - 8, e^2 + 7*e + 7, e^2 + 7*e + 7, -4*e^2 - 8*e - 8, -3*e^2 - 9*e - 3, -e^2 + 8*e + 18, -e^2 + 8*e + 18, -3*e^2 - 9*e - 3, 6*e^2 + 17*e - 16, 6*e^2 + 17*e - 16, 3*e^2 + 13*e - 11, 3*e^2 + 13*e - 11, 6*e^2 + 16*e - 20, 6*e^2 + 16*e - 20, -2*e^2 + 16, 4*e^2 + 4*e - 10, 4*e^2 + 4*e - 10, -2*e^2 + 16, -3*e^2 - 11*e - 3, -3*e^2 - 11*e - 3, -4*e^2 - 4*e + 28, -6*e^2 - 16*e + 22, -6*e^2 - 16*e + 22, -4*e^2 - 4*e + 28, -2*e^2 + 6*e + 12, -2*e^2 + 6*e + 12, 2*e^2 + 8*e - 4, 2*e^2 + 8*e - 4, -6*e^2 - 8*e + 22, -6*e^2 - 8*e + 22, -e + 22, -e + 22, -2*e^2 - 6*e + 18, -2*e^2 - 6*e + 18, -4*e^2 + 46, 4*e^2 + 16*e - 24, 4*e^2 + 16*e - 24, 2*e^2 - 5*e - 20, 2*e^2 - 5*e - 20, -2*e^2 + 11*e + 24, -2*e^2 + 11*e + 24, 4*e^2 + 16*e - 24, 4*e^2 + 16*e - 24, -2*e^2 - 8*e - 6, -2*e^2 - 8*e - 6, -6*e^2 - 14*e + 14, 2*e^2 + 4*e - 12, 2*e^2 + 4*e - 12, -6*e^2 - 14*e + 14, -8*e^2 - 18*e + 34, -4*e^2 - 10*e + 4, -4*e^2 - 10*e + 4, -8*e^2 - 18*e + 34, -e^2 + 50, -3*e^2 + 10*e + 34, -3*e^2 + 10*e + 34, 7*e^2 + 15*e - 21, e^2 + e + 5, e^2 + e + 5, 7*e^2 + 15*e - 21, 3*e + 4, 8*e - 16, 8*e - 16, 3*e + 4, -e^2 - 13*e - 13, -e^2 - 13*e - 13, -10*e - 10, 2*e^2 + 14*e, 2*e^2 + 14*e, -10*e - 10, 8*e - 16, 8*e - 16, -17*e - 10, -17*e - 10, 6*e^2 + 10*e - 22, 6*e^2 + 10*e - 22, -e^2 - 14*e - 14, -e^2 - 14*e - 14, -6*e^2 - 6*e + 32, -6*e^2 - 6*e + 32, 3*e^2 - 3*e - 19, 3*e^2 + 15*e - 23, 3*e^2 + 15*e - 23, 3*e^2 - 3*e - 19, e^2 - 3*e + 15, 4*e^2 + 8*e - 20, 4*e^2 + 8*e - 20, e^2 - 3*e + 15, 4*e^2 + 10*e - 8, 4*e^2 + 10*e - 8, -4*e^2 - 10*e + 20, -4*e^2 - 10*e + 20, 2*e^2 + 4*e + 22, 2*e^2 + 4*e + 22, -e^2 + 4*e + 22, -e^2 + 4*e + 22, 11*e^2 + 18*e - 38, 9*e^2 + 14*e - 38, 9*e^2 + 14*e - 38, 11*e^2 + 18*e - 38, -10*e^2 - 14*e + 40, -2*e^2 - 16*e + 24, -2*e^2 - 16*e + 24, -10*e^2 - 14*e + 40, -2*e^2 + 12*e + 26, -2*e^2 + 12*e + 26, 6*e^2 + 11*e + 20, 12*e^2 + 23*e - 34, -12*e^2 - 24*e + 28, -12*e^2 - 24*e + 28, 12*e^2 + 23*e - 34, 5*e^2 + 10*e - 2, -14*e^2 - 23*e + 38, -14*e^2 - 23*e + 38, 5*e^2 + 10*e - 2, 7*e^2 + 8*e - 38, 7*e^2 + 8*e - 38]; 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;