
// Make newform 78.2.k.a in Magma, downloaded from the LMFDB on 24 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_78_k();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_78_k_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_78_2_k_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_78_2_k_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 := [25, -220, 972, -2780, 5736, -9024, 11224, -11276, 9297, -6328, 3580, -1668, 642, -196, 48, -8, 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], [-204955, 1197759, -3952842, 8382900, -13645786, 16940634, -17359125, 14273792, -9912750, 5595909, -2665197, 1019601, -318997, 76652, -13188, 1548], [142555, -929924, 3418428, -8598668, 15739188, -22138664, 24527176, -21928484, 15945783, -9554736, 4666596, -1879372, 594074, -151876, 25920, -3456], [5945, -33855, 103708, -208129, 310030, -354283, 326020, -240948, 147747, -72992, 30137, -9604, 2541, -434, 62, 0], [979490, -5858382, 19292843, -41344164, 65574610, -79360265, 77090107, -60027902, 38713617, -20191094, 8792571, -3008933, 849994, -168702, 26338, -1548], [281130, -1513502, 3846345, -4590360, -253940, 11893278, -24081648, 30952836, -28148715, 20458668, -11330101, 5254311, -1795712, 525827, -93144, 15207], [610830, -3136623, 8068367, -11188252, 7076841, 6423019, -21374907, 30783293, -29032660, 21486123, -11970872, 5567337, -1902441, 556086, -98393, 15977], [-1883725, 12999216, -45658062, 104335813, -173497381, 221440773, -225133368, 185376534, -125576015, 70027507, -32236863, 12106306, -3642449, 856169, -141262, 15977], [-2984015, 19588566, -66643178, 147674805, -239467694, 298087511, -296346875, 238257063, -157951050, 85888071, -38692358, 14099264, -4151403, 932688, -151267, 15207], [218885, 510382, -6949514, 27082796, -61611091, 99711814, -121073088, 116711850, -89528958, 56590650, -28666706, 12097498, -3923413, 1056740, -182630, 26630], [-1090565, 9111403, -37587574, 99647214, -188678893, 271172221, -305524016, 277503791, -204357372, 124293850, -61357045, 25109764, -8006091, 2089429, -358139, 49663], [-2064105, 15149982, -57050598, 140137971, -249596834, 340522371, -367712403, 321502876, -229565910, 135478704, -65341929, 26035188, -8157610, 2068305, -350841, 46358], [3439595, -24026495, 86298565, -202568648, 346814258, -456031708, 477125400, -404524612, 281449761, -161588818, 76252747, -29559388, 9095994, -2230313, 373985, -46358], [1312670, -11232929, 46393946, -122374471, 229677473, -326718848, 364427829, -327539991, 239041170, -143951776, 70523459, -28575749, 9056462, -2335837, 399016, -54184], [-370592, 3003630, -11804598, 29816774, -53991081, 74558856, -81160006, 71445138, -51252471, 30390552, -14702424, 5882478, -1846988, 470562, -79890, 10652], [1951760, -15915907, 62844859, -159062971, 288232582, -397583146, 432289456, -379486173, 271670265, -160446084, 77432206, -30812827, 9652683, -2438933, 413744, -54184]];
    Rf_basisdens := [1, 17095, 17095, 65, 17095, 17095, 17095, 17095, 17095, 17095, 17095, 17095, 17095, 17095, 3419, 17095];
    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_78_k();"
function MakeCharacter_78_k()
    N := 78;
    order := 12;
    char_gens := [53, 67];
    v := [6, 7];
    // 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_78_k_Hecke();"
function MakeCharacter_78_k_Hecke(Kf)
    N := 78;
    order := 12;
    char_gens := [53, 67];
    char_values := [[-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 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, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1], [0, -1, 0, -1, -1, 0, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0], [0, 1, 0, 1, 1, -1, -2, 0, 0, 0, 1, 0, -1, -1, 0, 0], [1, 0, -1, -1, 0, 0, 0, 0, 0, -1, 0, -1, 0, 0, 1, 0], [0, -1, 0, -1, 0, 2, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0], [-1, 1, -1, 2, 1, 0, 0, 0, 0, 0, 0, 2, -1, 0, -1, 0], [0, 4, 0, 2, 2, -2, 2, 1, -2, 0, 2, 2, -2, 1, 0, -1], [-2, -2, 2, -1, -2, 0, 0, 0, 0, -2, 0, -1, 0, 0, 2, 0], [0, -1, 0, 0, -2, 2, 1, -1, -1, 0, -2, -1, 0, 2, 0, 1], [0, -3, 0, -2, -2, 0, 1, -2, 3, 0, -2, -1, 2, -1, 0, -1], [0, 0, 2, -1, 0, 0, 0, 0, -2, 2, -2, 1, -3, 0, -2, 0], [1, 2, 0, 3, 2, 0, 0, 0, 3, 1, 3, 0, 2, 0, -1, 0], [0, -8, 0, -4, -2, 4, -2, 3, 4, 0, -2, -4, 4, -4, 0, 3], [0, -1, 0, 0, -1, 0, 0, 0, -1, 0, -1, 1, -1, 0, 0, 0], [0, -3, 0, 0, -3, 3, 0, -2, 0, 0, -3, -3, 0, -3, 0, -1], [0, 8, 0, 4, 2, -5, -1, -1, -3, 0, 2, 4, -4, 1, 0, 1], [0, -1, 0, -2, -1, 0, 6, 2, 1, 0, -1, 1, 2, 6, 0, 4], [-3, 0, 3, 2, 0, 0, 0, 0, 2, -4, 2, 0, 1, 0, -4, 0], [4, 1, -4, 0, 1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 4, 0], [0, 1, 0, 0, 4, -3, -1, 9, 2, 0, 4, 1, 0, 1, 0, 0], [1, 4, 5, 2, 4, 0, 0, 0, 0, -5, 0, 2, -2, 0, 6, 0], [-6, 4, 0, -1, 4, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, 0], [0, -1, 0, -1, -1, 1, -4, 0, 0, 0, -1, 0, 1, -2, 0, 6], [0, 2, 0, 2, 6, -4, -3, 3, 2, 0, 6, 0, -2, 0, 0, -3], [0, -2, 2, -4, -2, 0, 0, 0, -6, 0, -6, 2, 0, 0, 2, 0], [0, -1, 0, 0, -2, 2, -3, -6, -1, 0, -2, -1, 0, 3, 0, -3], [1, -3, -2, -5, -3, 0, 0, 0, -4, 0, -4, -1, 1, 0, -3, 0], [0, 3, 0, 2, 2, 0, 6, -6, -3, 0, 2, 1, -2, 0, 0, -6], [1, 0, -4, -3, 0, 0, 0, 0, 0, -4, 0, -3, 3, 0, 3, 0], [0, 2, 0, 4, -2, 0, -7, 2, -2, 0, -2, -2, -4, -2, 0, -5], [-4, -3, 2, 3, -3, 0, 0, 0, 3, 8, 3, 0, 3, 0, 0, 0], [0, -8, 0, -4, 0, 4, -4, -4, 4, 0, 0, -4, 4, -8, 0, -8], [0, 2, 0, 0, 0, -2, 6, 1, 0, 0, 0, 2, 0, 6, 0, 2], [-2, 3, 2, 6, 3, 0, 0, 0, 3, 2, 3, 3, 0, 0, 2, 0], [0, 2, 0, 0, -1, 3, -3, -6, -5, 0, -1, 2, 0, 3, 0, 0], [-1, -4, -8, -2, -4, 0, 0, 0, 5, 8, 5, -7, 2, 0, -9, 0], [-5, -3, 0, 3, -3, 0, 0, 0, 0, -4, 0, 3, 3, 0, 2, 0], [0, 2, -4, 0, 2, 0, 0, 0, -2, 0, -2, 2, -4, 0, 4, 0], [0, 2, 0, 2, -2, -4, 12, 4, 2, 0, -2, 0, -2, 0, 0, -4], [0, -11, 0, -6, -7, 6, 7, 5, 5, 0, -7, -5, 6, 5, 0, -2], [0, 1, 0, 0, 2, -2, 4, -4, 1, 0, 2, 1, 0, 8, 0, 4], [2, 7, -4, 4, 7, 0, 0, 0, -6, 0, -6, 10, -10, 0, -9, 0], [0, -6, 0, -8, 2, 4, 6, -6, 2, 0, 2, 2, 8, 6, 0, 0], [-3, 0, 10, 2, 0, 0, 0, 0, 2, 7, 2, 0, 0, 0, 3, 0], [0, 7, 0, 1, 3, -6, -5, -3, -1, 0, 3, 6, -1, -10, 0, -3], [3, -1, 3, 0, -1, 0, 0, 0, -1, 1, -1, 1, 5, 0, -1, 0], [0, 2, 0, 2, 2, 0, 0, 0, -2, -4, -2, 4, -6, 0, 8, 0], [6, -3, -2, -5, -3, 0, 0, 0, 5, -4, 5, -10, 3, 0, 6, 0], [0, -2, 0, 0, -3, 1, 0, 0, 1, 0, -3, -2, 0, 0, 0, 0], [-2, -8, 2, -4, -8, 0, 0, 0, -4, -2, -4, 0, 4, 0, 0, 0], [0, 0, 0, 2, 0, -8, -2, 2, 8, 0, 0, -2, -2, -4, 0, 4], [0, -1, 0, -3, -5, 1, -14, 0, 0, 0, -5, 2, 3, -7, 0, 3], [7, -2, -12, -2, -2, 0, 0, 0, 2, -7, 2, -4, 4, 0, 12, 0], [0, -3, 0, -2, -3, 2, 4, -4, 1, 0, -3, -1, 2, -4, 0, -8], [0, -2, 0, -2, 2, 0, 0, 3, 2, 0, 2, 0, 2, -3, 0, 0], [0, 4, 0, 1, 1, 0, -1, -1, -4, 0, 1, 3, -1, -2, 0, 1], [0, -5, 0, 0, -5, 10, -1, 5, -5, 0, -5, -5, 0, -5, 0, 4], [-10, -3, -2, -11, -3, 0, 0, 0, -11, -12, -11, 0, -3, 0, 10, 0], [-7, 0, -7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0], [0, 12, 0, 2, 8, -8, 0, -2, -4, 0, 8, 10, -2, 0, 0, -1], [8, -4, -4, 6, -4, 0, 0, 0, 5, -8, 5, 1, 5, 0, 0, 0], [0, 0, 0, 6, 3, 3, 3, 0, -3, 0, 3, -6, -6, 3, 0, 0], [-10, 4, 16, 2, 4, 0, 0, 0, 5, -16, 5, -3, -2, 0, 6, 0], [0, 0, 0, -2, 0, 5, 16, -16, -5, 0, 0, 2, 2, 17, 0, -17], [-15, -8, 0, 0, -8, 0, 0, 0, 0, 10, 0, 0, 0, 0, -5, 0], [0, 3, 0, 6, 9, -3, -4, 0, 0, 0, 9, -3, -6, -2, 0, -3], [6, 7, -2, 8, 7, 0, 0, 0, 9, 6, 9, -1, 0, 0, -2, 0], [1, 4, -2, 6, 4, 0, 0, 0, 4, 0, 4, 2, -2, 0, -4, 0], [0, -1, 0, -3, 2, -1, -10, 2, 2, 0, 2, 2, 3, -2, 0, -8], [-2, 1, 11, 7, 1, 0, 0, 0, 7, 9, 7, 0, 1, 0, 2, 0], [0, 16, 0, 8, 4, -8, 2, 3, -8, 0, 4, 8, -8, 4, 0, 3], [0, -5, 0, 1, -7, 7, 0, -10, -2, 0, -7, -6, -1, -9, 0, -5], [0, -2, 11, -2, -2, 0, 0, 0, 3, 7, 3, -5, 7, 0, -14, 0], [6, -1, -6, -8, -1, 0, 0, 0, -7, 1, -7, -1, -3, 0, 1, 0], [8, -8, -2, 2, -8, 0, 0, 0, -2, -6, -2, 4, 8, 0, 8, 0], [0, -3, 0, 0, 7, -10, -8, -6, 13, 0, 7, -3, 0, 8, 0, 0], [0, 0, 0, -5, 0, -3, -9, 9, 3, 0, 0, 5, 5, 0, 0, 0], [-1, -5, 3, 2, -5, 0, 0, 0, 5, 1, 5, -3, 10, 0, -3, 0], [0, 2, 0, 2, 4, -4, 3, -10, 2, 0, 4, 0, -2, 0, 0, 10], [-7, -14, 0, -14, -14, 0, 0, 0, -14, -7, -14, 0, 0, 0, 0, 0], [0, -4, 0, 4, 4, 0, -10, 14, 4, 0, 4, -8, -4, 4, 0, 10], [-4, 0, -3, -13, 0, 0, 0, 0, -13, -3, -13, 0, -13, 0, 7, 0], [0, -16, 0, -2, -7, 14, -5, -9, 2, 0, -7, -14, 2, -10, 0, -9], [0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, -6, 0, -17, 0], [2, 9, -1, 9, 9, 0, 0, 0, 0, -3, 0, 9, 0, 0, 0, 0], [0, 28, 0, 14, 12, -20, 4, 4, -8, 0, 12, 14, -14, 8, 0, 8], [0, -4, 0, -8, -4, 0, -3, 1, 4, 0, -4, 4, 8, -3, 0, 2], [-9, -6, 11, 4, -6, 0, 0, 0, -4, -2, -4, 8, 6, 0, -9, 0], [0, 2, 0, 0, 7, -5, 9, 0, 3, 0, 7, 2, 0, -9, 0, 0], [-3, 16, -4, 8, 16, 0, 0, 0, -3, 4, -3, 11, -8, 0, -7, 0], [0, 0, 0, -6, 0, 7, -4, 4, -7, 0, 0, 6, 6, -14, 0, 14], [0, -9, 0, -9, -11, 18, 0, 6, -9, 0, -11, 0, 9, 0, 0, -6], [-9, -5, 5, 1, -5, 0, 0, 0, 7, -9, 7, -6, 0, 0, 5, 0], [0, 23, 0, 14, 4, -18, 6, 18, -5, 0, 4, 9, -14, -12, 0, 6], [12, 0, -4, 10, 0, 0, 0, 0, 2, -4, 2, 8, -6, 0, -8, 0], [0, 8, 0, 5, 3, -11, 11, 11, 3, 0, 3, 3, -5, -11, 0, 22], [0, -10, 0, -4, -3, 6, 14, 3, 4, 0, -3, -6, 4, 28, 0, 3], [0, -4, 0, -2, -16, 10, 3, 3, -6, 0, -16, -2, 2, 12, 0, 12], [0, -10, -4, -10, -10, 0, 0, 0, -3, 4, -3, -7, 17, 0, -8, 0], [3, 8, 1, 4, 8, 0, 0, 0, -9, -1, -9, 13, -4, 0, 4, 0], [2, 11, 0, 2, 11, 0, 0, 0, 0, 12, 0, 2, 2, 0, -6, 0], [0, -2, 0, -2, -7, 4, 0, -1, -2, 0, -7, 0, 2, 0, 0, 1], [0, 5, 0, 2, 1, -2, -16, -20, -3, 0, 1, 3, -2, -20, 0, -4], [0, 18, 0, 6, 18, -24, -13, -5, 6, 0, 18, 12, -6, -8, 0, -13], [8, -1, -16, 0, -1, 0, 0, 0, 2, 0, 2, -2, 2, 0, -20, 0], [9, 0, -7, 2, 0, 0, 0, 0, 0, -7, 0, 2, -2, 0, -2, 0], [0, -22, 0, -6, -8, 16, 4, 0, 6, 0, -8, -16, 6, 8, 0, 0], [0, -4, 0, 0, -4, 4, 0, -26, 0, 0, -4, -4, 0, 0, 0, -13], [0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, -14, 0, -14], [0, -2, -6, -2, -2, 0, 0, 0, -6, -5, -6, 4, -2, 0, 10, 0], [2, -4, -2, -4, -4, 0, 0, 0, 0, 6, 0, -4, 2, 0, 6, 0], [1, 8, 6, -1, 8, 0, 0, 0, 1, -7, 1, -2, -8, 0, 1, 0], [0, 0, 0, 0, -8, 8, -9, -12, -8, 0, -8, 0, 0, 9, 0, 0], [12, 0, -8, 0, 0, 0, 0, 0, 4, 8, 4, -4, 0, 0, 4, 0], [-14, -7, 8, -6, -7, 0, 0, 0, 7, 14, 7, -13, 14, 0, -8, 0], [0, 26, 0, 14, 16, -14, -15, -12, -12, 0, 16, 12, -14, -12, 0, 3], [0, -3, -8, 2, -3, 0, 0, 0, 7, 0, 7, -5, 0, 0, -8, 0], [0, 4, 0, 6, -10, 4, -14, 2, -8, 0, -10, -2, -6, -16, 0, -14], [0, 1, 0, 1, 1, 0, 5, 23, -1, 0, 1, 0, -1, 28, 0, -5], [0, 3, 0, 0, 3, -6, -6, 6, 3, 0, 3, 3, 0, -6, 0, 0], [7, -5, -3, -2, -5, 0, 0, 0, -2, 4, -2, 0, -5, 0, -7, 0], [2, -8, -1, 4, -8, 0, 0, 0, 6, 12, 6, -2, 6, 0, 0, 0], [0, -6, 0, -3, 6, 0, 6, 6, 6, 0, 6, -3, 3, 21, 0, 21], [0, -9, 0, 2, 1, 10, -6, -6, -1, 0, 1, -11, -2, -6, 0, -12], [12, 9, -10, 0, 9, 0, 0, 0, 0, -2, 0, 0, -9, 0, 12, 0], [0, 0, 0, 1, 0, 12, -16, 16, -12, 0, 0, -1, -1, -5, 0, 5], [15, -1, 2, -1, -1, 0, 0, 0, 1, -15, 1, -2, 2, 0, -2, 0], [0, 10, 0, 6, 8, -6, -4, 16, -4, 0, 8, 4, -6, 16, 0, 20], [-1, 7, 2, 6, 7, 0, 0, 0, -2, 0, -2, 8, -8, 0, 5, 0], [-7, 0, 13, -10, 0, 0, 0, 0, 1, 13, 1, -11, 12, 0, -6, 0], [-8, -2, 2, 2, -2, 0, 0, 0, 2, -6, 2, 0, -2, 0, 8, 0], [0, 40, 0, 16, 12, -24, -6, 6, -16, 0, 12, 24, -16, -12, 0, 6], [-10, 1, 5, -7, 1, 0, 0, 0, -4, -9, -4, -3, -4, 0, 0, 0], [0, 8, -6, 8, 8, 0, 0, 0, 10, -6, 10, -2, -6, 0, 12, 0], [0, 8, 0, 0, 0, -8, -3, -3, 0, 0, 0, 8, 0, -3, 0, -6], [10, -4, -18, -4, -4, 0, 0, 0, 4, 8, 4, -8, 4, 0, 10, 0], [0, -6, 0, 0, 4, -10, 2, 18, 16, 0, 4, -6, 0, -2, 0, 0], [2, -1, -14, -12, -1, 0, 0, 0, 1, -2, 1, -13, 2, 0, 14, 0], [0, -10, 0, -6, -8, 6, -24, -24, 4, 0, -8, -4, 6, -24, 0, 0], [0, 6, 0, 0, 0, 0, -17, -2, -6, 0, 0, 6, 0, -19, 0, 17], [6, 0, 16, -3, 0, 0, 0, 0, -6, 16, -6, 3, -9, 0, -22, 0], [0, -42, 0, -18, -12, 24, 2, 6, 18, 0, -12, -24, 18, 4, 0, 6], [4, -5, 4, 0, -5, 0, 0, 0, -5, -6, -5, 5, 8, 0, 6, 0], [0, 8, 0, 0, 8, -8, 0, -4, 0, 0, 8, 8, 0, 6, 0, -2], [28, -4, -14, -6, -4, 0, 0, 0, -1, -17, -1, -5, -1, 0, 0, 0], [0, -13, 0, -14, -7, 6, 6, -4, 7, 0, -7, 1, 14, 6, 0, -8], [2, 14, -5, 7, 14, 0, 0, 0, -3, 5, -3, 10, -7, 0, -3, 0], [0, 0, 0, 6, 0, 10, -1, 1, -10, 0, 0, -6, -6, -8, 0, 8], [18, -9, 0, -2, -9, 0, 0, 0, 0, 4, 0, -2, -2, 0, -2, 0], [0, -19, 0, -12, -5, 19, 14, 0, 0, 0, -5, -7, 12, 7, 0, -9], [-7, 23, 4, 19, 23, 0, 0, 0, 15, -7, 15, 4, 0, 0, 4, 0], [0, 20, 0, 8, 16, -24, 14, 1, 4, 0, 16, 12, -8, 13, 0, 14], [12, -10, -24, -18, -10, 0, 0, 0, -16, 0, -16, -2, 2, 0, 16, 0], [0, 11, 0, 1, 1, 0, 10, 4, -11, 0, 1, 10, -1, 14, 0, -10], [-52, 8, 26, 0, 8, 0, 0, 0, -4, 2, -4, 4, -4, 0, 0, 0], [0, -28, 0, -14, -28, 28, 8, 8, 0, 0, -28, -14, 14, 4, 0, 4], [-18, -5, 18, -2, -5, 0, 0, 0, 3, 8, 3, -5, 4, 0, 8, 0], [0, -2, 0, 0, -12, 10, 8, -3, -8, 0, -12, -2, 0, -8, 0, 0], [18, 12, 0, -4, 12, 0, 0, 0, 0, -14, 0, -4, -4, 0, 7, 0], [0, -10, 0, -8, -6, 10, -36, 0, 0, 0, -6, -2, 8, -18, 0, -6], [0, 14, 0, 14, 6, -28, -6, -6, 14, 0, 6, 0, -14, 0, 0, 6], [0, -14, 0, -4, 2, 4, 23, 19, 10, 0, 2, -10, 4, 19, 0, -4], [-5, 0, 8, -3, 0, 0, 0, 0, 1, 8, 1, -4, 5, 0, -3, 0], [0, -10, 0, -2, -8, 18, 6, 6, -8, 0, -8, -8, 2, -6, 0, 12], [0, 14, 0, -2, 8, -16, 10, 3, 2, 0, 8, 16, 2, 20, 0, 3], [0, -16, 0, -10, 4, -4, 0, -20, 20, 0, 4, -6, 10, 6, 0, -10], [0, 4, -5, 4, 4, 0, 0, 0, -9, 11, -9, 13, -17, 0, -22, 0], [5, 8, -5, 14, 8, 0, 0, 0, 6, 8, 6, 8, -1, 0, 8, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_78_k_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_78_2_k_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_78_2_k_a(:prec:=16)
    chi := MakeCharacter_78_k();
    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_78_2_k_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_78_2_k_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_78_k();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([],Snew);
    return Vf;
end function;