
// Make newform 37.2.h.a in Magma, downloaded from the LMFDB on 19 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_37_h();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_37_h_Hecke();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_37_2_h_a();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose lines below.
// The precision argument determines an initial guess on how many Fourier coefficients to use.
// This guess is increased enough to uniquely determine the newform.
// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_37_2_h_a();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose line below.
// The default sign is -1.  You can change this with the optional parameter "sign".
function ConvertToHeckeField(input: pass_field := false, Kf := [])
    if not pass_field then
        poly := [192, 0, 1584, 0, 5316, 0, 9385, 0, 9432, 0, 5490, 0, 1826, 0, 333, 0, 30, 0, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-13392, 64, -101208, 0, -289165, 0, -398496, 0, -284274, 0, -107422, 0, -21225, 0, -2010, 0, -69, 0], [-19808, -1192, -125860, 4902, -313697, 41101, -390328, 82076, -259794, 70238, -93906, 29284, -18037, 6125, -1678, 600, -57, 21], [65824, -64208, 454736, -399688, 1190394, -957761, 1528384, -1142912, 1037220, -735738, 379484, -259878, 73458, -49165, 6868, -4530, 234, -153], [-256, 37104, 0, 326504, 0, 1024431, 0, 1494432, 0, 1102022, 0, 424554, 0, 84867, 0, 8094, 0, 279], [-128416, -185072, -799376, -1292568, -1915522, -3428267, -2285824, -4443072, -1471476, -3034622, -519756, -1114850, -98330, -216367, -9060, -20262, -306, -691], [128416, -185072, 799376, -1292568, 1915522, -3428267, 2285824, -4443072, 1471476, -3034622, 519756, -1114850, 98330, -216367, 9060, -20262, 306, -691], [-65488, -54448, -443000, -331624, -1152173, -788471, -1479584, -941568, -1006898, -607606, -369470, -215066, -71689, -40747, -6714, -3758, -229, -127], [91552, 319792, 690096, 1942632, 2046138, 4549715, 2944576, 5301344, 2170596, 3341230, 838268, 1161122, 167986, 217111, 16052, 19846, 554, 667], [259232, -235344, 1661904, -1486312, 4143426, -3690001, 5147392, -4597888, 3424628, -3071322, 1238668, -1114278, 238170, -214685, 22180, -20018, 754, -681], [105104, 52064, 694720, 341428, 1779567, 870673, 2260240, 1105720, 1526486, 748082, 557282, 273634, 107763, 52997, 10070, 4958, 343, 169], [-105104, 52064, -694720, 341428, -1779567, 870673, -2260240, 1105720, -1526486, 748082, -557282, 273634, -107763, 52997, -10070, 4958, -343, 169], [-657888, 202576, -4454544, 1526936, -11594014, 4372501, -14870336, 6021536, -10100748, 4287330, -3699860, 1617550, -716870, 319281, -67068, 30218, -2286, 1037], [-920992, -185072, -6289744, -1292568, -16510930, -3428267, -21341312, -4443072, -14581140, -3034622, -5362028, -1114850, -1041578, -216367, -97604, -20262, -3330, -691], [524704, 624304, 3544560, 4380808, 9213226, 11781779, 11813568, 15553184, 8026308, 10791022, 2940892, 4008898, 569954, 783895, 53332, 73766, 1818, 2523], [-16224, 242064, -132512, 1617784, -401242, 4198509, -575744, 5395296, -421252, 3675442, -161708, 1349598, -32274, 261961, -3076, 24538, -106, 837], [-148720, -256240, -1046304, -1722444, -2820865, -4474666, -3721872, -5747896, -2578570, -3913276, -956734, -1436200, -186909, -278666, -17578, -26096, -601, -890]];
    Rf_basisdens := [1, 1, 128, 128, 512, 512, 1024, 1024, 256, 1024, 1024, 256, 256, 1024, 1024, 1024, 256, 256];
    Rf_basisnums := ChangeUniverse([[z : z in elt] : elt in Rf_num], Kf);
    Rfbasis := [Rf_basisnums[i]/Rf_basisdens[i] : i in [1..Degree(Kf)]];
    inp_vec := Vector(Rfbasis)*ChangeRing(Transpose(Matrix([[elt : elt in row] : row in input])),Kf);
    return Eltseq(inp_vec);
end function;


// To make the character of type GrpDrchElt, type "MakeCharacter_37_h();"
function MakeCharacter_37_h()
    N := 37;
    order := 18;
    char_gens := [2];
    v := [13];
    // chi(gens[i]) = zeta^v[i]
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    F := CyclotomicField(order);
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),[F|F.1^e:e in v]);
    return MinimalBaseRingCharacter(chi);
end function;

// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_37_h_Hecke();"
function MakeCharacter_37_h_Hecke(Kf)
    N := 37;
    order := 18;
    char_gens := [2];
    char_values := [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]];
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    values := ConvertToHeckeField(char_values : pass_field := true, Kf := Kf); // the value of chi on the gens as elements in the Hecke field
    F := Universe(values);// the Hecke field
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),values);
    return chi;
end function;


function ExtendMultiplicatively(weight, aps, character)
    prec := NextPrime(NthPrime(#aps)) - 1; // we will able to figure out a_0 ... a_prec
    primes := PrimesUpTo(prec);
    prime_powers := primes;
    assert #primes eq #aps;
    log_prec := Floor(Log(prec)/Log(2)); // prec < 2^(log_prec+1)
    F := Universe(aps);
    FXY<X, Y> := PolynomialRing(F, 2);
    // 1/(1 - a_p T + p^(weight - 1) * char(p) T^2) = 1 + a_p T + a_{p^2} T^2 + ...
    R<T> := PowerSeriesRing(FXY : Precision := log_prec + 1);
    recursion := Coefficients(1/(1 - X*T + Y*T^2));
    coeffs := [F!0: i in [1..(prec+1)]];
    coeffs[1] := 1; //a_1
    for i := 1 to #primes do
        p := primes[i];
        coeffs[p] := aps[i];
        b := p^(weight - 1) * F!character(p);
        r := 2;
        p_power := p * p;
        //deals with powers of p
        while p_power le prec do
            Append(~prime_powers, p_power);
            coeffs[p_power] := Evaluate(recursion[r + 1], [aps[i], b]);
            p_power *:= p;
            r +:= 1;
        end while;    
    end for;
    Sort(~prime_powers);
    for pp in prime_powers do
        for k := 1 to Floor(prec/pp) do
            if GCD(k, pp) eq 1 then
                coeffs[pp*k] := coeffs[pp]*coeffs[k];
            end if;
        end for;
    end for;
    return coeffs;
end function;


function qexpCoeffs()
    // To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
    weight := 2;
    raw_aps := [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0], [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 1, 0], [-1, 0, 0, -1, -1, -1, 1, 1, 0, -1, 0, 0, 0, 1, 0, 0, -1, -1], [0, 1, -1, 0, 0, 0, 0, 0, -1, 1, 0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, -1, 1, 0, 1, 0, 0, -2, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0], [-1, 0, 0, -1, -1, 0, -1, 0, 0, -1, 0, 1, 1, -1, 0, -1, 0, 0], [3, 1, -1, 2, 2, -1, -4, -1, 0, 1, -2, -1, 0, -2, 1, 0, 1, 1], [-1, -1, 1, 1, -2, 0, 2, 0, -1, 0, 1, 0, -1, 1, 0, 0, -1, 0], [-3, 1, 0, -1, -1, 1, 1, 0, 0, 0, 0, 1, 1, 1, -1, 1, 0, 1], [2, -1, 0, 0, -1, 2, 1, 1, -1, 0, -1, -2, -2, -1, 0, 0, -1, 1], [1, 0, -1, 0, -1, 1, -2, 2, 2, -1, -1, -3, 1, 0, -1, -2, 0, -2], [0, 0, 1, 0, 0, 2, -1, -1, -2, 1, 0, 3, 1, -1, 1, 2, 1, 1], [-5, 0, 0, -2, -1, -3, 6, 5, 0, -3, 2, 1, 0, 5, -2, -1, -1, -2], [1, 2, 0, 0, 2, 4, -2, -1, 0, 2, 0, -2, 1, -1, 2, 2, 1, 0], [-3, -2, -2, 3, 0, -6, 0, -3, 1, -2, -1, 1, -4, 1, -1, -1, -1, -1], [3, 0, -2, 2, 0, 0, -5, 2, 1, 0, -4, -1, 0, -2, -1, -4, 1, 0], [3, 3, -1, 0, -1, 2, -1, 2, -3, 0, 1, 0, 3, 1, -1, 0, 0, 0], [-4, -4, 3, -1, 0, -2, 2, -4, 3, 0, 2, 5, 0, 1, -2, -1, 1, -3], [-1, 0, 0, 1, -1, 2, 0, 4, 0, -1, 1, 2, -1, 0, -2, 0, -1, 2], [-4, 2, 2, -1, 3, 1, 0, -4, 1, 3, 0, 5, -1, -1, 3, 3, 1, 4], [1, 0, -3, 0, 3, 2, -5, -1, 3, 0, 0, -2, 6, 1, 1, 0, 0, -1], [-2, -1, 1, -2, 1, -1, 0, -2, 0, 1, 1, -3, 2, -1, 2, 1, 0, 0], [1, 6, -2, 0, 0, -4, 2, 1, -2, 0, -2, -2, 2, 2, 2, 4, -2, 0], [-1, -4, 1, 0, -2, -5, 3, 1, 0, -4, -2, -2, -5, 5, -2, -3, -2, -6], [0, 0, -2, 0, 3, -3, -4, 3, 0, 3, 0, -6, -3, 0, 3, 2, 4, 0], [2, -3, 2, 0, -1, 3, -4, 3, -1, -1, 1, -4, -1, -2, 1, -3, 1, -1], [-2, -1, -2, 2, 1, -3, -5, 1, 0, -1, -1, -9, 2, 2, 0, -1, -1, -1], [-5, 0, 2, -2, -1, -3, 8, -2, 0, -2, 3, 3, -6, 2, -2, -1, -1, -1], [4, -1, 0, 0, -2, 1, 1, 3, 0, -1, 0, 6, 0, 2, -2, -1, -1, 0], [6, 1, 1, 1, 2, 4, -4, -4, -2, 6, -2, 0, 2, -7, 2, 3, 2, 3], [6, -4, 4, 2, -1, 1, 3, -3, 2, -3, -4, -2, -6, -1, -1, -2, -2, 0], [-4, -2, -1, 1, -1, -1, 1, 2, 3, 0, 3, 5, 2, 4, -4, -4, -3, -1], [-5, 0, 1, -1, -3, -3, 4, 0, 0, -3, 1, 2, -6, 3, -2, 1, 0, 0], [-2, 2, -2, 0, -1, 0, 5, 2, -2, 1, 2, 0, 1, 2, -3, 1, -2, -1], [2, 0, 1, -2, -4, -2, 0, -4, -1, -4, -2, -3, 1, 0, 3, 0, -3, -3], [0, 4, -3, 5, 0, 3, -3, 9, 0, 0, -3, -1, -2, 0, -1, -1, 0, 2], [-2, -5, -1, 1, 0, 4, -5, 6, 3, 0, -2, 1, 1, -2, -2, -7, 2, -3], [-4, -2, 4, -2, -1, 0, 1, -6, 4, -1, 2, 11, 0, 0, 1, -2, 0, 1], [7, 4, -4, -4, -1, 12, 1, -3, -4, 1, 0, -2, 4, -2, 0, 0, 2, 1], [-4, 4, 0, -3, 3, -1, 8, 0, 2, -2, 5, 1, 2, 2, 1, 4, -2, 0], [5, -1, 0, 0, 3, 1, -2, -3, -3, 3, 0, -4, -4, -3, 3, 2, 3, 3], [2, 1, 0, -2, 5, 0, -3, -4, -1, 4, 1, 0, 6, -5, 3, 2, 3, 1], [-1, -2, 0, -2, -4, -1, -5, 5, 2, -2, -2, -4, 1, 0, -2, -2, -1, -1], [1, 6, -2, -2, 1, 1, 6, 5, -4, 3, -1, -3, 2, 0, 0, 3, 3, 0], [2, 1, -1, 0, -3, 2, -3, 3, 0, -1, 2, 3, 3, 2, 1, 0, -2, 0], [6, -1, 1, 2, 0, 2, -7, -4, -4, 2, -4, -1, -4, -3, 1, 1, 4, -1], [0, 3, -4, -1, -2, 2, 3, -2, -2, 1, 3, -4, 6, 1, 3, 1, -1, 0], [2, -1, 3, -1, -4, 6, 5, 1, -3, -1, 0, 5, -1, -4, -6, -1, -2, 4], [-5, -10, 3, 0, -6, -3, -5, -1, 3, -2, 0, 0, 1, -1, 0, -3, 1, -1], [4, 6, -2, -2, 7, 4, -6, -10, 0, 5, 0, 2, 1, -7, 2, 2, 4, 3], [7, 6, 1, 0, 2, 11, 9, -2, -6, 8, -1, -3, -3, -2, 2, 6, 4, 3], [-13, 2, -2, -4, -4, 1, 12, 4, -2, -4, 4, 3, 5, 10, -1, 2, -5, -1], [6, -1, 1, 1, 3, -4, -9, 3, 4, 2, -4, -3, -4, -3, 5, -1, 2, -1], [6, 0, 0, 0, 5, -10, -8, -13, 0, 0, -3, 9, 4, -1, 6, 3, 3, 2], [11, -2, 1, 14, 3, -6, -12, -4, -2, 4, -7, 1, -11, -6, 2, 0, 4, 4], [-3, -1, 0, 1, 4, 0, 6, 3, 1, -3, 6, -2, -4, 3, -3, -1, -2, 0], [6, -2, 3, 3, 0, 0, -3, -4, 0, 0, 0, -2, -3, 0, 0, 1, -1, 1], [-4, 1, -1, -2, 7, -1, -13, -1, 2, 4, 2, -10, 15, -10, 2, -2, 5, 2], [14, -1, -2, -1, 0, 6, -3, -10, -1, 0, -1, 2, 3, 0, 2, -2, -2, -2], [-7, 0, 2, 0, 7, 0, 9, 3, 3, 5, 4, -1, -5, 0, 0, 3, -1, 1], [9, -2, -1, -4, 4, 2, -11, 1, 3, 2, -4, -6, 10, 0, 6, 0, 4, -6], [-3, 9, -4, 3, -7, -9, -2, 13, -6, -4, -6, -2, 5, 3, 1, 1, -2, -1], [-3, -7, 8, 3, 0, 3, 7, -2, 3, 0, 5, 7, -3, 1, -4, -2, 4, -4], [-7, 10, -9, -6, 2, -5, 14, 9, 3, -1, 9, -1, 8, 7, -5, 4, -10, 1], [-9, 2, 3, -4, -4, 5, 3, -5, -3, 2, 1, 3, 0, 1, 3, 1, 3, 1], [-4, -4, 5, -5, -13, 11, 14, 16, 0, -7, 4, 0, -9, 5, -6, -3, -3, -5], [-6, -5, 4, -8, -12, -4, 17, 8, -6, -8, 4, 1, -6, 11, -5, 1, -8, -8], [4, 5, 1, -3, 9, 7, 5, -13, 3, 8, 2, 6, 2, -6, 4, 6, 0, 12], [-3, -11, 8, -3, -8, 0, 0, 3, 2, -12, -5, -5, -4, 7, -4, -6, -4, -6], [-6, -1, 2, -2, -6, -7, 17, 6, -1, -5, -2, 4, -8, 7, -2, -3, -4, -4], [-16, 3, -3, -3, -1, -13, 6, 2, 3, -4, 3, -1, -3, 7, -3, -3, -2, -5], [-6, -6, 3, 0, 3, -8, 9, -4, 3, -3, 0, 4, -9, 0, -4, 0, -1, 4], [-4, -1, -1, 2, -1, 6, -6, -1, 2, -2, 2, 2, -3, 0, -2, 0, 5, 2], [0, 3, -5, 1, -1, -7, -8, -1, 4, 3, -5, -7, 1, -3, 5, 2, 0, -4], [-2, -1, 5, 0, 1, -4, 6, 14, -2, -4, -1, -4, -4, 4, -4, -3, 2, -2], [-2, -10, -2, 4, -9, -14, -11, 16, -4, -7, -4, -17, -2, 6, -9, -8, -3, -9], [2, 7, 0, 1, 8, -5, 0, -1, 1, 6, 1, -3, 0, -2, 6, 7, 3, 0], [5, -1, 0, -2, 10, 3, -3, -6, 0, 8, 2, -3, 7, -9, 8, 8, 7, 1], [7, 7, -1, 1, 8, 8, -13, -4, 0, 9, 2, 0, 21, -7, 8, 4, 4, 6], [-8, 4, -6, -6, -7, 4, -5, 5, -8, -3, 4, 3, 6, 4, 0, 2, -8, 1], [-13, 1, -1, -1, -2, -4, -5, 2, 1, -2, 1, -1, 3, -3, 2, 0, 3, 0], [-9, -6, 1, 0, -3, -9, 4, 6, 4, -4, -4, -2, -5, 1, -1, -2, 0, 0], [19, 2, 0, 5, 5, 13, -6, 8, -6, 10, -6, -9, 6, -12, 2, 2, 9, 3], [-2, 2, -3, -7, 0, 2, 7, 2, 3, 1, 0, 6, 1, -4, -5, -2, -1, 4], [1, 4, -2, 1, 4, -6, 2, 4, 0, 3, -1, -8, 10, 5, -2, 3, -5, -2], [-10, -1, -4, -5, 8, -7, -7, -3, 4, 0, 0, -4, -2, 1, 4, 3, 3, -1], [2, -6, 2, 0, -2, 2, -6, 2, 4, -4, 3, 3, 1, 4, -4, -2, 0, 0], [-7, -3, 2, 4, 2, -7, -7, -9, 1, 1, -2, 11, -1, -3, 0, 1, 0, 2], [-3, -5, -3, -4, -5, 0, 9, 2, 2, -10, 4, 13, -4, 10, -7, -10, -5, -7], [-10, -4, 6, -5, -3, 0, 3, -6, 5, -3, 5, 3, 3, 0, 7, 2, -2, 4], [5, 10, -7, 7, 3, 0, -7, 3, 0, 2, 1, -2, 5, -2, 4, 2, 2, 2], [-3, -6, 0, 6, -5, -8, -4, 0, 3, -2, -3, 0, -8, 1, -4, -6, -3, 1], [2, -9, -3, -1, -9, -1, -11, -3, -1, -5, -3, -6, 4, -2, -5, -6, -6, 0], [4, -6, 2, 5, -6, 1, -1, -5, 0, -4, -5, 12, -10, 4, 2, -4, -2, 2], [-12, -3, 3, -2, 0, -12, 3, 3, 3, 0, 5, -9, -4, 1, -2, 2, 2, 0], [3, 3, 2, 2, 1, 6, 3, 1, -2, -1, 2, 7, -11, 1, 0, 1, 0, 4], [3, 2, 4, -2, -7, -8, 13, 3, -6, -5, -2, -1, -1, 0, 1, 0, -3, -1], [-1, -2, 10, -1, -5, 12, -5, 1, -10, -2, 0, 3, 0, -2, 1, 5, 3, 2], [-7, -1, 2, -7, 4, 5, 13, -9, 7, 7, 10, 15, 0, 3, -5, 1, -4, 2], [5, 0, -5, -2, -4, -6, 0, 13, -3, -2, 3, -9, 0, 2, -4, 0, -6, -4], [11, 7, -8, 8, 13, -2, -20, -6, 0, 8, -5, -13, 14, -10, 8, 4, 4, 2], [-12, 1, 1, -12, -12, 8, 17, -2, 2, 0, -2, 17, -2, 1, -1, 1, -2, -1], [-5, 4, -4, 7, -4, -3, 1, 14, -7, 5, 2, -3, 7, 5, -5, 0, -5, 0], [-2, 4, -1, 0, 16, 1, 5, -14, 5, 6, 1, -3, -6, -5, 5, 3, 5, 3], [2, -9, 4, 1, 0, 9, -11, -1, -2, 0, 3, 2, -8, -4, 1, -6, -1, 2], [4, 0, -2, -6, -4, 13, -4, 0, 2, -6, 0, -5, 20, 5, -1, 0, -6, -5], [11, 5, -8, 8, 8, -11, -1, -3, -1, 1, -7, -8, 1, 4, 1, 1, -4, -3], [10, 7, 0, 1, 10, 6, 4, -8, 0, 9, -2, 5, -5, -3, 0, 6, 3, -3], [-2, -1, 8, 3, -2, 6, 7, 3, 3, 1, 8, 7, 5, -1, -3, -4, 0, -3], [-9, 15, -9, -7, 0, -6, -1, 11, -5, 0, -2, -5, -4, 8, 1, 13, -1, -3], [4, -9, 1, 4, -2, -1, -1, 2, 3, -8, -5, -10, -21, 2, 9, -4, 9, -4], [2, 4, 1, 1, -7, -2, 7, -9, 0, -7, -2, 9, -1, 14, 0, 3, -17, -4], [-7, -4, -1, 2, 2, -3, 0, -6, 2, -6, 6, 4, 4, 7, -6, -3, -2, 0], [-9, -4, 5, -5, -1, 6, 5, -4, 0, 3, -1, -10, -11, -4, 4, 2, 2, 1], [-6, -6, 3, 3, 9, -9, -21, -6, 18, 0, -3, 6, -3, -3, 0, -6, 6, -3], [35, 3, -4, 5, -4, 13, -2, 1, -5, -4, -5, -8, -6, -1, 2, -1, 2, -2], [17, 0, -5, 8, 1, 4, -5, -6, -7, 3, -8, 8, -8, -4, 0, 2, 2, 0], [3, 13, -5, 0, -2, 2, 5, -3, -6, 3, 4, 8, 10, 1, -1, 7, -11, 11], [-6, 10, -2, -5, 4, 2, 8, 1, -2, 3, 10, 0, 9, 1, 3, 7, -4, 7], [-2, 7, -6, -2, 0, 0, 1, 9, 6, 2, 0, 10, 5, -1, 0, -1, 1, 1], [1, -9, 4, -4, -5, 6, -3, -4, 4, -7, 8, 5, -3, 1, -1, -7, 0, -1], [-6, -5, 0, 3, -4, -2, 4, -4, 4, -1, 4, -1, -14, 6, -5, -5, 1, -7], [4, -2, 0, 1, 5, 12, -36, -14, 1, 4, 0, 0, 14, -14, 5, -1, 10, 4], [5, -4, 6, 6, -2, -9, -5, 10, -4, 0, -5, -8, -6, -11, 0, -3, 3, 8], [-4, -2, -1, 1, -9, -9, 3, -3, 0, -2, 0, 16, -1, 5, -6, -3, -3, 0], [0, -6, 0, -2, -15, -1, 10, 10, -9, -8, -7, 1, -5, 6, -3, 2, -10, 2], [0, 3, -4, 4, -8, -9, 13, 7, -7, 6, 0, 15, -11, 3, -3, 3, -3, 3], [4, 7, 1, 0, 3, 2, 4, 6, -5, 2, 1, 2, 2, 4, -4, 2, -2, 2], [8, 15, -10, 2, 6, -4, -6, -6, -10, 8, -4, 4, 12, -2, 1, 7, 1, 0], [3, 10, -2, -4, -3, 9, 22, -6, -8, 9, 12, 7, 6, 3, -1, 9, -3, 6], [-13, -5, -6, 3, 14, -5, -13, -9, 11, 9, 3, -7, -7, 0, 7, 0, 4, -7], [-1, -1, 1, -11, 4, -2, 7, 10, -1, -7, -1, -7, 8, 6, 1, 1, -1, -5], [9, 10, -2, -4, 10, 5, -17, 7, -3, 13, 2, -5, 13, -13, 7, 6, 14, 6], [-2, 10, -4, 0, 6, 17, -5, -11, -3, 12, 4, -8, 10, -10, 5, 6, 5, 6], [-10, -3, 0, -3, -2, 12, -11, -15, 6, 1, -6, -2, 16, -4, 5, -3, 3, -1], [-7, -3, 4, -4, 1, 4, -12, -5, 5, 5, 2, 16, 5, -8, 2, -8, 5, 5], [8, 5, 12, -2, 3, 3, -1, 2, -2, 4, 1, -1, 0, -8, 4, -7, 7, 0], [23, -9, 4, 10, 8, 12, -22, -15, 2, 6, -4, -9, -3, -24, 5, 1, 10, 10], [0, -6, 8, 1, -12, -8, 15, 2, -8, -10, 0, -2, -12, 4, -6, 0, -10, -4], [-6, 6, -10, 4, 2, -4, 2, 8, 4, 8, 4, 2, 4, 0, -2, 0, -8, 2], [12, 6, -2, 4, -2, -3, -5, 17, -2, -7, -8, -9, -11, 8, -2, -1, -6, 4], [12, -3, -3, 4, 2, -7, 0, -3, -5, -3, -3, 1, 1, 3, -10, -7, 0, -4], [0, -3, 5, 0, -3, 1, 2, 2, -3, -8, -4, -1, -10, 2, -2, -6, 4, -4], [13, -7, 1, 3, 0, 8, -6, -6, -4, 0, -2, -2, -3, -8, -5, -9, 5, 7], [-6, 8, -6, -6, 0, 5, 26, 7, -8, 4, 4, -1, 6, 7, 0, 6, 2, -5], [-20, -10, 4, -4, -11, -18, 15, -3, 0, -11, 2, 7, -6, 11, -16, -8, -8, -8], [4, -10, 0, 1, 4, 17, 5, -2, 8, -3, 7, -5, -9, 2, -4, -5, -4, 1], [9, 3, 3, 11, 17, -7, -9, -9, 4, 6, -4, -2, -3, -3, 9, 3, 3, 0], [-9, 7, 2, 2, -2, 6, 1, -1, -10, 3, -3, 18, -2, -3, 0, 6, 0, 6], [8, 9, -2, 0, -2, 9, 12, -4, 1, -2, 1, -8, -9, -3, 5, 5, -3, 6], [-6, -3, 7, -1, 5, -21, -13, 1, 7, -1, 2, -3, 18, -2, 1, -2, 1, 0], [2, -1, 3, 11, -4, -3, -1, -3, -3, -3, 0, -2, -7, -1, -3, 1, -2, 1], [-1, -2, 2, 0, -1, 5, -16, -1, 0, -1, 0, -7, 6, -5, 12, -1, 5, 4], [-8, 0, 1, -7, 0, 17, 9, -1, -5, 6, 7, -7, 13, -6, 3, 6, 3, 3], [-24, -3, 2, -1, -3, -8, 9, 2, 1, 1, 5, -2, 1, 2, -3, -1, -1, -2], [-11, -6, 0, 9, 8, -23, -18, -19, 13, 4, 4, 3, -2, -5, 0, -4, 3, 1], [17, 7, 5, 6, 7, 17, -1, -12, -3, 12, -3, 2, -2, -17, 7, 10, 12, 12], [10, 16, 2, 2, -7, -5, 0, 16, -18, 2, -11, -6, -2, -4, 0, 7, -3, 9], [3, -3, 5, -4, -6, 12, 15, 3, -1, -4, -1, -9, -8, -2, -6, -2, -6, -2], [9, -1, -2, 0, 0, -3, 4, -3, -2, 0, -2, -8, 9, -1, 0, -3, 0, -1], [0, -1, 11, 0, 1, 17, 8, -6, 2, 3, 11, 19, 7, -3, 2, -1, 0, 10], [17, -1, 0, 8, 15, 15, -15, -5, 0, 7, 0, 1, 9, -6, 8, 7, 14, 6], [4, -13, 1, 1, 0, 3, -8, -6, 9, 9, 1, 1, 20, -9, -5, -14, 0, -4], [13, -10, 6, 6, 0, -4, 4, -4, 1, 0, 0, -7, 7, 0, -1, -10, 1, -10], [8, -3, -2, 2, 0, -1, -23, 15, 3, -6, 0, -7, 17, 7, 1, -3, 1, -3], [-4, 7, -13, 0, 2, 1, -4, 1, -7, 2, 7, -11, 15, 5, -3, 7, 0, 5], [1, -1, -7, 7, 5, -3, -13, 5, 0, -2, -9, -12, -1, 4, 2, 1, 1, 3]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_37_h_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_37_2_h_a();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose lines below.
// The precision argument determines an initial guess on how many Fourier coefficients to use.
// This guess is increased enough to uniquely determine the newform.
function MakeNewformModFrm_37_2_h_a(:prec:=18)
    chi := MakeCharacter_37_h();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 2));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(997) - 1;
    while true do
        trunc_vec := Vector(Kf, [0] cat [f_vec[i]: i in [1..prec]]);
        B := Basis(S, prec + 1);
        S_basismat := Matrix([AbsEltseq(g): g in B]);
        if Rank(S_basismat) eq Min(NumberOfRows(S_basismat), NumberOfColumns(S_basismat)) then
            S_basismat := ChangeRing(S_basismat,Kf);
            f_lincom := Solution(S_basismat,trunc_vec);
            f := &+[f_lincom[i]*Basis(S)[i] : i in [1..#Basis(S)]];
            return f;
        end if;
        error if prec eq maxprec, "Unable to distinguish newform within newspace";
        prec := Min(Ceiling(1.25 * prec), maxprec);
    end while;
end function;


// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_37_2_h_a();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose line below.
// The default sign is -1.  You can change this with the optional parameter "sign".
function MakeNewformModSym_37_2_h_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_37_h();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([],Snew);
    return Vf;
end function;