/* 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![1, 5, 2, -5, -1, 1]; F := NumberField(g); ZF := Integers(F); NN := ideal; primesArray := [ [3, 3, -w^4 + w^3 + 4*w^2 - 2*w - 2], [5, 5, w^2 - w - 2], [19, 19, w^4 - 2*w^3 - 4*w^2 + 5*w + 4], [23, 23, -w^3 + w^2 + 3*w - 1], [29, 29, 2*w^4 - 3*w^3 - 8*w^2 + 7*w + 4], [32, 2, 2], [37, 37, w^3 - 2*w^2 - 2*w + 2], [41, 41, -2*w^4 + 3*w^3 + 9*w^2 - 8*w - 6], [43, 43, -2*w^4 + 3*w^3 + 8*w^2 - 8*w - 6], [47, 47, w^4 - 2*w^3 - 5*w^2 + 6*w + 5], [53, 53, -w^4 + w^3 + 4*w^2 - w - 4], [61, 61, w^2 - 2*w - 3], [67, 67, w^4 - w^3 - 4*w^2 + 3*w], [67, 67, -w^4 + w^3 + 5*w^2 - 2*w - 2], [71, 71, w^4 - w^3 - 4*w^2 + 5], [71, 71, w^4 - 2*w^3 - 3*w^2 + 5*w + 3], [71, 71, 2*w^4 - 2*w^3 - 8*w^2 + 5*w + 4], [73, 73, -2*w^4 + 2*w^3 + 9*w^2 - 5*w - 6], [81, 3, -2*w^4 + 3*w^3 + 10*w^2 - 9*w - 10], [97, 97, -2*w^4 + 3*w^3 + 7*w^2 - 5*w - 4], [101, 101, -w^4 + 2*w^3 + 2*w^2 - 4*w + 2], [103, 103, -w^4 + w^3 + 3*w^2 - 2], [103, 103, -2*w^4 + 2*w^3 + 10*w^2 - 5*w - 7], [107, 107, 3*w^4 - 4*w^3 - 12*w^2 + 10*w + 5], [107, 107, -w^4 + 6*w^2 + w - 4], [107, 107, w^4 - 2*w^3 - 5*w^2 + 8*w + 3], [109, 109, 3*w^4 - 3*w^3 - 13*w^2 + 6*w + 8], [127, 127, -w^4 + 6*w^2 + 2*w - 5], [131, 131, -2*w^4 + 3*w^3 + 7*w^2 - 7*w - 5], [137, 137, w^4 - w^3 - 3*w^2 - 2], [137, 137, 3*w^4 - 5*w^3 - 12*w^2 + 12*w + 9], [151, 151, 2*w^4 - 2*w^3 - 8*w^2 + 3*w + 6], [151, 151, 2*w^4 - 4*w^3 - 8*w^2 + 11*w + 6], [157, 157, -w^4 + 2*w^3 + 2*w^2 - 5*w], [167, 167, -w^4 + 6*w^2 - w - 5], [167, 167, w^4 - w^3 - 6*w^2 + 3*w + 4], [167, 167, w^4 - 5*w^2 - 3*w + 3], [169, 13, -w^3 + 4*w - 1], [173, 173, w^4 - 2*w^3 - 5*w^2 + 7*w + 4], [181, 181, 2*w^4 - 4*w^3 - 5*w^2 + 6*w + 6], [181, 181, w^3 - 2*w^2 - 3*w + 3], [193, 193, -w^4 + w^3 + 4*w^2 - 3*w + 1], [197, 197, 2*w^4 - 3*w^3 - 9*w^2 + 7*w + 5], [211, 211, 2*w^4 - 3*w^3 - 8*w^2 + 6*w + 5], [229, 229, 2*w^2 - 2*w - 5], [239, 239, w^2 - 2*w - 4], [257, 257, -w^3 + 4*w - 2], [257, 257, w^4 - 2*w^3 - 6*w^2 + 7*w + 7], [263, 263, -2*w^4 + 4*w^3 + 7*w^2 - 10*w - 7], [271, 271, -w^4 + 2*w^3 + 5*w^2 - 8*w - 6], [271, 271, 2*w^4 - 2*w^3 - 9*w^2 + 4*w + 3], [271, 271, -w^3 + 2*w^2 + 3*w - 2], [277, 277, -w^4 + 3*w^3 + 3*w^2 - 7*w - 3], [277, 277, 2*w^4 - 2*w^3 - 7*w^2 + 3*w + 2], [277, 277, -2*w^4 + 4*w^3 + 7*w^2 - 12*w - 5], [281, 281, -w^4 + 3*w^3 + 4*w^2 - 9*w - 5], [281, 281, -3*w^4 + 4*w^3 + 12*w^2 - 8*w - 7], [281, 281, -2*w^4 + 3*w^3 + 8*w^2 - 6*w - 4], [289, 17, 3*w^4 - 5*w^3 - 13*w^2 + 14*w + 9], [331, 331, -w^4 + 2*w^3 + 2*w^2 - 3*w + 2], [337, 337, 2*w^4 - w^3 - 9*w^2 + w + 2], [337, 337, -w^4 + 2*w^3 + 3*w^2 - 4*w + 2], [337, 337, -3*w^4 + 3*w^3 + 13*w^2 - 7*w - 8], [347, 347, -w^4 + 2*w^3 + w^2 - 2*w + 2], [347, 347, 3*w^4 - 4*w^3 - 11*w^2 + 9*w + 4], [349, 349, 3*w^4 - 5*w^3 - 12*w^2 + 12*w + 7], [353, 353, w^4 - w^3 - 5*w^2 + 3*w], [353, 353, 2*w^2 - w - 5], [359, 359, 2*w^4 - 2*w^3 - 9*w^2 + 6*w + 5], [373, 373, w^3 - 2*w - 3], [373, 373, -3*w^4 + 5*w^3 + 11*w^2 - 12*w - 8], [379, 379, -3*w^4 + 5*w^3 + 13*w^2 - 14*w - 14], [383, 383, w^4 - 7*w^2 + 2*w + 2], [389, 389, w^4 - 3*w^2 - 5*w], [389, 389, w^4 - w^3 - 3*w^2 + 2*w - 3], [389, 389, 2*w^3 - 2*w^2 - 6*w + 1], [397, 397, -w^3 + 4*w^2 + w - 6], [419, 419, 2*w^4 - 3*w^3 - 10*w^2 + 10*w + 8], [439, 439, -2*w^4 + 3*w^3 + 9*w^2 - 8*w - 4], [439, 439, 2*w^4 - 3*w^3 - 7*w^2 + 8*w + 5], [443, 443, w^4 + w^3 - 7*w^2 - 4*w + 4], [449, 449, -2*w^4 + 2*w^3 + 7*w^2 - 3*w - 3], [457, 457, 4*w^4 - 6*w^3 - 15*w^2 + 13*w + 9], [461, 461, 3*w^4 - 5*w^3 - 11*w^2 + 11*w + 6], [463, 463, -w^4 + 4*w^2 + 3*w - 2], [467, 467, 3*w^4 - 5*w^3 - 11*w^2 + 13*w + 7], [467, 467, 2*w^4 - 2*w^3 - 9*w^2 + 6*w + 4], [479, 479, -3*w^4 + 3*w^3 + 12*w^2 - 4*w - 7], [487, 487, w^4 - w^3 - 7*w^2 + 3*w + 11], [503, 503, 2*w^4 - 4*w^3 - 7*w^2 + 13*w + 1], [509, 509, w^4 - 3*w^3 - 4*w^2 + 8*w + 5], [521, 521, -w^4 + 2*w^3 + 2*w^2 - 7*w + 2], [523, 523, 2*w^4 - 3*w^3 - 6*w^2 + 6*w], [523, 523, -3*w^4 + 4*w^3 + 15*w^2 - 12*w - 11], [523, 523, -w^4 + 2*w^3 + 4*w^2 - 8*w - 4], [547, 547, w^3 - 3*w^2 - w + 7], [557, 557, -w^4 + 4*w^3 + 4*w^2 - 14*w - 6], [557, 557, w^4 - 2*w^3 - 6*w^2 + 8*w + 7], [563, 563, -w^4 + w^3 + 6*w^2 - 4*w - 10], [563, 563, w^4 - w^3 - 4*w^2 + 4*w - 1], [569, 569, -3*w^4 + 6*w^3 + 10*w^2 - 14*w - 6], [569, 569, -w^4 + w^3 + 5*w^2 - 4], [571, 571, 5*w^4 - 8*w^3 - 19*w^2 + 20*w + 12], [571, 571, -3*w^4 + 6*w^3 + 12*w^2 - 19*w - 7], [587, 587, -2*w^4 + 2*w^3 + 7*w^2 - 5*w], [599, 599, -2*w^4 + 3*w^3 + 9*w^2 - 10*w - 7], [601, 601, -2*w^4 + 3*w^3 + 8*w^2 - 5*w - 5], [607, 607, w^4 - 3*w^3 - 3*w^2 + 6*w], [607, 607, -3*w^4 + 5*w^3 + 14*w^2 - 13*w - 10], [619, 619, w^4 - w^3 - 2*w^2 - 2], [619, 619, 3*w^4 - 3*w^3 - 13*w^2 + 4*w + 7], [619, 619, -w^4 + 4*w^3 + 3*w^2 - 13*w - 6], [625, 5, -w^4 + 4*w^3 + 3*w^2 - 11*w - 2], [641, 641, -3*w^4 + 5*w^3 + 14*w^2 - 16*w - 14], [643, 643, -5*w^4 + 7*w^3 + 19*w^2 - 18*w - 7], [659, 659, -3*w^4 + 6*w^3 + 12*w^2 - 19*w - 9], [661, 661, 2*w^3 - 2*w^2 - 5*w + 1], [673, 673, w^4 - 2*w^3 - 3*w^2 + 3*w - 1], [677, 677, w^4 - 4*w^2 - 2*w + 3], [677, 677, -2*w^4 + 3*w^3 + 11*w^2 - 9*w - 14], [677, 677, -2*w^4 + 5*w^3 + 8*w^2 - 17*w - 7], [691, 691, 3*w^4 - 4*w^3 - 14*w^2 + 13*w + 6], [709, 709, w^4 - 2*w^3 - 5*w^2 + 5*w + 8], [719, 719, w^4 - w^3 - 3*w^2 + 2*w - 4], [727, 727, -3*w^4 + 4*w^3 + 11*w^2 - 8*w - 5], [733, 733, w^4 + w^3 - 7*w^2 - 5*w + 6], [733, 733, -4*w^4 + 6*w^3 + 15*w^2 - 14*w - 8], [739, 739, 3*w^4 - 3*w^3 - 13*w^2 + 7*w + 7], [739, 739, -3*w^4 + 4*w^3 + 11*w^2 - 11*w - 2], [757, 757, w^2 - 4*w + 1], [757, 757, -2*w^4 + 3*w^3 + 8*w^2 - 5*w - 3], [773, 773, -5*w^4 + 8*w^3 + 20*w^2 - 19*w - 14], [811, 811, -2*w^4 + 2*w^3 + 10*w^2 - 8*w - 7], [811, 811, 2*w^4 - 10*w^2 - 3*w + 6], [811, 811, 3*w^4 - 3*w^3 - 14*w^2 + 9*w + 10], [821, 821, w^4 - 3*w^3 + 3*w - 2], [823, 823, 2*w^4 - 4*w^3 - 9*w^2 + 13*w + 8], [827, 827, -3*w^4 + 5*w^3 + 11*w^2 - 13*w - 1], [839, 839, 3*w^4 - 5*w^3 - 13*w^2 + 13*w + 7], [841, 29, -2*w^3 + 3*w^2 + 3*w - 3], [841, 29, -4*w^4 + 6*w^3 + 14*w^2 - 13*w - 5], [853, 853, -w^4 + 4*w^2 + 5*w - 1], [857, 857, -w^4 + 4*w^3 + 2*w^2 - 11*w - 4], [863, 863, w^4 - 4*w^3 - w^2 + 11*w], [877, 877, -4*w^4 + 4*w^3 + 17*w^2 - 8*w - 7], [881, 881, -4*w^4 + 6*w^3 + 17*w^2 - 17*w - 15], [881, 881, -2*w^3 + 3*w^2 + 5*w - 4], [907, 907, -3*w^4 + 6*w^3 + 13*w^2 - 18*w - 12], [907, 907, -w^4 + 5*w^2 + 4*w - 6], [919, 919, 3*w^4 - 3*w^3 - 13*w^2 + 7*w + 5], [919, 919, w^4 - 4*w^3 - 3*w^2 + 13*w + 1], [919, 919, -4*w^4 + 7*w^3 + 17*w^2 - 20*w - 13], [929, 929, -w^3 + 5*w - 3], [941, 941, 4*w^4 - 6*w^3 - 15*w^2 + 16*w + 9], [947, 947, 3*w^4 - 6*w^3 - 9*w^2 + 16*w + 3], [953, 953, -w^4 + 2*w^3 + 6*w^2 - 8*w - 6], [953, 953, 3*w^4 - 3*w^3 - 12*w^2 + 8*w + 6], [961, 31, -2*w^4 + 4*w^3 + 9*w^2 - 14*w - 5], [967, 967, -2*w^3 + 5*w + 4], [983, 983, 2*w^3 - 7*w - 6], [997, 997, 4*w^4 - 5*w^3 - 15*w^2 + 12*w + 6], [997, 997, 4*w^4 - 5*w^3 - 16*w^2 + 13*w + 8]]; primes := [ideal : I in primesArray]; heckePol := x^3 - 6*x - 1; K := NumberField(heckePol); heckeEigenvaluesArray := [e, -e, -e^2 - 1, -2*e^2 + 8, -1, 2*e^2 - 9, -2*e^2 - e + 7, -e + 1, 2*e - 6, -e^2 - e + 1, 0, 3*e^2 - 4*e - 13, 2*e^2 + 2*e - 12, e^2 - 2*e - 12, 3*e - 3, e^2 + 3*e - 11, e^2 + 2*e - 13, -4, 3*e^2 - e - 15, -2*e^2 + 3*e + 3, e^2 - 4*e - 6, 2*e^2 - 5*e - 9, 2*e^2 - 2*e, -e^2 + 6, -5*e^2 + 3*e + 19, -e^2 - 6, 2*e^2 - 10, e^2 - 3*e + 5, -2*e^2 + 3*e + 2, -e^2 - 2*e - 11, 2*e^2 - 2*e - 8, -4*e^2 + 4*e + 20, -2*e^2 + 7*e + 15, 10, 3*e^2 - 7*e - 19, -e^2 - 4*e + 9, -3*e^2 + 2*e + 16, -2*e^2 + 8, -e^2 + 3*e + 7, 2*e^2 - 5*e - 1, -e^2 + 4*e + 16, -2*e^2 - 2*e + 10, -3*e^2 - e + 19, 4*e^2 - 8*e - 26, -7*e^2 + 6*e + 27, -e^2 + e - 7, e^2 + 3*e - 29, 3*e^2 + e + 3, 4*e^2 - 8*e - 20, 4*e^2 - 4*e - 32, -e^2 - 4*e - 3, 9*e^2 - e - 25, 5*e^2 - 3*e - 23, 2*e^2 + 5*e - 13, 5*e^2 + 2*e - 16, -3*e^2 - 3*e + 3, -3*e^2 + 9, -5*e^2 + 5*e + 25, -e^2 - 5, 4*e^2 - 5*e - 9, 4*e^2 + 9*e - 35, 3*e^2 + 2*e - 4, -5*e^2 + 6*e + 21, -3*e^2 + 9*e + 29, -2*e^2 - e + 22, 9*e^2 - 3*e - 31, e^2 - 4*e - 20, 3*e^2 + 7*e - 31, -5*e^2 + 9*e + 23, -8*e^2 + 4*e + 18, 6*e^2 + 3*e - 32, -2*e^2 + 8*e + 10, 2*e^2 - 3*e - 12, 7*e^2 + 2*e - 22, 6, 4*e^2 - 2*e - 2, -3*e^2 + 4*e + 7, e^2 - 12*e - 7, -e^2 - 11*e - 3, -3*e^2 + e - 1, e^2 + 5*e - 23, -8*e^2 - e + 21, -4*e^2 + 4*e + 30, -8*e^2 + 3*e + 26, -7*e^2 + 4*e + 20, -4*e^2 + 5*e + 19, -5*e^2 + 6*e + 31, -8*e + 10, 5*e^2 + 5*e - 17, 9*e^2 - e - 21, 3*e^2 - 11*e - 25, -14*e + 4, e, 2*e^2 - 6*e - 12, -4*e^2 - 4*e + 20, -6*e^2 + 5*e + 21, -2*e^2 - 12*e + 8, e^2 + 8*e - 11, -3*e^2 - 7*e + 19, 6*e^2 + e - 21, 4*e^2 + 12*e - 22, -5*e^2 + 8*e + 19, 6*e - 4, -4*e^2 - e + 27, 7*e^2 + e - 29, 8*e^2 + 10*e - 40, 7*e^2 - 4*e - 43, 2*e^2 - 2*e - 28, -4*e^2 - 3*e + 16, -8*e^2 + 2*e + 38, 7*e^2 + 5*e - 31, 5*e^2 - 9*e - 43, -e^2 + 6*e + 25, -5*e^2 - 8*e + 47, -5*e^2 - 14*e + 29, -3*e^2 + 19*e + 19, 2*e^2 + 2*e + 2, -6*e^2 + 4*e + 28, -e^2 - 5*e + 21, 7*e^2 + 5*e - 17, 2*e^2 - 6*e + 10, 2*e^2 + 4*e - 28, -e^2 - 13*e + 13, 4*e^2 + 6*e - 22, -12*e^2 + 5*e + 45, 6*e^2 + 8*e - 48, -2*e^2 - 12*e + 8, 7*e^2 - 8*e - 27, 6*e^2 + 8*e - 36, -4*e^2 - e + 26, -5*e^2 + 3, 2*e^2 - e - 9, -2*e^2 + 11*e + 17, -12*e^2 + 10*e + 54, -4*e^2 - 13*e + 26, -2*e^2 - 4*e - 8, 2*e^2 - 16, 6*e^2 + 15*e - 54, 8*e^2 + 3*e - 23, 5*e^2 - 27, -4*e^2 + 6*e + 8, 5*e^2 + 3*e - 5, 7*e^2 + 10*e - 54, 4*e^2 - 6*e - 22, -2*e^2 + 2*e + 12, -4*e^2 - 19*e + 26, -9*e^2 + 11*e + 31, -2*e^2 - 9*e - 3, 10*e^2 - 2*e - 52, -9*e^2 + 20*e + 56, 2*e^2 - 14*e - 6, 3*e^2 - 7*e + 19, 17*e^2 - 6*e - 61, -2*e^2 + 6*e + 8, -3*e^2 - 10*e + 29, -4*e^2 - e + 39, e^2 - 19*e - 3, -8*e^2 - 4*e + 34, -4*e^2 + 6*e, -2*e^2 - 2*e - 14, 4*e^2 + 16*e - 14, 2*e^2 + 7*e - 14]; 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;