/* 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![3, 5, -4, -2, 1]; F := NumberField(g); ZF := Integers(F); NN := ideal; primesArray := [ [3, 3, w], [3, 3, w - 2], [3, 3, w - 1], [16, 2, 2], [23, 23, -w^3 + 4*w + 1], [25, 5, w^3 - 2*w^2 - 2*w + 2], [25, 5, w^3 - w^2 - 3*w + 1], [29, 29, w^3 - 2*w^2 - 4*w + 4], [29, 29, w^3 - w^2 - 5*w + 1], [43, 43, -w^3 + 2*w^2 + 3*w - 2], [43, 43, w^3 - w^2 - 4*w + 2], [61, 61, -w^2 + 2*w + 4], [61, 61, w^2 - 5], [79, 79, 3*w^3 - 7*w^2 - 8*w + 16], [79, 79, -w^3 + w^2 + 6*w - 4], [101, 101, -w^3 + 3*w^2 + w - 7], [101, 101, w^3 - 4*w - 4], [103, 103, 2*w^3 - w^2 - 8*w - 1], [103, 103, 2*w^3 - 5*w^2 - 4*w + 8], [107, 107, 2*w^2 - 3*w - 4], [107, 107, 3*w - 5], [107, 107, w^3 - 4*w^2 + 10], [107, 107, 2*w^2 - w - 5], [113, 113, -w^3 + 4*w^2 + w - 11], [113, 113, -2*w^3 + 4*w^2 + 5*w - 5], [113, 113, 2*w^3 - 2*w^2 - 7*w + 2], [113, 113, w^3 + w^2 - 6*w - 7], [121, 11, w^3 - 3*w^2 - 4*w + 8], [121, 11, w^3 - 7*w - 2], [127, 127, w^2 - 4*w + 2], [127, 127, w^3 - w^2 - 2*w - 2], [127, 127, -w^3 + 2*w^2 + w - 4], [127, 127, -2*w^3 + 5*w^2 + 3*w - 8], [131, 131, 2*w^3 - 2*w^2 - 9*w + 2], [131, 131, -w^3 - w^2 + 7*w + 5], [157, 157, w^3 - w^2 - 7*w + 8], [157, 157, w^3 - w^2 - 5*w + 4], [169, 13, 2*w^2 - 2*w - 5], [173, 173, -w^3 + 7*w - 1], [173, 173, -w^3 - w^2 + 6*w + 4], [179, 179, -2*w^3 + 4*w^2 + 5*w - 8], [179, 179, -2*w^3 + 2*w^2 + 7*w + 1], [181, 181, -w^3 + 4*w^2 - 7], [181, 181, w^2 - 4*w + 5], [191, 191, 3*w^3 - 7*w^2 - 9*w + 20], [191, 191, -w^3 + 4*w + 5], [191, 191, -w^3 + 3*w^2 + w - 8], [191, 191, 3*w^3 - 3*w^2 - 12*w + 2], [199, 199, 2*w^2 - 7], [199, 199, 3*w^3 - 6*w^2 - 9*w + 13], [233, 233, w^3 - 3*w^2 - 4*w + 11], [233, 233, 3*w - 7], [251, 251, 3*w^3 - 7*w^2 - 7*w + 13], [251, 251, 4*w^3 - w^2 - 20*w - 11], [251, 251, -w^3 + w^2 + 5*w - 7], [251, 251, -2*w^3 + 4*w^2 + 8*w - 11], [257, 257, w^2 - 2*w - 7], [257, 257, w^2 - 8], [269, 269, 2*w^3 - 3*w^2 - 8*w + 2], [269, 269, 2*w^3 - 3*w^2 - 8*w + 7], [283, 283, -2*w^3 + 4*w^2 + 4*w - 7], [283, 283, 2*w^3 - 2*w^2 - 6*w - 1], [289, 17, -w^2 + w - 2], [289, 17, w^2 - w - 7], [311, 311, -w^3 + 2*w^2 + 3*w - 8], [311, 311, -w^3 + w^2 + 4*w + 4], [313, 313, -w^3 + 2*w^2 + 5*w - 5], [313, 313, w^3 - w^2 - 6*w + 1], [337, 337, 3*w - 1], [337, 337, 3*w - 2], [347, 347, -2*w^3 - w^2 + 11*w + 11], [347, 347, -2*w^3 + 7*w^2 + 3*w - 19], [367, 367, 4*w^3 - 8*w^2 - 13*w + 19], [367, 367, 4*w^3 - 4*w^2 - 17*w - 2], [373, 373, w^2 - 3*w - 5], [373, 373, w^2 + w - 7], [433, 433, 2*w^3 - 3*w^2 - 5*w + 1], [433, 433, -2*w^3 + 3*w^2 + 5*w - 5], [443, 443, w^3 - 7*w + 2], [443, 443, 3*w^3 - 6*w^2 - 12*w + 20], [491, 491, -2*w^3 + 3*w^2 + 8*w - 8], [491, 491, 2*w^3 - 3*w^2 - 11*w + 14], [521, 521, w^3 + w^2 - 8*w - 7], [521, 521, w^3 - 5*w^2 + 2*w + 10], [521, 521, w^3 + 2*w^2 - 5*w - 8], [521, 521, w^3 - 4*w^2 - 3*w + 13], [523, 523, 3*w^3 - 5*w^2 - 11*w + 11], [523, 523, w^3 + w^2 - 6*w - 1], [529, 23, 3*w^2 - 3*w - 10], [547, 547, w^3 - 3*w^2 - 4*w + 14], [547, 547, -2*w^3 + 2*w^2 + 7*w - 5], [547, 547, w^3 - 4*w + 4], [547, 547, 3*w^3 - 9*w^2 - 6*w + 22], [563, 563, w^3 - 2*w^2 - 6*w + 8], [563, 563, -3*w^3 + 4*w^2 + 11*w - 7], [563, 563, 3*w^3 - 5*w^2 - 10*w + 5], [563, 563, 3*w^3 - 8*w^2 - 3*w + 10], [571, 571, 2*w^3 - 3*w^2 - 5*w + 4], [571, 571, -2*w^3 + 3*w^2 + 5*w - 2], [599, 599, 2*w^3 - 2*w^2 - 5*w + 1], [599, 599, -2*w^3 + 4*w^2 + 3*w - 4], [641, 641, -2*w^2 + 7*w - 7], [641, 641, 2*w^2 + w - 8], [641, 641, 2*w^2 - 5*w - 5], [641, 641, w^3 - 4*w^2 - 2*w + 16], [647, 647, -w^3 + 3*w^2 - 2*w - 4], [647, 647, w^3 - w - 4], [653, 653, -2*w^3 + 4*w^2 + 9*w - 13], [653, 653, 3*w^3 - 7*w^2 - 6*w + 11], [673, 673, w^3 - 2*w^2 - 5*w + 11], [673, 673, -2*w^3 + 2*w^2 + 10*w - 5], [673, 673, 2*w^3 - 4*w^2 - 8*w + 5], [673, 673, 2*w^3 - 7*w^2 - w + 13], [677, 677, -w^3 + 2*w^2 + 6*w - 2], [677, 677, 3*w^3 - 7*w^2 - 8*w + 13], [677, 677, 3*w^3 - 2*w^2 - 13*w - 1], [677, 677, -w^3 + w^2 + 7*w - 5], [701, 701, w^2 - 5*w - 1], [701, 701, -w^3 + 4*w^2 + 3*w - 7], [701, 701, -w^3 - w^2 + 8*w + 1], [701, 701, w^2 + 3*w - 5], [719, 719, -2*w^3 + w^2 + 7*w + 5], [719, 719, 2*w^3 - 5*w^2 - 3*w + 11], [727, 727, 2*w^2 - 4*w - 11], [727, 727, -3*w^3 + w^2 + 10*w + 5], [751, 751, 4*w^3 - 12*w^2 - 7*w + 28], [751, 751, 2*w^3 - 6*w^2 - 5*w + 20], [757, 757, -w^3 + 2*w^2 - 5], [757, 757, w^3 - w^2 - w - 4], [797, 797, -4*w^3 + 7*w^2 + 13*w - 11], [797, 797, 4*w^3 - 5*w^2 - 17*w + 2], [797, 797, -4*w^3 + 7*w^2 + 15*w - 16], [797, 797, 4*w^3 - 5*w^2 - 15*w + 5], [809, 809, -w^3 + 4*w^2 + 3*w - 16], [809, 809, 3*w^3 - 8*w^2 - 10*w + 26], [841, 29, 3*w^2 - 3*w - 8], [857, 857, 4*w^3 - 2*w^2 - 21*w - 7], [857, 857, -w^3 + 2*w^2 - w + 4], [881, 881, -w^3 + 2*w^2 + 7*w - 10], [881, 881, w^3 - 5*w^2 - w + 13], [881, 881, w^3 + 2*w^2 - 8*w - 8], [881, 881, -w^3 + w^2 + 8*w + 2], [887, 887, w^3 - w^2 - 5*w - 5], [887, 887, -w^3 + 2*w^2 + 4*w - 10], [907, 907, -3*w^3 + 3*w^2 + 9*w - 5], [907, 907, 3*w^3 - 6*w^2 - 6*w + 4], [919, 919, 4*w^3 - 3*w^2 - 16*w - 2], [919, 919, -4*w^3 + 9*w^2 + 10*w - 17], [937, 937, -3*w^3 + w^2 + 12*w + 7], [937, 937, -3*w^3 + 8*w^2 + 5*w - 17], [953, 953, -2*w^3 + 6*w^2 + 2*w - 13], [953, 953, -w^3 + 3*w^2 + 4*w - 2], [953, 953, w^3 - 7*w + 4], [953, 953, 2*w^3 - 8*w - 7], [961, 31, 3*w^3 - 4*w^2 - 13*w + 1], [961, 31, 3*w^3 - 5*w^2 - 12*w + 13], [991, 991, 3*w^3 - w^2 - 15*w - 4], [991, 991, -w^3 - 3*w^2 + 7*w + 5], [991, 991, w^3 - 6*w^2 + 2*w + 8], [991, 991, 3*w^3 - 8*w^2 - 8*w + 17]]; primes := [ideal : I in primesArray]; heckePol := x^3 + 2*x^2 - 5*x - 4; K := NumberField(heckePol); heckeEigenvaluesArray := [1, 1, e, e^2 + e - 3, e^2 + 2*e, -2*e - 2, -e^2 + 6, -e - 2, -2*e + 2, 2*e^2 + 4*e - 4, -2*e^2 - e + 8, e^2 + 4*e - 6, -2*e^2 - 5*e + 6, -3*e^2 - 6*e + 8, 2*e, 3*e^2 + 6*e - 6, 4*e^2 + 4*e - 14, 2*e^2 + e - 4, -2*e^2 - 4*e + 8, -2*e^2 - 4*e + 12, -e^2 - 6*e + 4, -2*e^2 - 4*e + 12, -2*e^2 - 4*e + 12, -2*e^2 - 2*e + 10, -4*e^2 - 4*e + 14, -e^2 + 4*e + 6, 2*e^2 + 5*e - 10, 4*e - 2, -2*e^2 - 8*e + 6, 4*e^2 + 2*e - 16, 3*e^2 + 4*e - 8, -16, -e - 12, -2*e^2 + 20, 4*e^2 + 3*e - 16, -2*e^2 - 9*e + 10, 2*e + 6, -2*e^2 - 5*e + 6, 6*e + 6, -4*e^2 - e + 26, 4*e^2 - e - 24, -3*e^2 - 2*e + 20, 3*e^2 - 10, e^2 + 6*e - 2, 10*e + 8, e^2 + 6*e + 8, -2*e^2 + 8, -4*e^2 - 10*e + 8, -6*e^2 - 4*e + 24, 2*e^2 + 9*e - 12, -6*e + 6, 4*e^2 + e - 14, -2*e^2 - 4, -3*e^2 + 12, -4*e^2 + 28, e^2 + 4*e + 4, -e^2 - 6*e + 10, -2*e^2 + 2, -2*e^2 - 2*e + 22, -4*e^2 - 11*e + 18, -4*e^2 - 8*e + 20, 2*e^2 - 6*e - 12, -6*e^2 - 16*e + 18, 2*e^2 - 2*e - 22, -9*e - 12, 2*e^2 - 8, 4*e^2 + 4*e - 18, -2*e - 2, 4*e^2 + 8*e - 10, 2*e^2 + 4*e - 34, 2*e^2 - 5*e - 24, -2*e^2 - 12*e - 4, -4*e^2 - 6*e + 24, 5*e^2 + 6*e - 24, -2*e - 14, -4*e^2 - 8*e + 2, 4*e^2 + 12*e - 2, 6*e^2 + 12*e - 34, -8*e^2 - 8*e + 28, -5*e^2 - 16*e + 12, 10*e^2 + 18*e - 28, -4*e^2 - 6*e + 4, 6*e^2 + 14*e - 26, -8*e - 22, 6*e^2 + 4*e - 22, 12*e^2 + 12*e - 42, -6*e^2 + 44, 5*e^2 + 10*e - 28, -4*e^2 - 2*e + 26, 2*e^2 + 3*e, 2*e - 36, -5*e^2 + 6*e + 28, 6*e^2 + 12*e - 28, 6*e^2 + 10*e - 4, 8*e^2 + 6*e - 20, -2*e^2 + 2*e + 12, -2*e^2 + 20, 2*e^2 + 6*e + 12, 3*e^2 + 8*e - 12, -10*e^2 - 18*e + 40, -6*e - 24, -4*e^2 - 2*e - 6, -4*e^2 + 2*e + 14, 4*e + 14, 5*e^2 + 4*e - 30, 6*e - 24, -2*e^2 + 32, -e^2 - 2*e - 6, 8*e^2 + 22*e - 30, -e^2 - 2*e - 22, -6*e^2 + 2*e + 42, 6*e^2 + 6*e - 22, -11*e^2 - 12*e + 34, 2*e^2 - 4*e - 22, -12*e^2 - 10*e + 46, 4*e^2 + 12*e - 10, -4*e^2 + 8*e + 26, 6*e^2 + 4*e - 22, 6*e^2 + 16*e - 34, -4*e^2 - 9*e + 10, -e^2 + 8*e + 2, -8*e^2 - 14*e + 40, 8*e^2 - 2*e - 48, -2*e^2 - 9*e + 4, -16*e, -6*e^2 - 4*e, -6*e^2 - 12*e + 32, 6*e^2 + 2*e - 30, -2*e^2 - 2*e - 30, -2*e^2 - 5*e + 22, -3*e^2 - 8*e + 14, 14*e + 22, -4*e^2 + 34, -2*e^2 - 12*e - 10, 4*e^2 - 3*e + 2, -2*e - 14, 4*e^2 - 2*e - 26, -4*e^2 - 16*e + 14, -2*e^2 + 14, 8*e^2 + 16*e - 30, -2*e^2 + 12*e + 2, -4*e^2 + 4*e + 30, -2*e^2 + 12*e + 8, 8*e^2 + e - 36, 4*e^2 - 12*e - 44, -10*e^2 - 14*e + 44, -2*e^2 - 9*e - 20, -2*e - 8, 4*e^2 + 12*e - 2, -4*e^2 - 11*e + 2, 6*e + 30, 4*e^2 + 12*e - 22, 6*e^2 + 19*e - 10, -10*e^2 - 9*e + 34, -4*e^2 - 4*e + 34, -5*e^2 + 6*e + 10, 2*e^2 - 12*e, 11*e^2 + 2*e - 56, 6*e^2 + 14*e - 24, -6*e^2 - 16*e]; heckeEigenvalues := AssociativeArray(); for i := 1 to #heckeEigenvaluesArray do heckeEigenvalues[primes[i]] := heckeEigenvaluesArray[i]; end for; ALEigenvalues := AssociativeArray(); ALEigenvalues[ideal] := -1; 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;