/* 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![2, 1, -7, -1, 1]; F := NumberField(g); ZF := Integers(F); NN := ideal; primesArray := [ [2, 2, w], [2, 2, -1/2*w^3 + w^2 + 3/2*w], [11, 11, 1/2*w^3 - w^2 - 5/2*w + 4], [11, 11, -w^3 + w^2 + 6*w + 1], [13, 13, -w^3 + w^2 + 6*w - 3], [19, 19, -1/2*w^3 + w^2 + 5/2*w], [23, 23, -1/2*w^3 + 2*w^2 - 1/2*w - 2], [31, 31, -w^3 + w^2 + 6*w - 1], [31, 31, 1/2*w^3 - 7/2*w], [43, 43, 1/2*w^3 - w^2 - 9/2*w + 2], [67, 67, w^2 - w - 5], [67, 67, -1/2*w^3 + 11/2*w + 2], [73, 73, w^2 + w + 1], [79, 79, 1/2*w^3 + w^2 - 5/2*w - 2], [81, 3, -3], [83, 83, 2*w^3 - 2*w^2 - 12*w + 5], [83, 83, -1/2*w^3 - w^2 + 1/2*w + 2], [89, 89, -3/2*w^3 + 2*w^2 + 17/2*w - 2], [89, 89, 3/2*w^3 - 2*w^2 - 21/2*w + 2], [97, 97, 1/2*w^3 - w^2 - 1/2*w - 2], [97, 97, -w^3 + w^2 + 8*w + 1], [103, 103, 2*w^3 - 2*w^2 - 14*w + 1], [103, 103, w^2 - w - 3], [107, 107, -3/2*w^3 + 2*w^2 + 21/2*w - 4], [109, 109, 5/2*w^3 - 3*w^2 - 33/2*w + 4], [109, 109, -1/2*w^3 + w^2 + 9/2*w - 4], [113, 113, -w^3 + w^2 + 8*w - 3], [113, 113, 1/2*w^3 - w^2 - 1/2*w + 2], [121, 11, 5/2*w^3 - 2*w^2 - 31/2*w + 2], [127, 127, -3/2*w^3 + w^2 + 23/2*w], [127, 127, -1/2*w^3 + 11/2*w], [131, 131, w^2 - 3*w - 3], [137, 137, 1/2*w^3 - w^2 - 5/2*w + 6], [139, 139, -3/2*w^3 + 2*w^2 + 13/2*w + 2], [151, 151, -1/2*w^3 + 2*w^2 + 3/2*w - 10], [157, 157, 7/2*w^3 - 5*w^2 - 47/2*w + 10], [157, 157, 7/2*w^3 - 4*w^2 - 45/2*w + 4], [167, 167, 1/2*w^3 + w^2 - 5/2*w - 4], [167, 167, 2*w + 5], [173, 173, -w^3 + w^2 + 4*w - 7], [181, 181, w^3 - 2*w^2 - 9*w + 1], [193, 193, -1/2*w^3 + 2*w^2 + 3/2*w - 8], [197, 197, -1/2*w^3 - w^2 + 13/2*w + 2], [197, 197, -w^3 + w^2 + 4*w - 1], [197, 197, w^3 - 2*w^2 - 7*w + 7], [197, 197, -2*w^3 + 3*w^2 + 13*w - 11], [199, 199, -2*w^3 + 3*w^2 + 11*w - 5], [239, 239, -w^3 + 2*w^2 + 5*w - 1], [239, 239, 7/2*w^3 - 4*w^2 - 45/2*w + 6], [241, 241, 1/2*w^3 - 2*w^2 - 7/2*w + 8], [257, 257, 3/2*w^3 - 2*w^2 - 17/2*w - 4], [257, 257, 1/2*w^3 - 7/2*w - 6], [257, 257, 7/2*w^3 - 5*w^2 - 43/2*w + 10], [257, 257, 3*w^3 - 4*w^2 - 19*w + 7], [269, 269, 1/2*w^3 + w^2 + 3/2*w + 2], [269, 269, -2*w^3 + 3*w^2 + 11*w - 11], [277, 277, 5/2*w^3 - 4*w^2 - 35/2*w + 8], [281, 281, -3/2*w^3 + w^2 + 23/2*w - 2], [283, 283, -w^3 - w^2 + 8*w + 11], [283, 283, -3*w^2 + 3*w + 19], [311, 311, 3/2*w^3 - 2*w^2 - 17/2*w - 2], [331, 331, -4*w^3 + 7*w^2 + 25*w - 21], [337, 337, -5/2*w^3 + 2*w^2 + 35/2*w + 4], [337, 337, -2*w^3 + 3*w^2 + 11*w - 9], [347, 347, 2*w^3 - 4*w^2 - 12*w + 13], [347, 347, 5/2*w^3 - 5*w^2 - 29/2*w + 20], [347, 347, -1/2*w^3 - 1/2*w - 6], [347, 347, -1/2*w^3 + 3*w^2 + 1/2*w - 16], [349, 349, 1/2*w^3 + w^2 - 9/2*w - 4], [353, 353, -1/2*w^3 + 2*w^2 + 7/2*w], [359, 359, 3/2*w^3 - w^2 - 19/2*w + 2], [373, 373, -2*w^3 + 2*w^2 + 12*w + 1], [373, 373, -1/2*w^3 + w^2 + 9/2*w - 6], [379, 379, w^2 - w - 9], [379, 379, -2*w^3 + 3*w^2 + 13*w - 5], [383, 383, w^2 + w - 5], [389, 389, 9/2*w^3 - 6*w^2 - 59/2*w + 14], [397, 397, 2*w^2 - 2*w - 15], [401, 401, -1/2*w^3 + 2*w^2 + 3/2*w - 4], [419, 419, -3/2*w^3 + w^2 + 15/2*w - 2], [419, 419, w^3 + w^2 - 8*w - 15], [431, 431, -5/2*w^3 + 4*w^2 + 27/2*w - 16], [431, 431, 2*w^3 - 4*w^2 - 10*w + 11], [443, 443, 1/2*w^3 - 3*w^2 - 5/2*w + 14], [449, 449, 1/2*w^3 + w^2 - 9/2*w - 6], [457, 457, -w^3 + 2*w^2 + 7*w - 9], [461, 461, 4*w^3 - 5*w^2 - 27*w + 7], [487, 487, 2*w^2 - 9], [499, 499, 3/2*w^3 - w^2 - 15/2*w - 2], [499, 499, 3/2*w^3 - 4*w^2 - 17/2*w + 16], [503, 503, -5/2*w^3 + 3*w^2 + 37/2*w], [509, 509, -3*w^3 + 3*w^2 + 18*w + 7], [521, 521, -1/2*w^3 - 2*w^2 + 11/2*w + 18], [521, 521, -5/2*w^3 + 4*w^2 + 31/2*w - 8], [523, 523, -1/2*w^3 + 2*w^2 + 11/2*w], [523, 523, -1/2*w^3 - w^2 + 9/2*w], [547, 547, -7/2*w^3 + 6*w^2 + 45/2*w - 18], [547, 547, -w^3 - w^2 + 12*w + 5], [547, 547, 3/2*w^3 - w^2 - 19/2*w + 4], [547, 547, w^3 - w^2 - 6*w - 5], [557, 557, 1/2*w^3 + w^2 - 9/2*w - 12], [557, 557, 3/2*w^3 - 2*w^2 - 21/2*w], [557, 557, 2*w^3 - 2*w^2 - 12*w + 1], [557, 557, w^3 - 3*w^2 - 6*w + 11], [569, 569, w^3 - 2*w^2 - 7*w + 1], [577, 577, w^3 + w^2 - 6*w - 5], [599, 599, -3/2*w^3 + 3*w^2 + 15/2*w - 10], [607, 607, -5/2*w^3 + 3*w^2 + 25/2*w + 4], [613, 613, w^3 - 9*w + 1], [619, 619, 3*w^2 - w - 17], [619, 619, w^3 - 3*w^2 - 6*w + 13], [625, 5, -5], [631, 631, 11/2*w^3 - 7*w^2 - 71/2*w + 16], [631, 631, -3/2*w^3 + 2*w^2 + 13/2*w], [643, 643, w^2 - 3*w - 5], [653, 653, 2*w^2 - 2*w - 11], [659, 659, 5*w^3 - 3*w^2 - 36*w - 9], [659, 659, -w^3 + 7*w - 1], [673, 673, 5/2*w^3 - 2*w^2 - 31/2*w - 4], [677, 677, 13/2*w^3 - 6*w^2 - 87/2*w + 2], [691, 691, -3/2*w^3 + 2*w^2 + 13/2*w - 2], [701, 701, -w^3 + 3*w^2 + 4*w - 13], [701, 701, w^3 - 2*w^2 - 9*w + 3], [709, 709, -w^2 - 5*w - 1], [739, 739, 3/2*w^3 - w^2 - 15/2*w], [743, 743, -2*w^3 + w^2 + 15*w + 1], [751, 751, -2*w^3 + 4*w^2 + 12*w - 11], [757, 757, -6*w^3 + 9*w^2 + 39*w - 23], [757, 757, -w^3 - w^2 + 8*w + 3], [757, 757, 13/2*w^3 - 8*w^2 - 83/2*w + 16], [757, 757, 3*w^3 - 4*w^2 - 17*w + 3], [761, 761, 7/2*w^3 - 5*w^2 - 47/2*w + 12], [769, 769, -3*w^2 + 7*w + 3], [773, 773, -3/2*w^3 - w^2 + 19/2*w + 4], [787, 787, -4*w^3 + 5*w^2 + 23*w - 17], [787, 787, 1/2*w^3 - w^2 - 9/2*w - 4], [809, 809, -2*w^3 + 2*w^2 + 16*w + 3], [809, 809, -4*w^3 + 5*w^2 + 25*w - 9], [811, 811, 3*w^3 - 3*w^2 - 20*w + 5], [811, 811, w^3 - 3*w^2 - 6*w + 17], [823, 823, 5/2*w^3 - w^2 - 33/2*w - 10], [829, 829, 5/2*w^3 - 3*w^2 - 33/2*w + 2], [829, 829, -3*w^3 + 2*w^2 + 23*w - 1], [839, 839, -11/2*w^3 + 7*w^2 + 67/2*w - 18], [853, 853, -w^3 + 2*w^2 + 3*w - 5], [853, 853, -5*w^3 + 7*w^2 + 32*w - 15], [857, 857, 3/2*w^3 - 5*w^2 - 15/2*w + 26], [859, 859, -w^3 + 3*w^2 + 4*w - 17], [863, 863, 4*w^3 - 4*w^2 - 26*w + 3], [877, 877, w^3 - 5*w - 5], [887, 887, 3/2*w^3 - w^2 - 11/2*w + 8], [907, 907, -9/2*w^3 + 7*w^2 + 53/2*w - 24], [919, 919, 7/2*w^3 - 6*w^2 - 41/2*w + 22], [929, 929, -2*w^3 + 3*w^2 + 11*w - 1], [937, 937, 2*w^3 - 4*w^2 - 12*w + 7], [947, 947, 9/2*w^3 - 5*w^2 - 61/2*w + 10], [953, 953, -1/2*w^3 + 2*w^2 + 3/2*w + 2], [961, 31, -1/2*w^3 + 2*w^2 - 1/2*w - 6], [977, 977, 5/2*w^3 - 2*w^2 - 31/2*w], [983, 983, -5/2*w^3 + 6*w^2 + 27/2*w - 24], [983, 983, -3/2*w^3 + 2*w^2 + 21/2*w - 10], [983, 983, -w^3 + 4*w^2 + 7*w - 15], [983, 983, -1/2*w^3 + 3*w^2 - 3/2*w - 4], [997, 997, 1/2*w^3 - w^2 - 5/2*w - 4], [997, 997, 1/2*w^3 + w^2 - 17/2*w - 2]]; primes := [ideal : I in primesArray]; heckePol := x^2 + x - 1; K := NumberField(heckePol); heckeEigenvaluesArray := [e, 0, -1, -2*e, -2*e - 3, -1, -5, 4*e + 4, 2*e - 4, 2*e + 5, 6*e + 7, 2*e + 4, -2*e - 6, 10*e, 4*e + 1, 4*e + 11, -2*e - 7, -4*e - 8, -8*e, -14*e - 6, 6*e - 2, 8*e + 4, -4*e + 6, 2*e + 19, 10*e + 8, -4*e - 6, -4*e - 8, -10, -4*e - 4, -4*e + 3, -6*e + 6, -10*e - 7, 18*e + 9, 8*e + 5, -12*e - 13, -4, 4*e - 10, 12*e - 4, -12, -6*e + 16, -10*e - 5, -14*e - 8, -11, -12*e - 2, -8*e - 5, -12*e + 3, 8*e + 20, -4*e + 24, -14*e - 22, 14*e + 2, 2*e + 8, -2*e - 13, -13, 10*e - 6, 4*e - 7, -14*e + 4, -8*e - 14, 22*e + 17, 6*e + 14, 24*e + 15, -26*e - 13, 26*e + 20, 2*e + 2, -4*e - 14, -30, -16*e - 14, -2*e - 28, 24*e + 14, -2*e - 15, 24*e + 16, 4*e + 11, -10*e + 14, 8*e - 4, 4*e - 9, -4*e - 12, 12*e + 2, -14, -4*e + 16, 14*e + 22, 14*e, 20*e + 2, -14*e - 2, -12*e - 4, 22*e + 2, -10*e - 6, -6*e - 19, -12*e + 1, -16*e - 23, -16*e - 20, -26*e - 22, -6*e + 10, 20*e + 10, -6*e - 6, -8*e + 21, 4*e + 13, -22*e - 2, 2*e - 27, 14*e + 19, 20*e + 2, 18*e + 2, -22*e - 3, 18*e + 14, -6*e + 20, -30*e - 13, 16*e + 19, -18*e - 9, 14*e + 18, 4*e + 28, -16*e + 6, 16*e + 12, 4*e - 12, 14*e - 5, 4*e + 12, 10*e - 7, 30*e + 10, 22*e + 2, -16*e - 35, 12*e - 12, -36*e - 14, 4*e + 2, -10*e - 27, 2, -40*e - 22, -2*e - 34, 20*e - 8, 38*e + 13, -6*e - 6, -4*e - 16, 2*e - 17, -28*e - 26, -18*e + 10, 2*e - 3, 20*e - 14, -4*e + 9, -4*e - 24, 18*e + 44, -12*e - 38, -8*e - 6, 6*e - 3, -11, 14*e - 20, 28*e + 15, -36*e - 17, 26*e + 3, 8*e - 18, 28*e + 8, -28*e - 37, 4*e + 12, 14*e + 42, -26*e - 20, -12*e - 40, -16*e + 9, -6*e + 9, -4*e + 10, 6*e + 25, 2*e + 10, -6*e - 2, -6*e - 34, -18*e - 44, 14*e + 17, 6*e + 23, -10*e - 13, 32*e + 8, -16*e - 38, -4*e - 40]; 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;