
// Make newform 108.3.f.c in Magma, downloaded from the LMFDB on 25 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_108_f();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_108_f_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_108_3_f_c();".
// 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_108_3_f_c();".
// 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 := [65536, -49152, 28672, -30720, 19456, -9216, 6784, -3648, 1552, -912, 424, -144, 76, -30, 7, -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], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-1228800, 634880, -258048, 372736, -187904, 58368, -63104, 26384, -7664, 6280, -2224, 204, -394, 83, 17, 1], [-1228800, 634880, 282624, 372736, -187904, 58368, -63104, 26384, -7664, 6280, -2224, 204, -394, 83, 17, 1], [786432, 1224704, 385024, -178176, -111104, -83200, 41344, 20560, 11600, -3544, -2512, -692, 158, 375, 45, 13], [16384, 294912, -151552, 56832, -88320, 44672, -12896, 14864, -6208, 1688, -1464, 520, -32, 91, -19, -5], [679936, -647168, 553472, -226560, 209536, -130336, 60224, -33024, 19392, -6112, 3572, -1454, 366, -211, 97, 7], [-819200, 32768, -36864, 120832, -13568, 9344, -18016, 2512, -1472, 1752, -280, 136, -72, 15, -7, -25], [-16384, -2682880, 1638400, -749568, 648704, -429056, 177280, -128208, 59184, -25448, 13168, -5404, 1506, -839, 371, -61], [4472832, -2527232, 2285568, -1656832, 796160, -506112, 303872, -128816, 67856, -34264, 11728, -5220, 2374, -545, 181, -67], [393216, 20480, -49152, -83968, 5120, 8448, 10112, 1040, -1264, -1336, -176, 156, 118, 11, -23, -7], [892928, 212992, 458752, -374784, 42752, -92032, 74560, -13680, 17712, -8632, 2272, -1844, 786, -73, 125, -47], [712704, 10240, 182784, -270592, 51200, -62112, 54848, -14912, 10496, -7312, 1612, -942, 610, -95, 37, -25], [-1220608, 1007616, -739328, 539136, -343296, 201088, -124816, 60304, -29864, 14560, -6300, 2642, -1015, 365, -119, 26], [2965504, 77824, 999424, -1140736, 237056, -231424, 218880, -51696, 44112, -26936, 4912, -4484, 2414, -205, 257, -135], [3080192, -1552384, 2011136, -1593344, 804352, -595968, 377472, -150928, 98160, -49352, 17456, -8940, 3994, -811, 487, -137]];
    Rf_basisdens := [1, 1, 540672, 540672, 540672, 135168, 135168, 270336, 540672, 540672, 49152, 270336, 135168, 135168, 540672, 540672];
    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_108_f();"
function MakeCharacter_108_f()
    N := 108;
    order := 6;
    char_gens := [55, 29];
    v := [3, 4];
    // 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_108_f_Hecke();"
function MakeCharacter_108_f_Hecke(Kf)
    N := 108;
    order := 6;
    char_gens := [55, 29];
    char_values := [[-1, 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]];
    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 := 3;
    raw_aps := [[0, 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, 0, 0, 0, 0, 0, 0], [0, 0, -1, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, -1, -1, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 1, 0, 0, 0, -1, 1, 1, 0, -1, -1], [0, 1, -5, -1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 1, -3, -1, 1, 0, 3, 0, 1, 0, 0, 0, 0, 0, -2], [0, 3, 3, -2, -3, 4, 0, -2, -1, 3, -1, 2, 0, -1, 0, 1], [0, -5, -2, -1, 0, -5, 2, -1, 2, -2, 0, 0, -1, 2, 1, 0], [-7, 3, 7, 0, 0, 0, -2, 0, 0, 0, -2, 0, 3, 0, 0, 3], [0, -11, -6, 1, 0, -11, 0, 1, 0, -6, 0, 0, 1, 0, 3, 0], [-4, 6, 6, -1, -6, -11, 0, 1, -3, 6, -3, 0, 0, 3, 0, 5], [0, -7, -13, 3, 0, -7, 3, -3, -3, 2, 0, 0, -3, 3, 0, 0], [0, 6, 0, 0, 6, 0, -2, 0, 0, 0, 2, 5, 0, 0, -5, -6], [0, 2, 0, 0, -4, 0, -3, 0, 0, 0, 3, -3, 6, 0, 3, -2], [8, -4, -4, 3, 4, 5, 0, -3, 1, -4, 1, 0, 0, -1, 0, -1], [0, 10, 8, -6, 0, 10, -6, -6, -6, 8, 0, 0, -6, -6, -3, 0], [7, -25, -7, 0, 6, 0, 12, 0, 0, 0, 12, 0, -7, 0, 0, -13], [0, 3, 6, -9, 0, 3, 1, -9, 1, 6, 0, 0, -9, 1, -11, 0], [0, 4, 4, -5, -4, 3, 0, -5, -5, 4, -5, -22, 0, -5, 0, -1], [-4, 3, 3, 5, -3, -11, 0, -5, 12, 3, 12, 0, 0, -12, 0, 8], [0, 11, 0, 0, 6, 0, -4, 0, 0, 0, 4, -11, 5, 0, 11, -11], [0, -5, 0, 0, 21, 0, 1, 0, 0, 0, -1, 1, -26, 0, -1, 5], [12, 4, 4, 9, -4, -17, 0, -9, -3, 4, -3, 0, 0, 3, 0, 13], [-17, 1, 17, 0, 0, 0, -9, 0, 0, 0, -9, 0, 1, 0, 0, 1], [51, -18, -51, 0, 4, 0, 3, 0, 0, 0, 3, 0, -6, 0, 0, -10], [0, -20, -24, 28, 0, -20, -3, 28, -3, -24, 0, 0, 28, -3, 9, 0], [0, -5, -5, -8, 5, -18, 0, -8, 7, -5, 7, 26, 0, 7, 0, -13], [32, 0, 0, -7, 0, 7, 0, 7, -9, 0, -9, 0, 0, 9, 0, -7], [0, 6, -34, -12, 0, 6, -1, 12, 1, 3, 0, 0, 12, -1, 0, 0], [0, -18, -18, 0, 18, -36, 0, 0, -6, -18, -6, 12, 0, -6, 0, -18], [0, -8, 3, -14, 0, -8, 13, -14, 13, 3, 0, 0, -14, 13, 23, 0], [-91, -3, 91, 0, 0, 0, -17, 0, 0, 0, -17, 0, -3, 0, 0, -3], [0, 12, 24, -36, 0, 12, -2, -36, -2, 24, 0, 0, -36, -2, -5, 0], [0, -39, 17, -9, 0, -39, 2, 9, -2, 24, 0, 0, 9, 2, 0, 0], [0, -13, 0, 0, -36, 0, 8, 0, 0, 0, -8, -35, 23, 0, 35, 13], [0, -2, 25, -22, 0, -2, -21, 22, 21, 12, 0, 0, 22, -21, 0, 0], [0, 6, 6, -4, -6, 8, 0, -4, -8, 6, -8, 16, 0, -8, 0, 2], [0, -32, -22, 12, 0, -32, 9, 12, 9, -22, 0, 0, 12, 9, -21, 0], [95, 54, -95, 0, -18, 0, -5, 0, 0, 0, -5, 0, 0, 0, 0, 18], [0, -32, -32, 34, 32, -30, 0, 34, -14, -32, -14, 20, 0, -14, 0, 2], [-52, -24, -24, 27, 24, 21, 0, -27, 3, -24, 3, 0, 0, -3, 0, 3], [0, 26, 0, 0, 2, 0, 15, 0, 0, 0, -15, -39, 24, 0, 39, -26], [0, -53, -29, 29, 0, -53, -3, -29, 3, 12, 0, 0, -29, -3, 0, 0], [-42, 28, 28, -24, -28, -32, 0, 24, 6, 28, 6, 0, 0, -6, 0, 4], [0, -30, -30, 27, 30, -33, 0, 27, -3, -30, -3, -42, 0, -3, 0, -3], [0, 95, 57, -19, 0, 95, 2, -19, 2, 57, 0, 0, -19, 2, -13, 0], [0, -38, 0, 0, 6, 0, -15, 0, 0, 0, 15, -9, -44, 0, 9, 38], [0, -9, 0, 0, 16, 0, -25, 0, 0, 0, 25, 29, -25, 0, -29, 9], [0, 4, 115, 8, 0, 4, 15, -8, -15, -6, 0, 0, -8, 15, 0, 0], [102, -23, -23, 18, 23, 28, 0, -18, -21, -23, -21, 0, 0, 21, 0, -5], [0, -65, -28, -9, 0, -65, -30, -9, -30, -28, 0, 0, -9, -30, 9, 0], [-119, 98, 119, 0, -30, 0, 30, 0, 0, 0, 30, 0, 8, 0, 0, 38], [0, 57, 57, 0, -57, 114, 0, 0, -3, 57, -3, -18, 0, -3, 0, 57], [0, -78, -127, 18, 0, -78, 14, -18, -14, 30, 0, 0, -18, 14, 0, 0], [0, 1, 0, 0, -18, 0, -14, 0, 0, 0, 14, -17, 19, 0, 17, -1], [-132, -26, -26, 21, 26, 31, 0, -21, -21, -26, -21, 0, 0, 21, 0, -5], [0, -30, -30, 38, 30, -22, 0, 38, 22, -30, 22, 28, 0, 22, 0, 8], [-35, 16, 35, 0, -18, 0, -45, 0, 0, 0, -45, 0, -38, 0, 0, -20], [-139, 132, 139, 0, -39, 0, 4, 0, 0, 0, 4, 0, 15, 0, 0, 54], [0, 14, -15, 44, 0, 14, -19, 44, -19, -15, 0, 0, 44, -19, -43, 0], [0, 66, 107, -18, 0, 66, 23, 18, -23, -24, 0, 0, 18, 23, 0, 0], [0, -9, -9, 12, 9, -6, 0, 12, 3, -9, 3, 66, 0, 3, 0, 3], [0, 109, 64, -19, 0, 109, 8, -19, 8, 64, 0, 0, -19, 8, -35, 0], [-47, -28, 47, 0, 12, 0, 6, 0, 0, 0, 6, 0, 8, 0, 0, -4], [149, 3, -149, 0, -6, 0, -32, 0, 0, 0, -32, 0, -15, 0, 0, -9], [0, -38, 0, 0, -51, 0, 18, 0, 0, 0, -18, -75, 13, 0, 75, 38], [0, 98, -41, -38, 0, 98, -78, 38, 78, -30, 0, 0, 38, -78, 0, 0], [0, -89, -58, 27, 0, -89, 21, 27, 21, -58, 0, 0, 27, 21, -81, 0], [109, -92, -109, 0, 42, 0, 21, 0, 0, 0, 21, 0, 34, 0, 0, -8], [-75, -171, 75, 0, 40, 0, -15, 0, 0, 0, -15, 0, -51, 0, 0, -91], [0, 88, 88, -62, -88, 114, 0, -62, -32, 88, -32, 8, 0, -32, 0, 26], [0, 39, 0, 0, 60, 0, 46, 0, 0, 0, -46, 65, -21, 0, -65, -39], [0, 47, -5, -23, 0, 47, 66, 23, -66, -12, 0, 0, 23, 66, 0, 0], [0, 33, 33, 39, -33, 105, 0, 39, -48, 33, -48, -96, 0, -48, 0, 72], [0, 16, -12, 40, 0, 16, 13, 40, 13, -12, 0, 0, 40, 13, 59, 0], [147, 156, -147, 0, -50, 0, -39, 0, 0, 0, -39, 0, 6, 0, 0, 56], [-184, 84, 84, -19, -84, -149, 0, 19, -33, 84, -33, 0, 0, 33, 0, 65], [0, 63, -469, -27, 0, 63, -19, 27, 19, -18, 0, 0, 27, -19, 0, 0], [0, 76, 73, 20, 0, 76, -6, -20, 6, -48, 0, 0, -20, -6, 0, 0], [0, 55, 9, 37, 0, 55, 4, 37, 4, 9, 0, 0, 37, 4, 89, 0], [151, -67, -151, 0, 24, 0, -24, 0, 0, 0, -24, 0, 5, 0, 0, -19], [0, -100, -100, 98, 100, -102, 0, 98, -4, -100, -4, 64, 0, -4, 0, -2], [68, 9, 9, 5, -9, -23, 0, -5, -54, 9, -54, 0, 0, 54, 0, 14], [0, 33, 0, 0, -18, 0, -50, 0, 0, 0, 50, 41, 51, 0, -41, -33], [0, -118, 0, 0, -160, 0, 36, 0, 0, 0, -36, -57, 42, 0, 57, 118], [428, -37, -37, 3, 37, 71, 0, -3, -50, -37, -50, 0, 0, 50, 0, -34], [-65, -133, 65, 0, 54, 0, -45, 0, 0, 0, -45, 0, 29, 0, 0, -25], [345, -177, -345, 0, 76, 0, 42, 0, 0, 0, 42, 0, 51, 0, 0, -25], [0, 31, 72, -113, 0, 31, -30, -113, -30, 72, 0, 0, -113, -30, -57, 0], [0, 3, 3, 78, -3, 84, 0, 78, 51, 3, 51, -6, 0, 51, 0, 81], [0, -9, 0, 0, 124, 0, -22, 0, 0, 0, 22, -25, -133, 0, 25, 9], [0, 60, 60, -50, -60, 70, 0, -50, 44, 60, 44, 32, 0, 44, 0, 10], [0, -62, -6, -50, 0, -62, -44, -50, -44, -6, 0, 0, -50, -44, -103, 0], [0, -46, -30, 14, 0, -46, -70, 14, -70, -30, 0, 0, 14, -70, 35, 0], [0, 48, 48, -87, -48, 9, 0, -87, -27, 48, -27, 6, 0, -27, 0, -39], [0, 53, 173, 51, 0, 53, 108, -51, -108, -52, 0, 0, -51, 108, 0, 0], [230, 53, 53, -6, -53, -100, 0, 6, 13, 53, 13, 0, 0, -13, 0, 47], [0, -18, -18, 37, 18, 1, 0, 37, 53, -18, 53, -82, 0, 53, 0, 19], [266, -60, -60, 32, 60, 88, 0, -32, -6, -60, -6, 0, 0, 6, 0, -28], [0, 67, 0, 0, 96, 0, 33, 0, 0, 0, -33, -21, -29, 0, 21, -67], [-96, -62, -62, -69, 62, 193, 0, 69, 123, -62, 123, 0, 0, -123, 0, -131], [0, -95, -102, 109, 0, -95, -65, 109, -65, -102, 0, 0, 109, -65, -37, 0], [167, -168, -167, 0, 84, 0, -50, 0, 0, 0, -50, 0, 84, 0, 0, 0], [0, 35, -66, 167, 0, 35, -1, 167, -1, -66, 0, 0, 167, -1, -31, 0], [104, 33, 33, -61, -33, -5, 0, 61, 78, 33, 78, 0, 0, -78, 0, -28], [0, 86, 0, 0, -82, 0, 18, 0, 0, 0, -18, -21, 168, 0, 21, -86], [312, -62, -62, 63, 62, 61, 0, -63, 39, -62, 39, 0, 0, -39, 0, 1], [0, 100, 142, -184, 0, 100, -19, -184, -19, 142, 0, 0, -184, -19, -77, 0], [115, 245, -115, 0, -78, 0, -21, 0, 0, 0, -21, 0, 11, 0, 0, 89], [0, 30, 66, -102, 0, 30, 85, -102, 85, 66, 0, 0, -102, 85, 25, 0], [272, -60, -60, -15, 60, 135, 0, 15, 39, -60, 39, 0, 0, -39, 0, -75], [0, 57, -175, 39, 0, 57, -91, -39, 91, -48, 0, 0, -39, -91, 0, 0], [0, -11, 0, 0, -90, 0, -27, 0, 0, 0, 27, -117, 79, 0, 117, 11], [0, 42, 42, -118, -42, -34, 0, -118, -50, 42, -50, -116, 0, -50, 0, -76], [-649, 90, 649, 0, -6, 0, -26, 0, 0, 0, -26, 0, 72, 0, 0, 78], [0, 63, 48, -33, 0, 63, -17, -33, -17, 48, 0, 0, -33, -17, 121, 0], [0, -40, -40, -10, 40, -90, 0, -10, 56, -40, 56, -8, 0, 56, 0, -50], [0, 32, 299, -120, 0, 32, -15, 120, 15, 44, 0, 0, 120, -15, 0, 0], [0, -64, 0, 0, -79, 0, 54, 0, 0, 0, -54, -93, 15, 0, 93, 64], [0, -170, 103, -10, 0, -170, -45, 10, 45, 90, 0, 0, 10, -45, 0, 0], [295, -46, -295, 0, 3, 0, -30, 0, 0, 0, -30, 0, -37, 0, 0, -40], [-165, -114, 165, 0, 16, 0, 75, 0, 0, 0, 75, 0, -66, 0, 0, -82], [0, 155, 155, -136, -155, 174, 0, -136, 11, 155, 11, -62, 0, 11, 0, 19], [0, -71, 0, 0, -63, 0, -27, 0, 0, 0, 27, 99, -8, 0, -99, 71], [-396, 52, 52, -99, -52, -5, 0, 99, -99, 52, -99, 0, 0, 99, 0, -47], [-47, -82, 47, 0, 78, 0, 39, 0, 0, 0, 39, 0, 152, 0, 0, 74], [0, -84, -84, 24, 84, -144, 0, 24, 12, -84, 12, 120, 0, 12, 0, -60], [0, -85, 0, 0, -210, 0, 38, 0, 0, 0, -38, 1, 125, 0, -1, 85], [0, 119, 145, -107, 0, 119, -102, 107, 102, -6, 0, 0, 107, -102, 0, 0], [0, -75, -75, 45, 75, -105, 0, 45, 6, -75, 6, 84, 0, 6, 0, -30], [0, 112, 8, 96, 0, 112, -9, 96, -9, 8, 0, 0, 96, -9, -33, 0], [0, 144, 144, -144, 0, 144, -77, -144, -77, 144, 0, 0, -144, -77, 85, 0], [-70, 48, 48, 0, -48, -96, 0, 0, -60, 48, -60, 0, 0, 60, 0, 48], [0, -9, 236, -21, 0, -9, -4, 21, 4, 15, 0, 0, 21, -4, 0, 0], [0, -176, -8, 2, 0, -176, 147, -2, -147, 87, 0, 0, -2, 147, 0, 0], [-372, 16, 16, 129, -16, -161, 0, -129, 21, 16, 21, 0, 0, -21, 0, 145], [0, 48, -3, 54, 0, 48, 79, 54, 79, -3, 0, 0, 54, 79, 49, 0], [0, -147, 101, -21, 0, -147, -64, 21, 64, 84, 0, 0, 21, -64, 0, 0], [-60, -65, -65, 15, 65, 115, 0, -15, 114, -65, 114, 0, 0, -114, 0, -50], [0, -51, -51, -162, 51, -264, 0, -162, -63, -51, -63, -114, 0, -63, 0, -213], [-247, 165, 247, 0, -42, 0, -122, 0, 0, 0, -122, 0, 39, 0, 0, 81], [0, 45, 0, 45, 0, 45, 28, 45, 28, 0, 0, 0, 45, 28, -125, 0], [0, -16, -16, -10, 16, -42, 0, -10, -58, -16, -58, -116, 0, -58, 0, -26], [488, -78, -78, -39, 78, 195, 0, 39, 93, -78, 93, 0, 0, -93, 0, -117], [0, -6, 0, 0, -68, 0, 95, 0, 0, 0, -95, -199, 62, 0, 199, 6], [199, 103, -199, 0, -42, 0, 78, 0, 0, 0, 78, 0, -23, 0, 0, 19], [449, -60, -449, 0, -21, 0, 118, 0, 0, 0, 118, 0, -123, 0, 0, -102], [0, -31, -24, 17, 0, -31, 29, 17, 29, -24, 0, 0, 17, 29, -67, 0], [0, -22, -22, -58, 22, -102, 0, -58, -70, -22, -70, 4, 0, -70, 0, -80], [0, -5, -461, 125, 0, -5, 132, -125, -132, -60, 0, 0, -125, 132, 0, 0], [428, -16, -16, 9, 16, 23, 0, -9, -131, -16, -131, 0, 0, 131, 0, -7], [0, 33, 33, 118, -33, 184, 0, 118, 5, 33, 5, 38, 0, 5, 0, 151], [0, 145, 130, -115, 0, 145, -46, -115, -46, 130, 0, 0, -115, -46, -263, 0], [0, 16, 0, 0, 48, 0, -48, 0, 0, 0, 48, 9, -32, 0, -9, -16], [0, 117, 0, 0, 16, 0, -58, 0, 0, 0, 58, -25, 101, 0, 25, -117], [0, 192, 192, -158, -192, 226, 0, -158, 44, 192, 44, -160, 0, 44, 0, 34], [-199, 78, 199, 0, -27, 0, 118, 0, 0, 0, 118, 0, -3, 0, 0, 24], [104, -30, -30, -31, 30, 91, 0, 31, 33, -30, 33, 0, 0, -33, 0, -61], [0, 84, 929, 24, 0, 84, 47, -24, -47, -54, 0, 0, -24, 47, 0, 0], [0, -35, 0, 0, 126, 0, 97, 0, 0, 0, -97, -143, -161, 0, 143, 35], [-324, 31, 31, 3, -31, -65, 0, -3, -18, 31, -18, 0, 0, 18, 0, 34], [0, -425, -264, 103, 0, -425, -24, 103, -24, -264, 0, 0, 103, -24, 99, 0], [0, 50, 50, -19, -50, 81, 0, -19, 29, 50, 29, 46, 0, 29, 0, 31], [0, -154, -565, 186, 0, -154, 108, -186, -108, -16, 0, 0, -186, 108, 0, 0], [0, -97, 0, 0, -46, 0, -30, 0, 0, 0, 30, 39, -51, 0, -39, 97], [0, -294, -294, 246, 294, -342, 0, 246, 18, -294, 18, 84, 0, 18, 0, -48], [277, -442, -277, 0, 84, 0, 69, 0, 0, 0, 69, 0, -190, 0, 0, -274]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_108_f_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_108_3_f_c();".
// 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_108_3_f_c(:prec:=16)
    chi := MakeCharacter_108_f();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 3));
    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_108_3_f_c();".
// 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_108_3_f_c( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_108_f();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,3,sign)));
    Vf := Kernel([<5,R![87616, 75480, 49337, 15291, 3870, 351, 62, 3, 1]>,<7,R![4430766096, 0, -13013727948, 0, 37316185677, 0, -2633438061, 0, 141530490, 0, -2674161, 0, 37002, 0, -225, 0, 1]>],Snew);
    return Vf;
end function;