/* 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![9, 6, -7, -2, 1]; F := NumberField(g); ZF := Integers(F); NN := ideal; primesArray := [ [4, 2, -1/3*w^3 + 2/3*w^2 + 4/3*w - 1], [7, 7, 1/3*w^3 - 2/3*w^2 - 7/3*w + 1], [7, 7, w - 2], [7, 7, w - 1], [9, 3, w], [9, 3, -1/3*w^3 + 2/3*w^2 + 7/3*w - 2], [23, 23, -1/3*w^3 + 2/3*w^2 + 1/3*w - 2], [23, 23, -2/3*w^3 + 4/3*w^2 + 11/3*w - 4], [31, 31, -2/3*w^3 + 1/3*w^2 + 14/3*w + 2], [41, 41, -1/3*w^3 + 5/3*w^2 + 4/3*w - 7], [41, 41, -1/3*w^3 + 5/3*w^2 + 4/3*w - 4], [47, 47, 1/3*w^3 - 5/3*w^2 - 1/3*w + 5], [47, 47, w^2 - w - 4], [73, 73, -w^3 + 3*w^2 + 4*w - 8], [73, 73, -2/3*w^3 + 7/3*w^2 - 1/3*w - 4], [73, 73, -w^3 + w^2 + 7*w + 1], [73, 73, 2/3*w^3 - 4/3*w^2 - 14/3*w + 5], [79, 79, w^2 - 5], [79, 79, -2/3*w^3 + 7/3*w^2 + 8/3*w - 6], [97, 97, -2/3*w^3 + 7/3*w^2 + 5/3*w - 4], [97, 97, 1/3*w^3 + 1/3*w^2 - 7/3*w - 5], [103, 103, w^3 - 3*w^2 - 2*w + 5], [103, 103, -4/3*w^3 + 11/3*w^2 + 13/3*w - 10], [113, 113, -1/3*w^3 + 5/3*w^2 + 4/3*w - 3], [113, 113, w^3 - 2*w^2 - 5*w + 1], [113, 113, -1/3*w^3 + 5/3*w^2 + 4/3*w - 1], [113, 113, -1/3*w^3 + 5/3*w^2 + 4/3*w - 10], [127, 127, -2/3*w^3 + 1/3*w^2 + 14/3*w + 1], [127, 127, -2/3*w^3 + 7/3*w^2 + 2/3*w - 6], [137, 137, -1/3*w^3 + 5/3*w^2 - 2/3*w - 6], [137, 137, 1/3*w^3 + 1/3*w^2 - 10/3*w - 1], [151, 151, -w^3 + 2*w^2 + 3*w - 5], [151, 151, 1/3*w^3 + 1/3*w^2 - 10/3*w - 7], [169, 13, -2/3*w^3 + 7/3*w^2 + 5/3*w - 2], [169, 13, 1/3*w^3 + 1/3*w^2 - 7/3*w - 7], [191, 191, 1/3*w^3 - 2/3*w^2 + 2/3*w - 2], [191, 191, 2*w - 5], [191, 191, -w^3 + 2*w^2 + 6*w - 2], [191, 191, 2/3*w^3 - 4/3*w^2 - 14/3*w - 1], [239, 239, 1/3*w^3 - 2/3*w^2 - 7/3*w - 3], [239, 239, w - 5], [241, 241, 1/3*w^3 + 1/3*w^2 - 10/3*w], [241, 241, 4/3*w^3 - 17/3*w^2 + 2/3*w + 9], [241, 241, -1/3*w^3 + 5/3*w^2 - 2/3*w - 7], [241, 241, -4/3*w^3 + 14/3*w^2 + 13/3*w - 14], [257, 257, -w - 4], [257, 257, -1/3*w^3 + 2/3*w^2 + 7/3*w - 6], [263, 263, -4/3*w^3 + 11/3*w^2 + 16/3*w - 8], [263, 263, 2/3*w^3 - 1/3*w^2 - 8/3*w - 3], [281, 281, -1/3*w^3 - 1/3*w^2 + 10/3*w - 2], [281, 281, -1/3*w^3 + 5/3*w^2 - 5/3*w - 5], [281, 281, -1/3*w^3 + 5/3*w^2 - 2/3*w - 9], [281, 281, -2/3*w^3 + 1/3*w^2 + 17/3*w], [289, 17, -w^3 + 2*w^2 + 4*w - 4], [289, 17, w^3 - 2*w^2 - 4*w + 2], [311, 311, -2/3*w^3 + 10/3*w^2 - 4/3*w - 9], [311, 311, -2/3*w^3 - 2/3*w^2 + 20/3*w + 5], [313, 313, -1/3*w^3 + 5/3*w^2 - 2/3*w - 8], [313, 313, -1/3*w^3 - 1/3*w^2 + 10/3*w - 1], [313, 313, w^3 - 4*w^2 - 2*w + 10], [313, 313, 1/3*w^3 + 4/3*w^2 - 10/3*w - 8], [337, 337, -4/3*w^3 + 5/3*w^2 + 19/3*w + 4], [337, 337, 5/3*w^3 - 13/3*w^2 - 17/3*w + 5], [353, 353, -4/3*w^3 + 8/3*w^2 + 25/3*w - 3], [353, 353, -1/3*w^3 - 1/3*w^2 + 16/3*w + 6], [353, 353, -2/3*w^3 + 10/3*w^2 + 2/3*w - 13], [353, 353, -5/3*w^3 + 7/3*w^2 + 29/3*w - 3], [367, 367, -5/3*w^3 + 4/3*w^2 + 35/3*w + 4], [367, 367, 2/3*w^3 - 7/3*w^2 - 8/3*w + 4], [367, 367, -4/3*w^3 + 14/3*w^2 + 1/3*w - 8], [367, 367, w^2 - 7], [383, 383, 4/3*w^3 - 14/3*w^2 - 10/3*w + 15], [383, 383, -5/3*w^3 + 13/3*w^2 + 20/3*w - 12], [383, 383, 2*w^2 - 2*w - 13], [383, 383, w^3 - w^2 - 8*w - 1], [401, 401, -4/3*w^3 + 11/3*w^2 + 22/3*w - 11], [401, 401, 5/3*w^3 - 10/3*w^2 - 29/3*w + 5], [409, 409, -w^3 + 2*w^2 + 3*w - 2], [409, 409, -1/3*w^3 + 8/3*w^2 - 2/3*w - 6], [409, 409, 1/3*w^3 - 8/3*w^2 + 2/3*w + 12], [409, 409, 4/3*w^3 - 8/3*w^2 - 19/3*w + 4], [433, 433, -w^3 + 3*w^2 - 1], [433, 433, -1/3*w^3 + 5/3*w^2 - 8/3*w - 5], [433, 433, -w^3 + w^2 + 8*w - 2], [433, 433, 5/3*w^3 - 7/3*w^2 - 32/3*w - 2], [439, 439, w^2 - 10], [439, 439, -2/3*w^3 + 4/3*w^2 + 17/3*w - 7], [449, 449, -2/3*w^3 + 4/3*w^2 + 11/3*w - 8], [449, 449, -4/3*w^3 + 5/3*w^2 + 22/3*w + 2], [457, 457, 2/3*w^3 - 7/3*w^2 - 14/3*w + 6], [457, 457, 2/3*w^3 - 7/3*w^2 - 14/3*w + 9], [463, 463, w^3 - 3*w^2 - 6*w + 11], [463, 463, -1/3*w^3 + 5/3*w^2 + 10/3*w - 4], [479, 479, -1/3*w^3 + 5/3*w^2 - 2/3*w + 1], [479, 479, 5/3*w^3 - 10/3*w^2 - 23/3*w + 9], [487, 487, -2/3*w^3 + 7/3*w^2 + 2/3*w - 8], [487, 487, -2/3*w^3 + 1/3*w^2 + 14/3*w - 1], [503, 503, w^3 - 4*w^2 - 2*w + 16], [503, 503, -1/3*w^3 + 5/3*w^2 - 2/3*w - 11], [521, 521, -4/3*w^3 + 11/3*w^2 + 10/3*w - 7], [521, 521, 4/3*w^3 - 5/3*w^2 - 22/3*w], [529, 23, -1/3*w^3 + 2/3*w^2 + 4/3*w - 6], [569, 569, -1/3*w^3 + 8/3*w^2 + 1/3*w - 10], [569, 569, -2/3*w^3 + 10/3*w^2 + 5/3*w - 10], [577, 577, -2/3*w^3 + 10/3*w^2 + 5/3*w - 12], [577, 577, -1/3*w^3 + 8/3*w^2 + 1/3*w - 8], [593, 593, w^3 - w^2 - 5*w - 5], [593, 593, 4/3*w^3 - 11/3*w^2 - 13/3*w + 4], [599, 599, 2*w^2 - 3*w - 7], [599, 599, 2/3*w^3 - 1/3*w^2 - 8/3*w - 4], [599, 599, -1/3*w^3 + 8/3*w^2 - 5/3*w - 9], [599, 599, -4/3*w^3 + 11/3*w^2 + 16/3*w - 7], [607, 607, 4/3*w^3 - 8/3*w^2 - 22/3*w + 9], [607, 607, -2/3*w^3 + 4/3*w^2 + 2/3*w - 5], [625, 5, -5], [631, 631, -1/3*w^3 + 2/3*w^2 + 13/3*w - 5], [631, 631, -2/3*w^3 + 4/3*w^2 + 17/3*w - 1], [641, 641, -2/3*w^3 + 7/3*w^2 + 14/3*w - 7], [641, 641, 2/3*w^3 - 7/3*w^2 - 14/3*w + 8], [647, 647, -2/3*w^3 - 5/3*w^2 + 26/3*w + 8], [647, 647, -1/3*w^3 + 8/3*w^2 + 1/3*w - 9], [647, 647, -2/3*w^3 + 10/3*w^2 + 5/3*w - 11], [647, 647, -2/3*w^3 + 13/3*w^2 - 10/3*w - 13], [673, 673, -4/3*w^3 + 5/3*w^2 + 25/3*w - 2], [673, 673, -w^3 + 3*w^2 + w - 7], [727, 727, -2/3*w^3 + 7/3*w^2 + 2/3*w - 11], [727, 727, -2/3*w^3 + 1/3*w^2 + 14/3*w - 4], [743, 743, w^2 - w - 10], [743, 743, 1/3*w^3 - 5/3*w^2 - 1/3*w - 1], [769, 769, -w^3 + 2*w^2 + 7*w - 4], [769, 769, 3*w - 2], [809, 809, -1/3*w^3 + 8/3*w^2 - 2/3*w - 8], [809, 809, -1/3*w^3 + 8/3*w^2 - 2/3*w - 10], [823, 823, -w^3 + 2*w^2 + 7*w - 5], [823, 823, 3*w - 1], [839, 839, 4/3*w^3 - 2/3*w^2 - 25/3*w - 8], [839, 839, 2/3*w^3 - 7/3*w^2 - 14/3*w + 12], [857, 857, -1/3*w^3 + 5/3*w^2 - 5/3*w - 7], [857, 857, -2/3*w^3 + 1/3*w^2 + 17/3*w - 2], [863, 863, -2/3*w^3 + 7/3*w^2 - 7/3*w - 2], [863, 863, 5/3*w^3 - 7/3*w^2 - 35/3*w + 1], [881, 881, -2/3*w^3 + 1/3*w^2 + 14/3*w + 8], [881, 881, -2/3*w^3 + 13/3*w^2 - 4/3*w - 18], [881, 881, -5/3*w^3 + 7/3*w^2 + 35/3*w + 3], [881, 881, -2/3*w^3 + 7/3*w^2 + 2/3*w + 1], [887, 887, -1/3*w^3 + 11/3*w^2 - 8/3*w - 7], [887, 887, -1/3*w^3 + 11/3*w^2 - 8/3*w - 18], [911, 911, 5/3*w^3 - 4/3*w^2 - 29/3*w - 3], [911, 911, 2*w^3 - 6*w^2 - 5*w + 13], [929, 929, 2*w^3 - 4*w^2 - 9*w + 2], [929, 929, 5/3*w^3 - 10/3*w^2 - 17/3*w], [929, 929, -4/3*w^3 + 14/3*w^2 + 13/3*w - 11], [929, 929, 1/3*w^3 + 4/3*w^2 - 7/3*w - 9], [937, 937, -w^3 + 4*w^2 + w - 13], [937, 937, 2/3*w^3 + 2/3*w^2 - 17/3*w - 3], [953, 953, -2*w^3 + w^2 + 15*w + 8], [953, 953, -5/3*w^3 + 19/3*w^2 - 1/3*w - 11], [961, 31, 4/3*w^3 - 8/3*w^2 - 16/3*w + 5], [967, 967, -4/3*w^3 + 2/3*w^2 + 31/3*w + 11], [967, 967, 7/3*w^3 - 5/3*w^2 - 46/3*w - 9], [977, 977, 2*w^3 - 5*w^2 - 8*w + 10], [977, 977, -w^3 + 3*w^2 + 2*w - 14], [977, 977, -4/3*w^3 + 8/3*w^2 + 25/3*w - 11], [977, 977, -w^3 + w^2 + 6*w - 7], [983, 983, -5/3*w^3 + 16/3*w^2 + 8/3*w - 12], [983, 983, -1/3*w^3 + 11/3*w^2 - 11/3*w - 15], [983, 983, 3*w^2 - 2*w - 16], [983, 983, -5/3*w^3 + 16/3*w^2 + 11/3*w - 14], [991, 991, 4/3*w^3 - 8/3*w^2 - 22/3*w + 1], [991, 991, 2/3*w^3 - 4/3*w^2 - 2/3*w - 3]]; primes := [ideal : I in primesArray]; heckePol := x^2 - 8; K := NumberField(heckePol); heckeEigenvaluesArray := [-2, -e, 0, e, -1/2*e, -1/2*e, 1, 0, 0, -1/2*e, 3/2*e, e, -e, 5/2*e, 4, -4, 9/2*e, -3*e, e, -3/2*e, 1/2*e, 4, -4, 3/2*e, 11/2*e, -3/2*e, 1/2*e, -12, -4, 8, 16, 12, -12, 9/2*e, 9/2*e, -7*e, -6*e, -7*e, 0, -12, -4, -28, 21/2*e, -12, -15/2*e, -8, 0, -8*e, 10*e, -20, 22, 20, 6, -22, -14, 8, -24, 0, 16, 1/2*e, 13/2*e, 3/2*e, -9/2*e, 5/2*e, 6, -3/2*e, -26, -28, -6*e, 4, -4*e, 0, 24, 7*e, 13*e, -19/2*e, 13/2*e, -16, -15/2*e, 9/2*e, -16, 15/2*e, 30, -2, 15/2*e, -5*e, 9*e, -36, -12, -9/2*e, 7/2*e, -10*e, 8*e, 24, 16, 4, 20, -4, -36, -10, -10, -2, -7/2*e, -11/2*e, -3/2*e, 1/2*e, -17/2*e, 19/2*e, 15*e, 0, -e, -16*e, -4, 12, -14, -12*e, 6*e, -11/2*e, -19/2*e, 12, 10*e, 2*e, 12, 44, -12, -48, 40, -32, 8, 7/2*e, -9/2*e, 19/2*e, 3/2*e, -2*e, 2*e, -8*e, -14*e, 0, -48, 7*e, 19*e, 24, -35/2*e, 29/2*e, 48, -4*e, -6*e, 28, -60, -30, 34, -13/2*e, -1/2*e, 12, -20, 6, 6, 48, -48, 56, -52, -18, 12, -34, -48, 6*e, -10*e, -56, -18*e, -2*e]; 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;