/* 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^3 + 2*x^2 - 6*x - 11; K := NumberField(heckePol); heckeEigenvaluesArray := [e, e^2 - e - 8, e^2 - 7, 1, -2*e^2 - e + 9, e^2 + e - 6, 2*e^2 - e - 11, -e^2 + e + 6, -2*e^2 - e + 5, -3*e^2 - e + 12, 2*e^2 - 4, 2*e^2 - 12, -4*e^2 + 20, 3*e^2 + 5*e - 14, 6, -2*e^2 - 3*e + 5, 3*e + 1, e^2 + 2*e + 3, -e^2 + 3*e + 4, -4*e^2 + 2*e + 26, -e^2 - 4*e + 7, 3*e^2 - 15, -3*e^2 - 4*e + 15, -2*e^2 - e + 9, 2*e^2 - 22, 3*e^2 - 4*e - 27, -e^2 - 5*e + 4, e^2 - 2*e + 5, 3*e^2 + 4*e - 23, -7*e^2 + e + 38, -5*e^2 + 4*e + 39, 3*e^2 - 3*e - 6, 5*e^2 - 5*e - 38, 3*e^2 + e - 28, -3*e^2 - 3*e + 2, e^2 + e - 10, -3*e^2 - 3, 7*e^2 + e - 42, -e^2 + 3*e - 2, e^2 - 5*e - 6, e^2 - 5*e - 6, -2*e^2 - 8, -e^2 + 2*e - 3, -4*e^2 - 6*e + 20, -5*e^2 - 3*e + 26, 2*e^2 - 36, 5*e^2 + 3*e - 20, 7*e^2 - 6*e - 57, 2*e^2 - 2*e - 8, 4*e + 10, 13*e^2 - 63, 7*e^2 - 5*e - 42, -13*e^2 - 3*e + 64, -3*e^2 + 7*e + 16, -5*e^2 - e + 22, e^2 + 5*e - 8, 8*e^2 - 4*e - 60, -4*e^2 - 6*e + 16, 2*e^2 - 10*e - 18, -4*e^2 - 7*e + 31, -4*e^2 + 4*e + 6, -e^2 - 2*e + 9, -7*e^2 + 10*e + 47, -7*e^2 + 2*e + 33, -e^2 + 2*e - 3, -6*e^2 - 3*e + 15, 4*e^2 - 5*e - 23, 6*e^2 + 11*e - 31, 5*e^2 - 4*e - 19, e^2 - 6*e - 23, 7*e^2 + 2*e - 47, -10*e^2 + 11*e + 65, 7*e^2 - e - 52, 3*e^2 - 5*e - 2, -e^2 - 7*e - 2, -6*e^2 + 6*e + 34, -4*e^2, -9*e^2 + 47, e^2 + 10*e + 9, 11*e^2 + 7*e - 56, 7*e^2 + e - 48, -e^2 - 6*e + 23, -2*e^2 + e + 25, 11*e^2 + 4*e - 53, -7*e^2 + 5*e + 30, e^2 + 3, -14*e^2 + 6*e + 86, 7*e^2 + 8*e - 41, -15*e^2 + 3*e + 84, 5*e^2 + 10*e - 27, -6*e^2 + 5*e + 19, 2*e - 20, 2*e^2 - 6*e + 6, 3*e^2 - 6*e - 29, 7*e^2 - 27, e^2 - 7*e - 12, -12*e^2 + 6*e + 74, 3*e^2 + e + 18, 9*e^2 - 8*e - 49, 12*e^2 + 7*e - 43, -3*e^2 + 4*e + 5, 3*e^2 - 7*e - 32, -8*e^2 + 12*e + 60, -5*e^2 - 14*e + 31, -3*e^2 + 17*e + 22, 4*e^2 - 34, 10*e^2 + 8*e - 30, -10*e^2 - 7*e + 59, -9*e^2 + 2*e + 45, -e^2 + 9*e + 6, -2*e^2 + 10*e + 32, -e^2 + 9*e + 6, -6*e^2 + 6*e + 68, -4*e^2 + 4*e + 36, -10*e^2 - 4*e + 52, 3*e^2 - e - 22, 11*e^2 - 10*e - 59, -7*e^2 - 2*e + 5, -e^2 + 11*e + 10, -3*e^2 + 5*e + 20, -5*e^2 - 4*e + 21, e^2 - 5*e - 42, 3*e^2 - 7*e - 18, 3*e^2 + 10*e - 19, -2*e^2 + 6*e + 26, 7*e^2 - 12*e - 51, e^2 + 16*e - 5, 7*e + 15, 8*e^2 - 15*e - 59, 20*e^2 + 6*e - 88, 12*e^2 - 10*e - 94, 20*e^2 + 4*e - 92, -6*e^2 + 6*e + 68, 14*e^2 + 3*e - 61, -16*e^2 - 6*e + 64, 7*e^2 - 5*e - 54, 4*e^2 - 11*e - 41, e^2 + 3*e - 24, 12*e^2 + 8*e - 70, 9*e^2 - 3*e - 46, 7*e^2 - 2*e - 45, -5*e^2 + 4*e + 35, 11*e^2 + 3*e - 50, 17*e^2 + 7*e - 80, -6*e^2 - 4*e + 16, 12*e^2 - e - 87, 3*e^2 - 11*e - 44, 6*e^2 - 5*e - 63, 8*e^2 - 5*e - 33, -18*e^2 - 9*e + 79, -9*e^2 - 4*e + 3, -9*e^2 - 11*e + 50, 5*e^2 + 15*e - 32, -9*e^2 + 11*e + 42, 5*e - 9, 15*e^2 - 2*e - 71, -4*e^2 + 10*e + 16, 13*e^2 - 11*e - 74, 13*e^2 + 9*e - 40, 4*e^2 - 6*e - 30, -11*e^2 - e + 72, 12*e^2 + 11*e - 47, 2*e^2 + 13*e - 31, 3*e^2 + e - 4, 8*e^2 - 5*e - 25, -11*e + 7, -12*e^2 + 13*e + 83, -6*e^2 - 8*e + 38, 21*e^2 - 7*e - 124, e^2 + 7*e + 10]; 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;