/* 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 + x^2 - 7*x + 3; K := NumberField(heckePol); heckeEigenvaluesArray := [e, -e^2 - 2*e + 2, -e^2 - 3*e + 5, -1, e^2 + 2*e - 3, -e^2 + 9, 2*e^2 + 2*e - 8, -2*e - 2, -e^2 + 10, -2, -e^2 - 3*e + 11, -2*e^2 - 2*e + 10, e^2 - 7, e^2 - 2*e - 10, -e^2 - 3*e + 15, 5*e + 2, 2*e^2 + 4*e - 2, e^2 + 3*e - 1, 5*e^2 + 8*e - 19, -3*e^2 - 5*e + 21, -e^2 - 2*e - 4, 5*e^2 + 10*e - 19, -3*e^2 - 2*e + 17, -7*e^2 - 10*e + 27, -2*e^2 - e + 2, e^2 + 4*e + 5, -e^2 - e + 21, -2*e^2 - 7*e + 14, -3*e^2 - 6*e + 13, 2*e^2 + 10*e - 3, 4*e - 3, -e^2 - 4*e + 11, 6*e + 2, 5*e^2 + 14*e - 17, 3*e^2 + 10*e - 12, 4*e^2 + 2*e - 18, -5*e^2 - 10*e + 21, 2*e^2 - 6, -5*e^2 - 14*e + 35, 5*e^2 + 4*e - 23, e^2 - 4*e - 13, -e^2 - 4*e + 11, -4*e^2 - 6*e + 28, -7*e^2 - 10*e + 33, -e^2 - 6*e - 1, 4*e^2 + 8*e - 27, 3*e^2 - 13, -e^2 - 6*e - 5, 5*e^2 + 6*e - 20, 5*e^2 + 16*e - 20, 2*e^2 + 10*e - 12, -3*e^2 - 8*e + 33, 4, -e^2 + 3*e - 7, 2*e^2 + 6*e - 12, 3*e^2 + 12*e - 5, -2*e^2 + 6, -2*e^2 - 2*e + 23, -4*e^2 - 4*e + 7, 3*e^2 - 2*e - 25, -e^2 - 13, 8*e^2 + 15*e - 36, -3*e^2 - 8*e + 17, 2*e^2 + 13*e - 8, -3*e^2 - 10*e + 23, 4*e^2 + 6*e - 5, -8*e^2 - 21*e + 38, 7*e^2 + 12*e - 31, -9*e^2 - 16*e + 37, -2*e^2 - 6*e - 10, e^2 + 2*e + 13, 5*e^2 + 4*e - 35, 7*e^2 + 16*e - 21, -2*e^2 - 11*e + 6, e^2 - 4*e - 12, 9*e^2 + 20*e - 37, e^2 - 19, -5*e^2 - 4*e + 15, 5*e^2 + 2*e - 25, 3*e - 16, 4*e^2 - 4*e - 23, 3*e^2 - 6*e - 16, 4*e - 8, -3*e^2 - 8*e + 11, -6*e^2 - 10*e + 14, 3*e^2 + 2*e - 19, -e^2 - 6*e - 9, 6*e^2 + 4*e - 40, -6*e^2 - 12*e + 9, 11*e^2 + 18*e - 47, -e^2 - 3*e + 3, 7*e^2 + 20*e - 21, -e^2 + 4*e - 1, 4*e^2 + 9*e + 2, 8*e^2 + 14*e - 28, -5*e^2 - 12*e + 25, -4*e^2 - 18*e + 8, 2*e - 25, 2*e^2 - 4*e - 8, -9*e^2 - 14*e + 48, 2*e^2 + 2*e - 30, 6*e^2 + 8*e - 19, 5*e^2 + 6*e - 7, -3*e^2 - 2*e + 32, -6*e^2 - 9*e + 8, 6*e^2 + 12*e - 42, 3*e - 10, 10*e^2 + 18*e - 55, -3*e^2 - 11*e + 9, 12*e^2 + 17*e - 38, -3*e^2 - 14*e + 21, -4*e^2 - 6*e + 30, 9*e^2 + 28*e - 35, 2*e^2 + 4*e - 24, e^2 + 4*e + 11, 9*e^2 + 14*e - 51, -2*e^2 + 2*e + 26, 4*e^2 + 5*e + 8, 9*e^2 + 14*e - 55, -4*e^2 - 20*e + 10, -2*e^2 - 10*e + 3, -13*e^2 - 20*e + 51, -9*e^2 - 14*e + 15, 6*e^2 + 2*e - 30, -12*e^2 - 17*e + 38, -3*e^2 + 2*e + 9, 14*e^2 + 24*e - 62, 4*e^2 - 6*e - 36, 4*e^2 + 4*e - 39, -4*e^2 + 2*e + 40, 3*e^2 - 4*e - 24, -e^2 + 10*e - 7, e^2 + 12*e + 9, -3*e^2 - 12*e - 17, -8*e^2 - 22*e + 47, 7*e^2 + 12*e - 33, -6*e^2 - 9*e + 50, -5*e^2 + 6*e + 29, -8*e^2 - 16*e + 50, 5*e^2 + 10*e - 46, -7*e^2 - 16*e + 5, 3*e^2 + 12*e - 7, 4*e^2 + 16*e - 20, -3*e^2 - 4*e + 9, -4*e^2 - 21*e + 4, -14*e - 3, -2*e^2 + 7*e + 24, 5*e^2 + 7*e - 1, e^2 - 3*e + 3, 8*e^2 + 24*e - 40, -5*e^2 - 20*e + 27, e^2 + 8*e + 37, -6*e^2 - 8*e + 24, -7*e^2 - 4*e + 20, -4*e^2 + 6*e + 22, 15*e^2 + 24*e - 63, e^2 + 6*e - 30, -4*e^2 - 14*e + 43, -8*e^2 - 12*e + 66, 4*e^2 + 9*e + 16, 2*e^2 - 8*e - 12, -4*e^2 - 14*e + 32, 12*e - 20, -6*e^2 - 9*e + 38, 7*e^2 + 8*e - 47, -11*e^2 - 14*e + 38, 6*e^2 + 18*e - 35, 4*e^2 + 10*e - 38, -12*e^2 - 33*e + 76, -e^2 + 10*e + 5, 4*e^2 - 2*e - 34, -12*e^2 - 26*e + 54, 15*e^2 + 27*e - 47, -2*e^2 + 9*e + 12, 14*e^2 + 28*e - 46, 10*e^2 + 10*e - 64, 17*e^2 + 34*e - 73, -7*e^2 - 8*e + 27]; 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;