
// Make newform 209.2.g.a in Magma, downloaded from the LMFDB on 02 May 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_209_g();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_209_g_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_209_2_g_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_209_2_g_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 := [1, 3, 4, 9, 12, -12, 8, 54, -19, -54, 8, 12, 12, -9, 4, -3, 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], [135736, 100551, -471583, -237070, 2111597, 684999, -2815805, -514921, 1397358, 377125, -250237, -283119, 171765, -108454, 76377, -19847], [-69666, 500449, -258847, -731745, 1946528, 264166, -2237325, -623429, 1593597, 162990, -183688, -332721, 202015, -115771, 79218, -21208], [-205276, -168671, -1210977, -230500, 2207013, -2220369, -3330135, 3887741, 748652, 173945, -1600673, 553139, -207225, 129284, 11713, -22643], [-19679, -673519, -867618, 624555, 88407, -2826971, 38895, 1344174, 2123643, -1214825, -240697, -430499, 322290, -98349, 82317, -34192], [191488, 475093, 220671, -263655, 276596, 2278562, 2526495, -2608403, -2836021, 748670, 941884, 469003, -408215, 148803, -141874, 55054], [192341, -468039, 790322, 2132655, -3714833, -413791, 5948095, -1018106, -3218297, -501825, 1245343, 391521, -331410, 181331, -170743, 56068], [11676, 266026, -1357223, 1403805, 3181047, -5730056, 861570, 6239879, -5133577, 950525, -1803462, 2762636, -1635885, 830371, -379863, 83098], [-33776, 98039, 1289343, 1036200, -1634117, -744229, 5035115, 1303481, -6458168, 934695, 186407, 1924749, -1244025, 596044, -363917, 103957], [-83737, -123837, -121389, -392175, 191136, 246342, -1501395, 198477, 1415739, -130410, -246431, -373527, 266925, -126177, 85866, -26616], [-531, 1233, 729, 3816, -234, -17037, 22167, 18927, -30294, 2844, -3321, 11727, -7137, 3618, -1926, 478], [-308024, -268359, -1100613, -3200925, 3051702, 1201164, -10395565, 2407289, 7721813, -129720, -2141342, -1629909, 1248325, -598939, 457072, -147732], [87394, 39869, 1059453, 2270950, -2576607, -2300809, 11295465, 353051, -10252778, 558845, 1277447, 2797479, -1893075, 928474, -607507, 178467], [224612, 34122, 847479, 2758455, -1707591, -3415512, 10655430, 1094213, -10279479, 652455, 1000886, 3031272, -2035935, 1001137, -631401, 182146], [464422, 234502, -42006, 3382275, -925631, -5421357, 9634620, 3546558, -10588719, 736435, 231801, 3548042, -2304400, 1153017, -675361, 184371], [57702, 80268, 71115, 248223, -188829, 116440, 1044576, -279663, -1099575, 156117, 206304, 261750, -189891, 85953, -61635, 19914]];
    Rf_basisdens := [1, 171100, 171100, 171100, 171100, 171100, 171100, 171100, 171100, 42775, 590, 171100, 171100, 171100, 171100, 17110];
    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_209_g();"
function MakeCharacter_209_g()
    N := 209;
    order := 6;
    char_gens := [134, 78];
    v := [3, 1];
    // 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_209_g_Hecke();"
function MakeCharacter_209_g_Hecke(Kf)
    N := 209;
    order := 6;
    char_gens := [134, 78];
    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, 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, -1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0], [1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, -1, 0], [0, 1, 1, -1, 0, -2, 0, 0, -1, 0, 0, 1, 2, 0, 0, 0], [0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, -1, -2, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, -1, 0], [1, 0, 0, 0, 0, 0, -2, -1, 0, 2, 0, 0, 0, 0, 0, 0], [0, -1, -1, 1, 0, 6, 0, 0, 1, 0, 0, -3, -2, 0, 2, 0], [1, 0, 0, 0, -2, 0, 2, 2, 0, 0, -1, 0, 0, 0, 0, -2], [2, 0, 0, 0, 0, 0, -1, -1, 0, 4, 1, 0, 0, 0, 0, 2], [0, 2, -1, -1, 0, 0, 0, 0, 4, 0, 0, 1, -2, 0, -1, 0], [0, -2, -1, 3, 0, -2, 0, 0, 0, 0, 0, -1, 0, 0, -3, 0], [1, 0, 0, 0, 0, 0, -2, -1, 0, 2, 0, 0, 0, 0, 0, 0], [-2, 0, 0, 0, 4, 0, 0, 0, 0, -3, 0, 0, 0, -4, 0, 0], [1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 2, 0, 0, 0, 0, -2], [0, 2, 4, 4, 0, 0, 0, 0, 2, 0, 0, -1, 0, 0, 3, 0], [-7, 0, 0, 0, -2, 0, 0, 1, 0, -3, -2, 0, 0, 2, 0, -1], [2, 0, 0, 0, 0, 0, 1, 0, 0, -3, -1, 0, 0, -2, 0, 1], [0, 1, 2, 1, 0, -2, 0, 0, 0, 0, 0, 2, 3, 0, -1, 0], [0, 0, -3, -6, 0, -2, 0, 0, -4, 0, 0, 3, 2, 0, -6, 0], [0, -4, -1, 6, 0, 8, 0, 0, 2, 0, 0, -5, -2, 0, 5, 0], [3, 0, 0, 0, -4, 0, 0, 1, 0, 3, -2, 0, 0, 4, 0, -1], [-1, 0, 0, 0, 0, 0, 0, 0, 0, 1, -2, 0, 0, 4, 0, 2], [0, -1, -1, -1, 0, 2, 0, 0, 3, 0, 0, -1, 0, 0, -2, 0], [-5, 0, 0, 0, 2, 0, 0, 0, 0, -8, 3, 0, 0, 0, 0, 6], [0, 0, 1, 2, 0, 0, 0, 0, 2, 0, 0, -1, 2, 0, -1, 0], [0, -1, 4, 3, 0, 2, 0, 0, 2, 0, 0, -4, -1, 0, 3, 0], [-4, 0, 0, 0, -4, 0, 4, 4, 0, -12, 0, 0, 0, 0, 0, 0], [0, -2, 0, 0, 0, 6, 0, 0, 2, 0, 0, -1, -4, 0, 1, 0], [0, -4, 5, -1, 0, -2, 0, 0, 0, 0, 0, 5, -2, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, -2], [0, 0, -1, -1, 0, -2, 0, 0, -4, 0, 0, 4, 0, 0, 3, 0], [0, -1, -4, 7, 0, -2, 0, 0, 0, 0, 0, -4, 1, 0, -7, 0], [0, 4, -1, -4, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 3, 0], [5, 0, 0, 0, 0, 0, -2, -4, 0, 7, 4, 0, 0, 0, 0, 4], [6, 0, 0, 0, 0, 0, -4, 4, 0, 0, 2, 0, 0, 0, 0, 0], [0, 0, -3, 3, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, -5, 0], [0, -5, 0, 3, 0, 6, 0, 0, 2, 0, 0, 0, -1, 0, 3, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 4], [8, 0, 0, 0, 4, 0, 0, -2, 0, 3, 0, 0, 0, -4, 0, 0], [-8, 0, 0, 0, 4, 0, 2, -2, 0, -4, 6, 0, 0, -8, 0, 0], [0, 5, 2, -1, 0, -6, 0, 0, -2, 0, 0, -2, 1, 0, -1, 0], [0, -2, -2, 5, 0, 4, 0, 0, 3, 0, 0, -3, -3, 0, 3, 0], [-1, 0, 0, 0, -2, 0, 6, 3, 0, -7, 0, 0, 0, -2, 0, 1], [0, 4, -7, -2, 0, -6, 0, 0, -4, 0, 0, 7, 2, 0, -2, 0], [6, 0, 0, 0, 0, 0, -5, 0, 0, -1, -1, 0, 0, 6, 0, 1], [0, 4, -9, -6, 0, 0, 0, 0, -2, 0, 0, -3, -2, 0, -3, 0], [-4, 0, 0, 0, 0, 0, 3, -3, 0, 0, -5, 0, 0, 0, 0, 0], [0, -1, 4, -1, 0, -2, 0, 0, 0, 0, 0, 4, 1, 0, 1, 0], [0, 0, -1, 4, 0, 0, 0, 0, 0, 0, 0, -3, 0, 0, 3, 0], [0, 2, 0, 0, 0, 4, 0, 0, -2, 0, 0, -5, 4, 0, 5, 0], [5, 0, 0, 0, -6, 0, 2, 1, 0, -3, 0, 0, 0, -6, 0, -5], [2, 0, 0, 0, 4, 0, 0, 0, 0, -1, 4, 0, 0, -4, 0, 2], [0, 0, 11, -2, 0, -2, 0, 0, 0, 0, 0, 11, 2, 0, 2, 0], [-3, 0, 0, 0, 0, 0, 4, 0, 0, -1, 0, 0, 0, 4, 0, 0], [0, 8, -5, 2, 0, -2, 0, 0, 0, 0, 0, -5, 10, 0, -2, 0], [0, -6, 2, 5, 0, 12, 0, 0, -1, 0, 0, -7, 1, 0, 7, 0], [0, 6, 0, 0, 0, -8, 0, 0, -6, 0, 0, 3, 12, 0, -3, 0], [0, -8, 7, 0, 0, -6, 0, 0, 0, 0, 0, 7, -2, 0, 0, 0], [0, 0, -6, 1, 0, 0, 0, 0, -3, 0, 0, -7, -3, 0, -7, 0], [0, 8, -3, 0, 0, -6, 0, 0, 4, 0, 0, 3, -2, 0, 0, 0], [10, 0, 0, 0, 0, 0, -2, 2, 0, 0, 0, 0, 0, 0, 0, 0], [-2, 0, 0, 0, 0, 0, 4, 2, 0, -5, 0, 0, 0, 0, 0, 10], [-9, 0, 0, 0, 0, 0, 0, -3, 0, -3, -6, 0, 0, 0, 0, -3], [8, 0, 0, 0, -4, 0, -4, -4, 0, 12, -2, 0, 0, 0, 0, -4], [0, 2, -1, -1, 0, 0, 0, 0, 4, 0, 0, 1, -2, 0, -1, 0], [0, -4, 3, -4, 0, -2, 0, 0, 0, 0, 0, 3, -2, 0, 4, 0], [0, -2, 4, -1, 0, 4, 0, 0, 9, 0, 0, -3, -9, 0, 3, 0], [-12, 0, 0, 0, 4, 0, 5, -5, 0, -4, 5, 0, 0, -8, 0, 0], [0, 2, -3, -2, 0, -2, 0, 0, 0, 0, 0, -3, 4, 0, 2, 0], [1, 0, 0, 0, 0, 0, -2, -1, 0, 2, 0, 0, 0, 0, 0, 0], [0, 8, -8, -8, 0, 0, 0, 0, -2, 0, 0, 0, -2, 0, 0, 0], [1, 0, 0, 0, -2, 0, -12, -12, 0, 0, -3, 0, 0, 0, 0, -6], [-8, 0, 0, 0, 0, 0, 1, 0, 0, 7, -3, 0, 0, 10, 0, 3], [-6, 0, 0, 0, 4, 0, 4, 2, 0, 5, 0, 0, 0, 4, 0, 4], [-1, 0, 0, 0, -8, 0, -2, -4, 0, 1, -10, 0, 0, 4, 0, -10], [2, 0, 0, 0, 0, 0, -5, 0, 0, 3, 5, 0, 0, -4, 0, -5], [0, 1, -3, 3, 0, 6, 0, 0, -1, 0, 0, -7, 2, 0, 4, 0], [-9, 0, 0, 0, -2, 0, -6, 6, 0, 2, -1, 0, 0, 4, 0, 0], [-1, 0, 0, 0, 0, 0, 2, 0, 0, -1, 6, 0, 0, -8, 0, -6], [0, 0, -1, 1, 0, 14, 0, 0, 0, 0, 0, -8, 0, 0, 7, 0], [-9, 0, 0, 0, 0, 0, 0, 1, 0, -5, -2, 0, 0, 0, 0, -1], [0, 18, -9, -10, 0, -22, 0, 0, -8, 0, 0, 9, 4, 0, -10, 0], [1, 0, 0, 0, 0, 0, -2, -1, 0, 16, 0, 0, 0, 0, 0, -2], [-4, 0, 0, 0, 4, 0, 3, 3, 0, -4, -1, 0, 0, 0, 0, -2], [0, 0, -6, -2, 0, 0, 0, 0, 2, 0, 0, 8, -2, 0, -8, 0], [0, -4, 5, -1, 0, 0, 0, 0, 0, 0, 0, 5, -4, 0, 1, 0], [-4, 0, 0, 0, 4, 0, 0, 0, 0, -4, 4, 0, 0, -8, 0, 0], [6, 0, 0, 0, 0, 0, 2, -2, 0, 0, -4, 0, 0, 0, 0, 0], [0, 6, -4, -4, 0, -6, 0, 0, -6, 0, 0, -5, 0, 0, -9, 0], [2, 0, 0, 0, -8, 0, 8, 8, 0, -4, -4, 0, 0, 0, 0, -8], [0, -6, -3, -6, 0, 6, 0, 0, 0, 0, 0, -3, -12, 0, 6, 0], [22, 0, 0, 0, -12, 0, 3, 6, 0, 19, -11, 0, 0, 6, 0, -11], [0, 4, 6, 6, 0, 2, 0, 0, 8, 0, 0, -1, 0, 0, 5, 0], [-4, 0, 0, 0, 8, 0, 0, 2, 0, -7, -4, 0, 0, -8, 0, -2], [-12, 0, 0, 0, 12, 0, -1, -1, 0, -12, 3, 0, 0, 0, 0, 6], [0, 2, -3, 3, 0, -6, 0, 0, -2, 0, 0, -8, 4, 0, 5, 0], [0, -7, -3, -3, 0, 6, 0, 0, 5, 0, 0, 7, 0, 0, 4, 0], [0, -4, 3, -3, 0, 10, 0, 0, 4, 0, 0, 0, -8, 0, 3, 0], [0, 3, -15, -15, 0, -10, 0, 0, -17, 0, 0, 9, 0, 0, -6, 0], [0, -12, 5, 8, 0, 0, 0, 0, 0, 0, 0, -3, 0, 0, -3, 0], [0, -8, 6, 9, 0, 0, 0, 0, 1, 0, 0, -3, 1, 0, -3, 0], [0, 4, 9, -10, 0, -8, 0, 0, -2, 0, 0, 1, 2, 0, -1, 0], [8, 0, 0, 0, 4, 0, 1, -1, 0, -4, -11, 0, 0, -8, 0, 0], [-5, 0, 0, 0, -8, 0, 1, 2, 0, -6, 2, 0, 0, 4, 0, 2], [0, -9, 1, 1, 0, 10, 0, 0, 11, 0, 0, 5, 0, 0, 6, 0], [-29, 0, 0, 0, 2, 0, 0, -1, 0, -15, -6, 0, 0, -2, 0, -3], [0, 0, 0, -2, 0, 0, 0, 0, -4, 0, 0, 2, -4, 0, 2, 0], [0, -8, 12, 14, 0, 0, 0, 0, 2, 0, 0, -2, 2, 0, -2, 0], [0, 4, 9, 1, 0, -12, 0, 0, 0, 0, 0, 9, 16, 0, -1, 0], [-6, 0, 0, 0, 0, 0, 12, 6, 0, 13, 0, 0, 0, 0, 0, 4], [11, 0, 0, 0, -2, 0, 2, -2, 0, 2, 3, 0, 0, 4, 0, 0], [-9, 0, 0, 0, 8, 0, 2, 1, 0, -12, 0, 0, 0, 8, 0, 4], [9, 0, 0, 0, 0, 0, -12, 0, 0, 3, -8, 0, 0, 8, 0, 8], [-3, 0, 0, 0, 16, 0, 3, 6, 0, -6, 4, 0, 0, -8, 0, 4], [14, 0, 0, 0, 0, 0, 8, -8, 0, 0, 2, 0, 0, 0, 0, 0], [-20, 0, 0, 0, 4, 0, 0, 0, 0, -4, 10, 0, 0, -8, 0, 0], [0, 0, -3, 3, 0, -10, 0, 0, 0, 0, 0, 10, 0, 0, -13, 0], [-16, 0, 0, 0, 8, 0, 0, -2, 0, -11, 12, 0, 0, -8, 0, 6], [0, 8, -14, -7, 0, 0, 0, 0, -7, 0, 0, -7, -7, 0, -7, 0], [0, 0, 4, 1, 0, 0, 0, 0, -3, 0, 0, 3, -3, 0, 3, 0], [6, 0, 0, 0, 0, 0, -2, -2, 0, 12, -6, 0, 0, 0, 0, -12], [9, 0, 0, 0, 2, 0, 2, -2, 0, -2, -3, 0, 0, -4, 0, 0], [0, 8, 1, -5, 0, 0, 0, 0, 0, 0, 0, 1, 8, 0, 5, 0], [-10, 0, 0, 0, 8, 0, 4, 2, 0, -5, 0, 0, 0, 8, 0, 6], [18, 0, 0, 0, -20, 0, -1, -2, 0, 19, -3, 0, 0, 10, 0, -3], [2, 0, 0, 0, 12, 0, 1, 2, 0, 1, 5, 0, 0, -6, 0, 5], [0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, -6, 0, 0, 6, 0], [0, -2, -1, -5, 0, 2, 0, 0, 0, 0, 0, -1, -4, 0, 5, 0], [0, 10, -17, -14, 0, -18, 0, 0, -16, 0, 0, 17, 8, 0, -14, 0], [-5, 0, 0, 0, 0, 0, 0, 3, 0, -4, -4, 0, 0, 0, 0, -2], [-12, 0, 0, 0, 0, 0, 1, 2, 0, -13, 9, 0, 0, 0, 0, 9], [0, 2, -10, -1, 0, -4, 0, 0, 5, 0, 0, 11, -5, 0, -11, 0], [0, -4, -14, -14, 0, 0, 0, 0, -4, 0, 0, -1, 0, 0, -15, 0], [-13, 0, 0, 0, -4, 0, 0, -7, 0, -1, -2, 0, 0, 4, 0, -1], [0, 4, -11, -6, 0, 0, 0, 0, -2, 0, 0, -5, -2, 0, -5, 0], [14, 0, 0, 0, 0, 0, -7, -7, 0, 28, -1, 0, 0, 0, 0, -2], [0, 0, -4, -4, 0, 0, 0, 0, -4, 0, 0, 8, 4, 0, -8, 0], [0, -4, -7, 7, 0, 6, 0, 0, 4, 0, 0, -14, -8, 0, 7, 0], [0, 4, -12, -12, 0, -12, 0, 0, -20, 0, 0, 1, 0, 0, -11, 0], [7, 0, 0, 0, 0, 0, -14, -7, 0, -12, 0, 0, 0, 0, 0, -4], [0, 8, 10, -10, 0, -10, 0, 0, -8, 0, 0, 15, 16, 0, -5, 0], [-4, 0, 0, 0, -4, 0, 0, 0, 0, -12, 0, 0, 0, 0, 0, 0], [12, 0, 0, 0, 0, 0, -5, 0, 0, -7, 5, 0, 0, -14, 0, -5], [0, 2, 7, 5, 0, -4, 0, 0, 0, 0, 0, 7, 6, 0, -5, 0], [0, -2, 3, 13, 0, 4, 0, 0, 4, 0, 0, -3, -2, 0, 13, 0], [-1, 0, 0, 0, -2, 0, 6, 3, 0, 1, 0, 0, 0, -2, 0, -11], [25, 0, 0, 0, -10, 0, -6, -6, 0, 40, -1, 0, 0, 0, 0, -2], [0, 1, 14, 5, 0, 2, 0, 0, 6, 0, 0, -14, -3, 0, 5, 0], [-8, 0, 0, 0, 0, 0, 4, -4, 0, 0, -2, 0, 0, 0, 0, 0], [9, 0, 0, 0, -8, 0, -2, -1, 0, 0, 0, 0, 0, -8, 0, -2], [0, 6, 1, -1, 0, 2, 0, 0, -6, 0, 0, -12, 12, 0, 13, 0], [0, 0, 0, 0, 0, 0, -13, 0, 0, 13, -3, 0, 0, -2, 0, 3], [-17, 0, 0, 0, 10, 0, 6, 6, 0, -24, 5, 0, 0, 0, 0, 10], [0, -4, -1, 8, 0, 8, 0, 0, 8, 0, 0, -7, -8, 0, 7, 0], [-8, 0, 0, 0, 8, 0, 1, 2, 0, -9, -7, 0, 0, -4, 0, -7], [0, -9, 1, 1, 0, 2, 0, 0, -5, 0, 0, -11, 0, 0, -10, 0], [0, 4, 8, -8, 0, -20, 0, 0, -4, 0, 0, 9, 8, 0, -1, 0], [-20, 0, 0, 0, 4, 0, -1, -2, 0, -19, 7, 0, 0, -2, 0, 7], [0, -13, 8, 23, 0, 14, 0, 0, 2, 0, 0, -8, -1, 0, 23, 0], [0, 8, -9, 8, 0, 10, 0, 0, 0, 0, 0, -9, -2, 0, -8, 0], [-13, 0, 0, 0, 0, 0, 9, 0, 0, 4, -4, 0, 0, 8, 0, 4], [6, 0, 0, 0, -8, 0, 13, 13, 0, 4, -1, 0, 0, 0, 0, -2], [0, 0, 0, 0, 0, 0, 3, 0, 0, -3, -7, 0, 0, 18, 0, 7], [-3, 0, 0, 0, 0, 0, 7, 0, 0, -4, 2, 0, 0, -4, 0, -2], [0, 6, 0, 0, 0, -12, 0, 0, -18, 0, 0, -5, 0, 0, -5, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_209_g_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_209_2_g_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_209_2_g_a(:prec:=16)
    chi := MakeCharacter_209_g();
    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_209_2_g_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_209_2_g_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_209_g();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<2,R![1, 0, 17, 0, 245, 0, 722, 0, 1714, 0, 538, 0, 125, 0, 13, 0, 1]>],Snew);
    return Vf;
end function;