/* 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![29, 3, -12, -1, 1]; F := NumberField(g); ZF := Integers(F); NN := ideal; primesArray := [ [4, 2, 1/2*w^3 - 2*w^2 - 2*w + 15/2], [4, 2, -w^2 + w + 8], [5, 5, -1/4*w^3 + 1/2*w^2 + 1/2*w - 9/4], [5, 5, 1/2*w^3 - w^2 - 4*w + 9/2], [19, 19, 1/4*w^3 - 3/2*w^2 - 1/2*w + 21/4], [19, 19, 1/4*w^3 - 3/2*w^2 - 1/2*w + 41/4], [29, 29, w], [29, 29, 1/4*w^3 - 1/2*w^2 - 1/2*w + 1/4], [29, 29, 1/4*w^3 - 1/2*w^2 - 5/2*w + 9/4], [29, 29, -1/2*w^3 + w^2 + 4*w - 5/2], [41, 41, 3/4*w^3 - 5/2*w^2 - 7/2*w + 47/4], [41, 41, 1/4*w^3 + 1/2*w^2 - 5/2*w - 15/4], [61, 61, -3/2*w^3 + 3*w^2 + 11*w - 21/2], [61, 61, w^3 - 2*w^2 - 4*w + 6], [79, 79, 3/4*w^3 - 5/2*w^2 - 7/2*w + 27/4], [79, 79, 1/4*w^3 + 1/2*w^2 - 5/2*w - 35/4], [81, 3, -3], [89, 89, 7/4*w^3 - 11/2*w^2 - 21/2*w + 119/4], [89, 89, 1/4*w^3 + 3/2*w^2 - 3/2*w - 23/4], [109, 109, -1/2*w^3 + 3*w^2 + 2*w - 41/2], [109, 109, -5/4*w^3 + 7/2*w^2 + 9/2*w - 45/4], [121, 11, -3/4*w^3 + 3/2*w^2 + 9/2*w - 23/4], [121, 11, -1/4*w^3 + 1/2*w^2 + 3/2*w - 21/4], [131, 131, -1/2*w^3 + w^2 + 5*w - 3/2], [131, 131, 3/4*w^3 - 1/2*w^2 - 7/2*w - 1/4], [139, 139, -5/4*w^3 + 11/2*w^2 + 9/2*w - 73/4], [139, 139, -1/4*w^3 + 7/2*w^2 - 3/2*w - 113/4], [149, 149, -1/4*w^3 + 3/2*w^2 + 1/2*w - 49/4], [149, 149, 1/4*w^3 - 3/2*w^2 - 1/2*w + 13/4], [151, 151, 1/2*w^3 - 3*w^2 - w + 23/2], [151, 151, -1/4*w^3 + 3/2*w^2 + 3/2*w - 45/4], [151, 151, 3/4*w^3 - 3/2*w^2 - 7/2*w + 11/4], [151, 151, -2*w^3 + 6*w^2 + 7*w - 20], [169, 13, -1/4*w^3 + 1/2*w^2 + 1/2*w - 25/4], [169, 13, 1/2*w^3 - w^2 - 4*w + 17/2], [179, 179, -1/4*w^3 + 1/2*w^2 + 7/2*w - 21/4], [179, 179, 1/4*w^3 - 1/2*w^2 - 7/2*w - 3/4], [181, 181, 1/2*w^3 - 3*w - 7/2], [181, 181, -5/4*w^3 + 7/2*w^2 + 15/2*w - 57/4], [191, 191, -3/4*w^3 + 5/2*w^2 + 9/2*w - 39/4], [191, 191, w^2 - 8], [199, 199, -3/4*w^3 + 7/2*w^2 + 5/2*w - 43/4], [199, 199, -1/4*w^3 + 5/2*w^2 - 1/2*w - 81/4], [199, 199, -3/4*w^3 + 7/2*w^2 + 5/2*w - 75/4], [199, 199, -1/4*w^3 + 5/2*w^2 - 1/2*w - 49/4], [229, 229, -1/2*w^3 + 2*w^2 + w - 21/2], [229, 229, -3/4*w^3 + 5/2*w^2 + 7/2*w - 55/4], [239, 239, 3/2*w^3 - 4*w^2 - 9*w + 35/2], [239, 239, 3/2*w^3 - 5*w^2 - 7*w + 45/2], [241, 241, -5/4*w^3 + 9/2*w^2 + 13/2*w - 93/4], [241, 241, -1/4*w^3 - 1/2*w^2 - 1/2*w + 3/4], [251, 251, -w^3 + 3*w^2 + 8*w - 13], [251, 251, -7/4*w^3 + 13/2*w^2 + 13/2*w - 99/4], [269, 269, -9/4*w^3 + 13/2*w^2 + 15/2*w - 85/4], [269, 269, -3/4*w^3 + 5/2*w^2 + 3/2*w - 47/4], [271, 271, 5/4*w^3 - 5/2*w^2 - 21/2*w + 53/4], [271, 271, 5/4*w^3 - 1/2*w^2 - 23/2*w - 23/4], [271, 271, 7/4*w^3 - 11/2*w^2 - 13/2*w + 83/4], [271, 271, -1/2*w^3 + w^2 - 13/2], [281, 281, 3/4*w^3 - 1/2*w^2 - 13/2*w - 1/4], [281, 281, -w^3 + 3*w^2 + 4*w - 13], [311, 311, -1/4*w^3 + 1/2*w^2 - 1/2*w - 5/4], [311, 311, 7/4*w^3 - 13/2*w^2 - 19/2*w + 155/4], [311, 311, -1/4*w^3 + 7/2*w^2 + 1/2*w - 49/4], [311, 311, -3/4*w^3 + 3/2*w^2 + 13/2*w - 23/4], [331, 331, -3/4*w^3 + 1/2*w^2 + 15/2*w + 5/4], [331, 331, -3/4*w^3 + 5/2*w^2 + 3/2*w - 39/4], [349, 349, -1/4*w^3 + 1/2*w^2 + 7/2*w - 17/4], [349, 349, 1/4*w^3 - 1/2*w^2 - 7/2*w + 1/4], [359, 359, -5/4*w^3 - 1/2*w^2 + 25/2*w + 55/4], [359, 359, w^2 - 2*w - 2], [359, 359, -9/4*w^3 + 15/2*w^2 + 17/2*w - 113/4], [359, 359, -1/4*w^3 + 3/2*w^2 - 1/2*w - 45/4], [361, 19, -w^3 + 2*w^2 + 6*w - 8], [379, 379, -5/4*w^3 + 5/2*w^2 + 17/2*w - 37/4], [379, 379, -5/4*w^3 + 7/2*w^2 + 9/2*w - 41/4], [379, 379, 5/4*w^3 - 3/2*w^2 - 21/2*w - 3/4], [379, 379, -w^3 + 2*w^2 + 5*w - 7], [389, 389, 9/4*w^3 - 17/2*w^2 - 15/2*w + 117/4], [389, 389, -3/4*w^3 - 5/2*w^2 + 21/2*w + 113/4], [401, 401, -3/4*w^3 - 7/2*w^2 + 23/2*w + 149/4], [401, 401, 11/4*w^3 - 21/2*w^2 - 19/2*w + 143/4], [409, 409, -3/4*w^3 + 5/2*w^2 + 9/2*w - 31/4], [409, 409, w^2 - 10], [421, 421, 5/4*w^3 - 5/2*w^2 - 19/2*w + 49/4], [421, 421, -1/4*w^3 + 5/2*w^2 - 1/2*w - 41/4], [421, 421, 5/4*w^3 - 5/2*w^2 - 7/2*w + 41/4], [421, 421, 9/4*w^3 - 9/2*w^2 - 35/2*w + 77/4], [431, 431, 7/4*w^3 - 9/2*w^2 - 11/2*w + 59/4], [431, 431, 5/4*w^3 - 9/2*w^2 - 13/2*w + 85/4], [431, 431, 5/4*w^3 - 5/2*w^2 - 11/2*w + 33/4], [431, 431, -2*w^2 + w + 12], [439, 439, -1/2*w^3 + w^2 + 5*w - 7/2], [439, 439, 2*w - 1], [461, 461, -7/4*w^3 + 13/2*w^2 + 21/2*w - 163/4], [461, 461, 3/2*w^3 - 5*w^2 - 4*w + 31/2], [491, 491, 5/4*w^3 - 3/2*w^2 - 17/2*w + 21/4], [491, 491, -7/4*w^3 + 9/2*w^2 + 19/2*w - 83/4], [509, 509, -3/2*w^3 + 4*w^2 + 7*w - 27/2], [509, 509, -3/2*w^3 + 3*w^2 + 10*w - 27/2], [521, 521, -5/4*w^3 + 3/2*w^2 + 11/2*w - 17/4], [521, 521, -5/2*w^3 + 6*w^2 + 17*w - 53/2], [521, 521, -1/2*w^3 + 3*w^2 + w - 31/2], [541, 541, 9/4*w^3 - 7/2*w^2 - 35/2*w + 37/4], [541, 541, w^3 - 2*w^2 - 8*w + 12], [541, 541, -1/4*w^3 - 3/2*w^2 + 7/2*w + 35/4], [541, 541, -3/4*w^3 + 9/2*w^2 + 5/2*w - 119/4], [569, 569, -w^3 + 3*w^2 + 6*w - 7], [569, 569, -7/4*w^3 + 9/2*w^2 + 23/2*w - 75/4], [599, 599, 1/4*w^3 + 5/2*w^2 - 9/2*w - 95/4], [599, 599, -7/4*w^3 + 13/2*w^2 + 15/2*w - 91/4], [619, 619, 9/4*w^3 - 13/2*w^2 - 19/2*w + 97/4], [619, 619, -7/4*w^3 + 3/2*w^2 + 29/2*w + 9/4], [619, 619, -1/4*w^3 + 3/2*w^2 - 3/2*w - 45/4], [619, 619, -1/4*w^3 - 1/2*w^2 + 9/2*w - 1/4], [631, 631, -9/4*w^3 + 13/2*w^2 + 15/2*w - 93/4], [631, 631, -13/4*w^3 + 21/2*w^2 + 39/2*w - 233/4], [631, 631, 7/4*w^3 - 9/2*w^2 - 15/2*w + 67/4], [631, 631, 1/4*w^3 + 7/2*w^2 - 3/2*w - 51/4], [641, 641, -1/4*w^3 + 5/2*w^2 + 1/2*w - 57/4], [641, 641, -w^3 + 4*w^2 + 5*w - 19], [661, 661, -2*w^3 + 20*w + 19], [661, 661, 5/4*w^3 - 11/2*w^2 - 13/2*w + 149/4], [691, 691, -5/4*w^3 + 3/2*w^2 + 13/2*w - 9/4], [691, 691, -7/4*w^3 + 11/2*w^2 + 23/2*w - 135/4], [739, 739, -2*w^3 + 7*w^2 + 10*w - 34], [739, 739, 1/4*w^3 + 5/2*w^2 - 7/2*w - 59/4], [751, 751, -1/2*w^3 + 3*w^2 + 2*w - 33/2], [751, 751, -3/4*w^3 + 7/2*w^2 + 7/2*w - 67/4], [761, 761, -w^3 + 4*w^2 + 5*w - 27], [761, 761, 7/4*w^3 - 9/2*w^2 - 15/2*w + 63/4], [769, 769, -5/4*w^3 + 1/2*w^2 + 25/2*w + 19/4], [769, 769, 3/2*w^3 - 5*w^2 - 4*w + 39/2], [769, 769, -3*w^3 + 10*w^2 + 11*w - 37], [769, 769, -7/4*w^3 + 5/2*w^2 + 27/2*w - 31/4], [811, 811, -w^3 + 3*w^2 + 6*w - 9], [811, 811, -3/4*w^3 + 7/2*w^2 + 5/2*w - 39/4], [811, 811, -1/4*w^3 + 5/2*w^2 - 1/2*w - 85/4], [811, 811, -5/4*w^3 + 7/2*w^2 + 17/2*w - 57/4], [821, 821, -3/4*w^3 + 3/2*w^2 + 3/2*w - 35/4], [821, 821, -5/4*w^3 + 11/2*w^2 + 9/2*w - 121/4], [829, 829, 7/4*w^3 - 13/2*w^2 - 19/2*w + 115/4], [829, 829, 1/4*w^3 - 7/2*w^2 - 1/2*w + 89/4], [839, 839, -3/4*w^3 + 5/2*w^2 + 3/2*w - 51/4], [839, 839, -3/4*w^3 + 1/2*w^2 + 15/2*w - 7/4], [911, 911, -3/4*w^3 + 1/2*w^2 + 11/2*w - 15/4], [911, 911, -3/4*w^3 + 7/2*w^2 + 3/2*w - 75/4], [929, 929, 9/4*w^3 - 9/2*w^2 - 35/2*w + 73/4], [929, 929, -3/4*w^3 + 7/2*w^2 + 9/2*w - 51/4], [929, 929, -3/4*w^3 + 7/2*w^2 + 9/2*w - 91/4], [929, 929, 5/2*w^3 - 4*w^2 - 19*w + 25/2], [961, 31, -5/4*w^3 + 5/2*w^2 + 15/2*w - 37/4], [961, 31, -1/2*w^3 + w^2 + 3*w - 19/2]]; primes := [ideal : I in primesArray]; heckePol := x^3 - 3*x^2 - x + 1; K := NumberField(heckePol); heckeEigenvaluesArray := [e, 1, 1, e^2 - 4*e + 1, e^2 - 5, -2*e^2 + 4*e + 4, 2*e^2 - 4*e, 2*e^2 - 4*e, -5*e^2 + 12*e + 3, 2*e^2 - 4*e, -e^2 + 4*e + 1, -2*e^2 + 8*e + 6, 2*e + 6, 3*e^2 - 10*e - 9, -3*e^2 + 12*e + 3, -12, e^2 - 8*e + 5, -5*e^2 + 14*e + 7, -2*e^2 - 2*e + 12, 4*e^2 - 16*e - 2, -8*e + 12, -4*e^2 + 16*e + 4, -6*e^2 + 18*e - 2, 4*e^2 - 12*e, 5*e^2 - 16*e - 5, 2*e - 8, 2*e^2 - 12*e + 12, -2*e^2 + 2*e + 6, -7*e^2 + 18*e + 5, 2*e^2 - 6*e - 6, e^2 - 2*e - 1, -e^2 - 4*e + 13, 9*e^2 - 24*e + 1, 6*e^2 - 16*e + 8, -4*e^2 + 10*e - 10, -6*e^2 + 18*e + 10, 5*e^2 - 16*e - 3, 2*e^2 - 6, -6*e^2 + 8*e + 16, 10*e^2 - 38*e - 6, -2*e^2 + 14*e - 12, 8*e^2 - 18*e - 2, e^2 - 4*e + 11, -10*e^2 + 22*e + 18, -4*e^2 + 2*e + 14, 7*e^2 - 18*e + 7, -10*e^2 + 28*e + 18, -6*e^2 + 16*e - 12, 4*e^2 - 20*e + 10, 8*e^2 - 16*e - 16, -2*e^2 + 6*e - 14, 2*e^2 - 6*e + 2, -12*e^2 + 36*e + 4, 2*e^2 - 6*e + 20, -12*e^2 + 30*e + 6, -15*e^2 + 36*e + 7, -6*e^2 + 10*e + 4, -10*e^2 + 38*e + 10, 5*e^2 - 16*e - 3, -2*e^2 + 12*e - 4, 2*e - 4, -4*e^2 + 12*e - 16, 4*e^2 - 18, 4*e^2 - 14*e + 6, -8*e^2 + 28*e + 4, 8*e^2 - 20*e + 2, -3*e^2 + 18*e - 5, -e^2 + 7, -6*e^2 + 18*e - 4, -4*e + 12, -2*e^2 + 10*e - 8, -8*e^2 + 28*e + 6, -7*e^2 + 26*e - 9, 7*e^2 - 16*e - 9, -8*e^2 + 20*e + 20, -4*e^2 + 6*e - 10, -11*e^2 + 28*e + 9, -4*e^2 + 20, -10*e^2 + 36*e, -2*e^2 + 16*e - 8, -6*e^2 + 18*e + 2, -2*e^2 - 2*e + 2, -4*e^2 - 2*e + 14, -2*e^2 + 12*e - 14, 4*e^2 - 12*e + 14, -4*e^2 + 12*e + 2, -2*e^2 + 2*e + 2, 14*e^2 - 48*e - 10, 3*e^2 - 12*e + 3, 6*e^2 - 30*e + 18, 14*e^2 - 46*e - 10, 12*e^2 - 28*e - 4, 7*e^2 - 32*e + 11, -8*e + 20, 8*e^2 - 10*e - 10, -2*e^2 + 4*e - 14, 8*e^2 - 26*e + 8, -13*e^2 + 32*e + 13, 10*e^2 - 18*e - 18, 6*e^2 - 20*e, -10*e^2 + 24*e + 8, -8*e^2 + 32*e + 10, 6*e^2 - 28*e + 6, 20*e^2 - 52*e - 20, -16*e^2 + 36*e + 26, 8*e^2 - 34*e + 6, -16*e^2 + 46*e + 22, 3*e^2 - 16*e + 23, -4*e^2 + 10*e - 24, -6*e^2 + 24*e - 14, -10*e^2 + 18*e + 24, -e^2 + 16*e - 33, -4*e^2 + 2*e + 20, 24*e^2 - 68*e - 8, -15*e^2 + 48*e + 19, 2*e^2 - 8*e - 22, 10*e^2 - 22*e - 14, -5*e^2 + 34*e - 11, 8*e^2 - 12*e - 14, -4*e^2 + 14*e - 18, -6*e^2 + 34*e - 22, -16*e^2 + 48*e - 6, 14*e^2 - 28*e - 8, 14*e - 22, 8*e^2 - 8*e - 20, -6*e^2 + 16*e + 28, 4*e^2 - 4*e + 16, 9*e^2 - 34*e + 7, 2*e^2 - 34, -6*e^2 + 20*e - 16, -6*e^2 + 20*e - 16, 8*e^2 - 24*e, 11*e^2 - 28*e - 9, 16*e^2 - 28*e - 42, -3*e^2 - 12*e + 31, 22*e^2 - 74*e - 12, 2*e^2 + 8*e - 14, 20*e^2 - 56*e - 6, 4*e^2 - 16*e - 36, e^2 + 12*e + 1, -16*e^2 + 52*e - 4, 8*e^2 - 22*e + 4, -3*e^2 + 8*e - 9, 24*e^2 - 66*e - 28, -8*e^2 + 28, -4*e^2 - 4*e + 20, 12*e^2 - 28*e - 30, -20*e^2 + 64*e + 6, 10*e^2 - 46*e - 10, -15*e^2 + 46*e + 17, -27*e^2 + 68*e + 23, -20*e^2 + 58*e + 22, 24*e^2 - 68*e - 34]; 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;