/* 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, 4, 5, -4, -2, 1]; F := NumberField(g); ZF := Integers(F); NN := ideal; primesArray := [ [3, 3, w - 1], [5, 5, w^2 - w - 2], [7, 7, w^4 - 2*w^3 - 3*w^2 + 4*w + 2], [13, 13, w^3 - 2*w^2 - 2*w + 2], [29, 29, -w^4 + 3*w^3 + 2*w^2 - 7*w - 1], [29, 29, -w^2 + 2*w + 3], [31, 31, w^4 - 2*w^3 - 3*w^2 + 5*w], [31, 31, w^3 - 2*w^2 - 3*w + 2], [32, 2, 2], [43, 43, -w^2 - w + 4], [53, 53, -w^4 + w^3 + 6*w^2 - 2*w - 5], [53, 53, -w^4 + 2*w^3 + 4*w^2 - 5*w - 2], [73, 73, w^4 - w^3 - 6*w^2 + 2*w + 6], [73, 73, w^3 - w^2 - 4*w + 2], [81, 3, 2*w^4 - 5*w^3 - 4*w^2 + 9*w + 2], [83, 83, w^3 - w^2 - 5*w], [89, 89, -w^4 + 2*w^3 + 4*w^2 - 4*w - 2], [97, 97, w^4 - 3*w^3 - 2*w^2 + 6*w + 2], [101, 101, -w^4 + 3*w^3 + 3*w^2 - 7*w - 3], [103, 103, -w^4 + w^3 + 6*w^2 - w - 7], [103, 103, 2*w^4 - 4*w^3 - 6*w^2 + 8*w + 1], [103, 103, w^4 - w^3 - 6*w^2 + 3*w + 4], [107, 107, -w^4 + 2*w^3 + 3*w^2 - 5*w + 2], [109, 109, w^3 - 4*w - 1], [109, 109, -w^2 + 2*w + 4], [131, 131, w^4 - w^3 - 6*w^2 + w + 6], [137, 137, w^3 - w^2 - 5*w + 3], [149, 149, w^4 - 3*w^3 - 3*w^2 + 9*w + 6], [149, 149, -w^4 + 6*w^2 + 3*w], [163, 163, 2*w^2 - w - 5], [167, 167, -2*w^4 + 3*w^3 + 8*w^2 - 4*w - 3], [169, 13, w^4 - 3*w^3 + 6*w - 3], [169, 13, w^3 - 4*w - 4], [173, 173, w^4 - w^3 - 4*w^2 + 2*w + 1], [173, 173, -w^4 + 3*w^3 + 3*w^2 - 7*w - 5], [173, 173, w^4 - w^3 - 4*w^2 + w - 1], [179, 179, w^2 - 3*w - 2], [191, 191, -w^4 + 3*w^3 + w^2 - 6*w - 1], [193, 193, -w^3 + 2*w^2 + w - 4], [193, 193, -w^4 + 3*w^3 + 3*w^2 - 8*w - 1], [199, 199, w^4 - 3*w^3 - w^2 + 7*w], [199, 199, -2*w^4 + 5*w^3 + 5*w^2 - 10*w - 2], [199, 199, w^4 - 3*w^3 + 5*w - 4], [211, 211, 2*w^3 - 2*w^2 - 7*w - 1], [211, 211, -2*w^3 + 3*w^2 + 5*w - 2], [223, 223, -2*w^4 + 3*w^3 + 10*w^2 - 7*w - 9], [227, 227, w^3 - w^2 - 4*w + 3], [229, 229, w^4 - 4*w^3 + 10*w - 5], [229, 229, -2*w^4 + 4*w^3 + 7*w^2 - 9*w - 8], [239, 239, -2*w^4 + 3*w^3 + 7*w^2 - 3*w - 3], [241, 241, w^3 - w^2 - 2*w - 2], [257, 257, -w^4 + w^3 + 6*w^2 - 4*w - 4], [263, 263, 2*w^3 - 4*w^2 - 5*w + 6], [269, 269, w^3 - 2*w^2 - 4*w + 4], [269, 269, -2*w^4 + 2*w^3 + 11*w^2 - 3*w - 10], [271, 271, w^3 - 5*w], [281, 281, w^4 - w^3 - 5*w^2 + 3*w + 3], [281, 281, -2*w^4 + 4*w^3 + 6*w^2 - 6*w - 3], [281, 281, w^3 - 5*w - 1], [283, 283, -2*w^4 + 4*w^3 + 7*w^2 - 8*w - 3], [289, 17, -2*w^4 + 3*w^3 + 8*w^2 - 5*w - 2], [293, 293, 2*w^4 - 5*w^3 - 7*w^2 + 14*w + 9], [311, 311, -w^4 + 2*w^3 + 2*w^2 - 4*w + 3], [313, 313, w^3 - 6*w], [331, 331, w^4 - 2*w^3 - 2*w^2 + w - 2], [359, 359, w^4 - w^3 - 5*w^2 + 2*w - 1], [373, 373, -w^4 + 3*w^3 + 2*w^2 - 8*w - 3], [373, 373, 2*w^3 - 4*w^2 - 3*w + 3], [379, 379, -w^4 + 4*w^3 - w^2 - 9*w + 3], [379, 379, -w^4 + 3*w^3 + w^2 - 6*w - 2], [379, 379, w^4 + w^3 - 7*w^2 - 6*w + 3], [383, 383, -w^4 + 2*w^3 + 3*w^2 - 6*w - 2], [383, 383, w^4 - 5*w^2 - 3*w + 3], [383, 383, 2*w^4 - 5*w^3 - 3*w^2 + 8*w], [389, 389, 3*w^4 - 7*w^3 - 8*w^2 + 16*w + 1], [397, 397, -2*w^4 + 3*w^3 + 8*w^2 - 3*w - 7], [397, 397, -w^4 + 2*w^3 + 3*w^2 - 4*w - 5], [397, 397, -2*w^4 + 3*w^3 + 7*w^2 - 4*w - 3], [409, 409, -w^4 + w^3 + 7*w^2 - 5*w - 9], [419, 419, w^4 - 2*w^3 - w^2 + 2*w - 2], [419, 419, 2*w^4 - 3*w^3 - 7*w^2 + 5*w + 2], [419, 419, -w^4 + 4*w^3 - 9*w - 2], [433, 433, -w^4 + 3*w^3 - 8*w + 4], [433, 433, w^4 - 7*w^2 - w + 6], [439, 439, 3*w^4 - 6*w^3 - 10*w^2 + 11*w + 7], [449, 449, -2*w^4 + 5*w^3 + 5*w^2 - 11*w - 4], [457, 457, -2*w^4 + 5*w^3 + 4*w^2 - 10*w - 2], [463, 463, 2*w^4 - 5*w^3 - 4*w^2 + 8*w + 1], [467, 467, 2*w^4 - 4*w^3 - 6*w^2 + 6*w + 1], [479, 479, 3*w^4 - 4*w^3 - 12*w^2 + 4*w + 7], [479, 479, 2*w^4 - 6*w^3 - 4*w^2 + 14*w + 1], [491, 491, w^4 - 6*w^2 - w + 4], [503, 503, 2*w^4 - w^3 - 11*w^2 - 3*w + 8], [503, 503, 2*w^3 - 5*w^2 - 2*w + 6], [509, 509, w^4 - 5*w^2 - 6*w], [509, 509, w^4 - 3*w^3 - 3*w^2 + 9*w + 1], [523, 523, 3*w^4 - 7*w^3 - 7*w^2 + 12*w + 3], [523, 523, 3*w^4 - 8*w^3 - 7*w^2 + 17*w + 3], [523, 523, w^4 - 7*w^2 - 2*w + 4], [529, 23, -w^4 + w^3 + 7*w^2 - 2*w - 9], [541, 541, w^4 - 3*w^3 - 3*w^2 + 5*w + 2], [547, 547, -w^3 + 3*w^2 + 3*w - 4], [557, 557, 2*w^3 - 4*w^2 - 6*w + 9], [577, 577, 2*w^4 - 2*w^3 - 11*w^2 + 5*w + 10], [577, 577, w^4 - 4*w^3 - w^2 + 9*w], [577, 577, 2*w^4 - 3*w^3 - 9*w^2 + 4*w + 8], [577, 577, w^4 - 7*w^2 - 3*w + 7], [577, 577, -3*w^4 + 3*w^3 + 13*w^2 - w - 4], [593, 593, 3*w - 2], [601, 601, 2*w^4 - 4*w^3 - 7*w^2 + 5*w + 6], [601, 601, -w^4 + 3*w^3 + w^2 - 7*w - 1], [607, 607, w^3 - w^2 - 2*w - 3], [625, 5, 2*w^4 - 5*w^3 - 8*w^2 + 14*w + 11], [631, 631, -w^2 + w - 2], [631, 631, w^4 - 7*w^2 - w + 8], [643, 643, -2*w^4 + 4*w^3 + 9*w^2 - 10*w - 8], [647, 647, 3*w^4 - 6*w^3 - 10*w^2 + 12*w + 8], [653, 653, -3*w^4 + 6*w^3 + 11*w^2 - 12*w - 9], [653, 653, w^4 - w^3 - 2*w^2 - 3*w - 3], [653, 653, -2*w^4 + 4*w^3 + 7*w^2 - 6*w - 8], [701, 701, w^4 - w^3 - 2*w^2 - w - 5], [719, 719, 2*w^4 - 5*w^3 - 6*w^2 + 14*w + 2], [727, 727, 2*w^4 - 5*w^3 - 5*w^2 + 9*w + 3], [733, 733, 2*w^4 - 5*w^3 - 5*w^2 + 13*w + 3], [739, 739, -2*w^3 + 4*w^2 + 4*w - 5], [743, 743, w^4 - 2*w^3 - 3*w^2 + 6*w - 3], [743, 743, 2*w^4 - 2*w^3 - 11*w^2 + 2*w + 10], [757, 757, -w^4 + 2*w^3 + 5*w^2 - 6*w - 10], [757, 757, 2*w^4 - 6*w^3 - 2*w^2 + 11*w - 4], [761, 761, 3*w^3 - 4*w^2 - 9*w + 3], [769, 769, 3*w^3 - 5*w^2 - 9*w + 7], [769, 769, -2*w^4 + 4*w^3 + 7*w^2 - 11*w - 2], [773, 773, 2*w^4 - 5*w^3 - 6*w^2 + 12*w + 1], [773, 773, 3*w^4 - 4*w^3 - 12*w^2 + 3*w + 5], [773, 773, 2*w^3 - w^2 - 10*w - 4], [797, 797, -w^4 + 4*w^3 + 2*w^2 - 12*w - 3], [811, 811, w^4 - 2*w^3 - 6*w^2 + 8*w + 4], [823, 823, w^4 - 4*w^3 - w^2 + 10*w + 1], [823, 823, 2*w^4 - 4*w^3 - 4*w^2 + 4*w - 3], [827, 827, -w^4 + 2*w^3 + 2*w^2 - w + 3], [827, 827, 2*w^4 - 4*w^3 - 5*w^2 + 7*w + 2], [829, 829, -w^4 + 4*w^3 + 2*w^2 - 10*w - 2], [829, 829, 3*w^3 - 3*w^2 - 11*w - 2], [829, 829, w^4 - 2*w^3 - 3*w^2 + 2*w - 3], [839, 839, -w^4 + 5*w^3 - 3*w^2 - 10*w + 5], [839, 839, -w^4 + w^3 + 5*w^2 - 9], [853, 853, 2*w^4 - 6*w^3 - 5*w^2 + 15*w + 4], [859, 859, -3*w^4 + 8*w^3 + 6*w^2 - 18*w + 5], [863, 863, w^4 - w^3 - 6*w^2 + 5*w + 2], [877, 877, 3*w^3 - 4*w^2 - 8*w + 1], [881, 881, 3*w^4 - 7*w^3 - 9*w^2 + 15*w + 3], [881, 881, -w^3 + 7*w + 1], [883, 883, -2*w^4 + 6*w^3 + 3*w^2 - 15*w], [887, 887, w^4 - w^3 - 5*w^2 + w - 1], [907, 907, 3*w^4 - 5*w^3 - 11*w^2 + 9*w + 5], [919, 919, w^4 - 2*w^3 - 6*w^2 + 8*w + 7], [937, 937, 2*w^4 - 2*w^3 - 9*w^2 + 2*w + 3], [937, 937, -3*w^4 + 8*w^3 + 6*w^2 - 16*w + 1], [937, 937, 3*w^4 - 5*w^3 - 11*w^2 + 7*w + 4], [947, 947, w^3 - w^2 - 7*w + 2], [947, 947, -w^4 + 2*w^3 + 4*w^2 - 7*w - 3], [967, 967, -w^4 + 4*w^3 - 11*w], [971, 971, 3*w^4 - 6*w^3 - 8*w^2 + 10*w], [971, 971, w^4 - 8*w^2 + 2*w + 9], [971, 971, w^4 - 4*w^3 + 2*w^2 + 7*w - 4], [977, 977, -w^4 + 4*w^3 - 12*w + 5], [983, 983, -w^4 + w^3 + 4*w^2 + 3*w - 2], [983, 983, -2*w^4 + 3*w^3 + 8*w^2 - 6*w - 4], [997, 997, 2*w^4 - 4*w^3 - 5*w^2 + 5*w - 3], [997, 997, w^4 + w^3 - 5*w^2 - 9*w - 2]]; primes := [ideal : I in primesArray]; heckePol := x^3 - 3*x^2 - 9*x + 1; K := NumberField(heckePol); heckeEigenvaluesArray := [-1, -1, -1, e, -e^2 + 2*e + 5, e^2 - 4*e - 5, -e - 2, e^2 - e - 9, e^2 - 5*e - 5, e^2 - 2*e - 8, -2*e^2 + 6*e + 9, e^2 - 13, -2*e^2 + 6*e + 4, -2*e^2 + 4*e + 14, e^2 - 6*e - 3, -e^2 + 2*e + 9, -e^2 + 4*e + 9, 2*e - 10, -e^2 + 6*e + 1, -2*e^2 + 4*e + 10, -2*e^2 + 9*e + 8, e^2 - 2*e - 5, -e^2 + e + 7, 2*e^2 - 10*e - 11, e^2 - 3*e + 9, -2*e^2 + 10*e + 17, e^2 - 6*e - 8, 2*e^2 - 6*e - 10, -2*e^2 + 10*e + 8, e^2 - 10*e, 3*e^2 - 6*e - 22, -2*e^2 + e + 24, -2*e^2 + 10*e + 12, e^2 - 3*e - 1, e^2 - 2*e + 3, -2*e^2 + 4*e + 17, -e^2 + 2*e + 9, 2*e^2 - 10*e - 4, -e^2 + 4*e + 13, 3*e^2 - 11*e - 13, e^2 - 2*e - 19, -5*e^2 + 14*e + 21, 3*e^2 - 13*e - 19, -3*e^2 + 14*e + 21, -2*e^2 + 6*e + 4, e^2 + 4*e - 19, e^2 - 6*e + 11, -e^2 + 4*e + 17, -e^2 + 4*e + 5, e^2 - 6*e - 13, -2*e + 9, e^2 - 2*e - 18, -3*e^2 + 14*e + 15, e^2 - 4*e - 17, 2*e^2 - 12*e - 19, -3*e^2 + 13*e + 23, e^2 - 4*e - 1, 4*e^2 - 16*e - 26, e^2 - 7*e - 21, e^2 - 10*e + 3, -4, -2*e^2 + 5*e + 24, 2*e^2 - 6*e - 15, 2*e - 24, -4*e^2 + 14*e + 16, 4*e^2 - 10*e - 20, e^2 - 2*e + 11, -5*e^2 + 13*e + 25, 4*e^2 - 14*e - 22, -e^2 + 2*e + 27, 4*e^2 - 15*e - 36, 2*e - 7, 5*e^2 - 18*e - 27, -2*e^2 + 12*e + 26, -3*e^2 + 11*e + 13, -4*e^2 + 10*e + 16, -5*e^2 + 16*e + 11, e^2 - e - 7, 4*e - 24, 5*e^2 - 24*e - 33, -2*e^2 + 11*e - 4, -e^2 - 4*e + 24, 6*e - 16, 3*e^2 - 18*e - 21, e^2 + 2*e - 34, -e^2 + 6*e - 9, e^2 - 2*e - 21, -e, -3*e^2 + 10*e + 2, 5*e^2 - 16*e - 15, e^2 + 4*e - 33, -e^2 + 4*e + 17, -e^2 + 5*e + 5, -3*e^2 + 10*e + 43, -2*e^2 + 8*e + 18, -2*e^2 + 16*e, 2*e^2 - 11*e - 8, e^2 - 2*e + 10, e^2 - 38, -e^2 + 8*e - 3, 3*e^2 - 14*e - 13, -5*e + 2, 5*e^2 - 10*e - 45, -3*e^2 + 18*e + 25, -2*e^2 + 10*e + 29, 3*e^2 - 12*e - 19, -e^2 - 4*e + 17, 2*e^2 - 5*e - 14, -e^2 - 4*e + 11, e^2 - 2*e - 29, 2*e^2 - 14*e - 8, -4*e^2 + 6*e + 40, 2*e^2 - 4*e - 40, e^2 + 4*e - 39, e^2 - 6, 2*e^2 - 4*e - 24, 2*e^2 + 4*e - 36, -3*e^2 + 6*e - 2, -e^2 + 2*e + 13, e^2 - 5*e - 19, -3*e^2 + 6*e + 27, 2*e^2 - 14*e - 8, -8*e^2 + 28*e + 32, -4*e, -7*e^2 + 32*e + 35, 6*e^2 - 22*e - 20, 5*e^2 - 26*e - 37, -5*e^2 + 23*e + 13, 10*e^2 - 33*e - 50, -5*e^2 + 17*e + 5, 2*e^2 - 9*e + 8, 2*e^2 - 2*e - 20, 6*e + 1, 2*e^2 - 4*e - 24, 7*e^2 - 32*e - 48, -e^2 - 4*e + 15, -4*e^2 + 26*e + 17, 8*e^2 - 25*e - 54, 2*e^2 - 6*e + 9, 5*e^2 - 17*e - 15, 2*e^2 - 12, e^2 - 6*e - 25, 3*e^2 - 8*e - 18, -6*e - 19, 7*e^2 - 21*e - 31, -3*e^2 + 12*e + 39, 3*e^2 - 2*e - 52, -4*e^2 + 4*e + 30, -e^2 - 6*e + 21, 5*e^2 - 12*e - 25, -e^2 + 4*e - 27, 8*e, -6*e^2 + 19*e + 22, -4*e^2 + 2*e + 38, 9*e^2 - 24*e - 55, -5*e^2 + 24*e + 49, -3*e^2 + 8*e + 11, -e^2 - 8*e + 18, 2*e^2 - 11*e + 6, -4*e^2 + 12*e - 2, -e^2 - 2*e + 33, -8*e - 21, -3*e^2 + 8*e + 19, 3*e^2 - 12*e - 43, -8*e - 5, -3*e^2 + 12*e - 5, -2*e^2 + e + 26, -6*e^2 + 10*e + 40, -e^2 - 8*e + 5, 2*e^2 - 6*e - 28]; 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;