
// Make newform 108.5.d.b in Magma, downloaded from the LMFDB on 20 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_108_d();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_108_d_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_5_d_b();".
// 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_5_d_b();".
// 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, 0, 352256, 0, 1783808, 0, 569472, 0, 130640, 0, 13512, 0, 1016, 0, 38, 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], [-560383182118912, 0, -169615122399232, 0, -36728960741376, 0, -4125035344112, 0, -518036651256, 0, -34969469560, 0, -1478004994, 0, -31526031, 0], [35527188072448, 0, 42847095737344, 0, 11426488988928, 0, 2670612406832, 0, 275776021848, 0, 21483034168, 0, 810251098, 0, 22125963, 0], [-54341410430464, 0, 86052727752704, 0, 24668040322560, 0, 6417247127152, 0, 669847068600, 0, 53270230904, 0, 2016497426, 0, 55772295, 0], [61283674128384, 0, 586008280737792, 0, 183107704096512, 0, 43034314712688, 0, 4466455855992, 0, 338874029208, 0, 12700746162, 0, 336655503, 0], [975274043457536, 0, 9296357327919104, 0, 3070851986567424, 0, 705848697514672, 0, 73163083212312, 0, 5490588520184, 0, 205346757098, 0, 5389537731, 0], [-975085761093632, 0, 8311410549225472, 0, 2793782286461184, 0, 698772611343152, 0, 73822365326424, 0, 5697961181752, 0, 214867475674, 0, 5752396299, 0], [0, -12225716432896, 0, 1240302616969728, 0, 400964425500928, 0, 94235408393872, 0, 9793364237576, 0, 742057419752, 0, 27811759278, 0, 736076377], [2168664507645952, 0, 7070030810220544, 0, 2151704842462464, 0, 477434654409392, 0, 48837038113560, 0, 3637189030264, 0, 135483347818, 0, 3544178403, 0], [0, 323296419487744, 0, 35110154205044736, 0, 11557905817313024, 0, 2716360618555376, 0, 282726138030136, 0, 21390001763416, 0, 801681331074, 0, 21174584519], [0, -530311192121344, 0, 7146123589074432, 0, 2343933237913600, 0, 552823897601776, 0, 57545083803896, 0, 4358708917496, 0, 163390571778, 0, 4319670871], [0, -31324629737660416, 0, -76650707290251264, 0, -24032631381185792, 0, -5302351460587664, 0, -543226320658696, 0, -40295155484776, 0, -1500703996398, 0, -39104187809], [0, 68043692147138560, 0, 91471110079451136, 0, 27890207958042368, 0, 5820851472606224, 0, 588927554877256, 0, 42879935422312, 0, 1588698201534, 0, 40828295945], [0, -363609072300032, 0, -9854134880263680, 0, -3172966386699520, 0, -745716488182480, 0, -77486461375016, 0, -5872149996680, 0, -220083807270, 0, -5825845645], [0, 505026864599040, 0, 1530890719268352, 0, 480287270553216, 0, 108851393709648, 0, 11229447493704, 0, 842058646200, 0, 31470960102, 0, 826772793], [0, -3288361928396800, 0, -51568612005548544, 0, -16742001436051712, 0, -3926943140555984, 0, -408252459978280, 0, -30900770575624, 0, -1158020226150, 0, -30611053565]];
    Rf_basisdens := [1, 9072826085376, 2268206521344, 567051630336, 2016183574528, 18145652170752, 18145652170752, 27218478256128, 9072826085376, 108873913024512, 13609239128064, 108873913024512, 108873913024512, 13609239128064, 1008091787264, 27218478256128];
    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_d();"
function MakeCharacter_108_d()
    N := 108;
    order := 2;
    char_gens := [55, 29];
    v := [1, 2];
    // 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_d_Hecke();"
function MakeCharacter_108_d_Hecke(Kf)
    N := 108;
    order := 2;
    char_gens := [55, 29];
    char_values := [[-1, 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]];
    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 := 5;
    raw_aps := [[0, 0, 0, 0, 0, 0, 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, -1, 0, 1, 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, 0, 1, 0, 0, 0, -1, 0, 0, 0, 0], [11, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -6, 0, -1, -2, 0, 0, 0, 0, 1], [0, 0, 0, 1, 1, -2, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -6, 0, 0, 0, 1, -2, -1, -2, 1], [0, 0, 0, 0, 0, 0, 0, 48, 0, -4, 12, -4, -4, 0, 4, 0], [8, 0, 32, 5, 0, 2, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0], [9, -3, 13, -1, 0, 2, -6, 0, 2, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 154, 0, -8, 0, -4, -4, -8, 4, 6], [-16, 0, -64, -9, 2, 8, -2, 0, -2, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -22, 0, 0, -12, -7, -14, -1, -6, 1], [0, 0, 0, 0, 0, 0, 0, -328, 0, 14, -8, -4, -4, 16, 4, 10], [0, 0, 0, 0, 0, 0, 0, -201, 0, 0, 24, -25, 4, -26, -12, 10], [-71, 15, 143, -12, 0, 8, -24, 0, 8, 0, 0, 0, 0, 0, 0, 0], [48, 0, 192, 18, 5, -28, -12, 0, -12, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 650, 0, 0, -24, -6, -16, 52, 0, -4], [5, 22, 22, -4, 0, -8, 24, 0, -8, 0, 0, 0, 0, 0, 0, 0], [-56, 0, -224, -25, -20, -79, 6, 0, 6, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -94, 0, 0, 60, 22, 28, -24, -12, 16], [0, 0, 0, 0, 0, 0, 0, -1390, 0, -89, 70, -8, -8, 96, 8, -23], [981, -36, 172, -23, 0, 6, -18, 0, 6, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 394, 0, -212, -108, 32, 32, -32, -32, 6], [64, 0, 256, 38, -50, 147, 12, 0, 12, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1769, 0, 0, -12, -3, 32, 142, 40, -22], [1654, -46, 34, -13, 0, -6, 18, 0, -6, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 2020, 0, -21, -42, 28, 28, -120, -28, -21], [32, 0, 128, 36, -110, -62, 40, 0, 40, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -2604, 0, 0, -12, -60, 52, -168, 60, -32], [0, 0, 0, 0, 0, 0, 0, -110, 0, 549, 6, 28, 28, -24, -28, -45], [-112, 0, -448, -27, 201, -384, 58, 0, 58, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 3248, 0, 70, -36, 24, 24, -192, -24, -18], [152, 0, 608, 53, -220, -155, -46, 0, -46, 0, 0, 0, 0, 0, 0, 0], [-566, 42, 506, -57, 0, 2, -6, 0, 2, 0, 0, 0, 0, 0, 0, 0], [32, 0, 128, -13, 219, 54, -58, 0, -58, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -2242, 0, 0, 240, -27, 126, -233, -34, 57], [0, 0, 0, 0, 0, 0, 0, 2306, 0, -920, 384, -84, -84, 0, 84, -66], [0, 0, 0, 0, 0, 0, 0, 4044, 0, 0, 48, 98, -36, 262, -68, 42], [-45, 167, -633, 90, 0, -20, 60, 0, -20, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -212, 0, 0, 36, -105, -30, -49, -54, 33], [4711, 66, 1298, -123, 0, 62, -186, 0, 62, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -4103, 0, 1149, 136, -52, -52, 192, 52, 10], [-64, 0, -256, -36, -442, -233, -8, 0, -8, 0, 0, 0, 0, 0, 0, 0], [-160, 0, -640, -113, 493, -344, -66, 0, -66, 0, 0, 0, 0, 0, 0, 0], [216, 0, 864, 181, -684, -778, 146, 0, 146, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1532, 0, 0, 96, -450, 4, 34, -60, 46], [1966, -108, 1268, -210, 0, -76, 228, 0, -76, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 302, 0, -944, 292, -128, -128, 96, 128, 46], [0, 0, 0, 0, 0, 0, 0, -324, 0, 0, -96, -262, -164, -50, -100, 34], [7129, 78, 638, -105, 0, -70, 210, 0, -70, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -2658, 0, 0, -564, -252, -336, -54, 40, -114], [0, 0, 0, 0, 0, 0, 0, -2158, 0, 226, 300, -84, -84, 168, 84, -24], [0, 0, 0, 0, 0, 0, 0, 356, 0, 0, 624, 478, 100, -198, -316, 262], [0, 0, 0, 0, 0, 0, 0, 6109, 0, 759, -20, -52, -52, -384, 52, 88], [128, 0, 512, 26, -1296, 627, -76, 0, -76, 0, 0, 0, 0, 0, 0, 0], [7494, -270, 898, -173, 0, -54, 162, 0, -54, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -4376, 0, 1740, 108, -20, -20, 168, 20, -24], [208, 0, 832, 115, 1406, 332, 22, 0, 22, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -2743, 0, -425, 804, -132, -132, 336, 132, -204], [-560, 0, -2240, -105, 1406, -1324, 350, 0, 350, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 8400, 0, 0, 24, -485, 214, 623, 198, -95], [6999, 94, 206, -57, 0, -86, 258, 0, -86, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -390, 0, -850, -564, 260, 260, -48, -260, -108], [-704, 0, -2816, -515, 1845, -1124, -326, 0, -326, 0, 0, 0, 0, 0, 0, 0], [18373, 200, -1544, 211, 0, -14, 42, 0, -14, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 4550, 0, 0, -600, 246, 96, 652, 496, -348], [12389, 319, 5263, -701, 0, -166, 498, 0, -166, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -7184, 0, 754, -252, 152, 152, 304, -152, -102], [0, 0, 0, 0, 0, 0, 0, -18982, 0, 0, -288, -117, 98, -1199, 290, -193], [8, 0, 32, 15, -2446, -127, 22, 0, 22, 0, 0, 0, 0, 0, 0, 0], [-72551, -103, -7415, 925, 0, 22, -66, 0, 22, 0, 0, 0, 0, 0, 0, 0], [64, 0, 256, -114, 2427, 1034, -292, 0, -292, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 15782, 0, 0, -792, 1096, -396, 1446, 132, -198], [0, 0, 0, 0, 0, 0, 0, -6415, 0, -427, 2268, -392, -392, 832, 392, -546], [68282, -662, -3206, 215, 0, -206, 618, 0, -206, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -11152, 0, 2398, 708, 0, 0, 624, 0, -354], [66357, -272, 1376, -165, 0, 82, -246, 0, 82, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 15503, 0, 0, 1056, -257, 396, 726, -308, 330], [-40625, 471, -4153, 681, 0, 206, -618, 0, 206, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -18528, 0, 0, -204, 1213, -426, -1279, -290, 111], [-58334, -550, 778, -313, 0, -294, 882, 0, -294, 0, 0, 0, 0, 0, 0, 0], [504, 0, 2016, 555, -1320, 2518, 606, 0, 606, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 8300, 0, 0, -636, 974, -584, 770, -160, -26], [0, 0, 0, 0, 0, 0, 0, 6008, 0, -1471, 226, -292, -292, -200, 292, 325], [51566, -1438, 4754, -765, 0, 18, -54, 0, 18, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -8443, 0, 3995, -936, 40, 40, 64, -40, 408], [-1016, 0, -4064, -403, -3192, -981, 210, 0, 210, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -16693, 0, 0, -420, 247, -256, -1062, 24, -82], [0, 0, 0, 0, 0, 0, 0, -5334, 0, 0, 612, -1378, -412, -896, -820, 512], [840, 0, 3360, 877, -522, -1823, 914, 0, 914, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 19117, 0, 0, 396, -1891, -64, 1026, -328, 230], [-2368, 0, -9472, -902, 1172, 1240, 564, 0, 564, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 21128, 0, 0, 1032, -2447, 242, 933, -446, 395], [0, 0, 0, 0, 0, 0, 0, 22829, 0, 1037, -324, -464, -464, -1376, 464, 858], [0, 0, 0, 0, 0, 0, 0, -6250, 0, 10805, 2026, -688, -688, 160, 688, 19], [-2352, 0, -9408, -1019, 3617, 838, 314, 0, 314, 0, 0, 0, 0, 0, 0, 0], [91763, 1057, -7823, 1439, 0, 658, -1974, 0, 658, 0, 0, 0, 0, 0, 0, 0], [1920, 0, 7680, 406, -579, 5510, -1108, 0, -1108, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -30473, 0, -11361, 1588, -256, -256, 2640, 256, -410], [0, 0, 0, 0, 0, 0, 0, -38338, 0, 0, -2244, 232, -1848, -2274, -352, -198], [0, 0, 0, 0, 0, 0, 0, 10890, 0, -8989, 1206, -544, -544, 144, 544, 213], [-3776, 0, -15104, -2609, 2583, -232, -1442, 0, -1442, 0, 0, 0, 0, 0, 0, 0], [-171309, 330, 4906, -706, 0, -268, 804, 0, -268, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -25475, 0, 0, 132, 681, 816, -1570, 728, -342], [0, 0, 0, 0, 0, 0, 0, -11152, 0, -3938, -512, -188, -188, 744, 188, 538], [0, 0, 0, 0, 0, 0, 0, 368, 0, 0, 1668, 1544, -156, -688, -1268, 912], [-16542, 1810, -5374, 795, 0, -206, 618, 0, -206, 0, 0, 0, 0, 0, 0, 0], [-2608, 0, -10432, -744, -2338, -633, 1120, 0, 1120, 0, 0, 0, 0, 0, 0, 0], [208965, 515, -1677, 477, 0, 406, -1218, 0, 406, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 67800, 0, -1495, -450, 752, 752, -3792, -752, -903], [-2576, 0, -10304, -914, 3289, -6128, 748, 0, 748, 0, 0, 0, 0, 0, 0, 0], [-2136, 0, -8544, -2155, 1544, -1015, -2174, 0, -2174, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 71618, 0, -9338, 1728, -144, -144, -3120, 144, -648], [4464, 0, 17856, 2637, -3002, -2872, 810, 0, 810, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 8926, 0, 0, -1212, 1224, 592, 1478, 1400, -902], [0, 0, 0, 0, 0, 0, 0, -2650, 0, 11042, 3204, -116, -116, 160, 116, -1428], [0, 0, 0, 0, 0, 0, 0, 14696, 0, 0, -3300, -1618, -1208, 2078, 992, -1046], [-297139, 1151, 7535, -375, 0, 846, -2538, 0, 846, 0, 0, 0, 0, 0, 0, 0], [100419, 160, 12944, -1185, 0, 826, -2478, 0, 826, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -20785, 0, 8393, 2772, 412, 412, 1216, -412, -2004], [0, 0, 0, 0, 0, 0, 0, 33966, 0, 0, 3696, -1220, 2100, 1298, -364, 798], [864, 0, 3456, 337, -5578, 7952, -190, 0, -190, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -35617, 0, -11681, -1796, 808, 808, 2256, -808, -314], [52159, -2055, 8345, -1458, 0, -316, 948, 0, -316, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 91496, 0, 0, 2076, 286, 392, 5718, -992, 842], [-4616, 0, -18464, -985, 7588, 1226, 2646, 0, 2646, 0, 0, 0, 0, 0, 0, 0], [-252298, -1778, -13442, 973, 0, -970, 2910, 0, -970, 0, 0, 0, 0, 0, 0, 0], [-3232, 0, -12928, -1431, -7342, -692, 370, 0, 370, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -32148, 0, 0, -3672, -2143, -1190, -1127, 1258, -1241], [4832, 0, 19328, 2430, -1106, 3153, 28, 0, 28, 0, 0, 0, 0, 0, 0, 0], [432351, 473, -3207, 450, 0, -20, 60, 0, -20, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 10096, 0, -17505, 6330, -1352, -1352, 1680, 1352, -1137], [283983, -3344, -1744, 420, 0, 1240, -3720, 0, 1240, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -121886, 0, 9582, -44, -340, -340, 6240, 340, 532], [1136, 0, 4544, 729, -9891, -8886, 322, 0, 322, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 8278, 0, 12336, 1092, 976, 976, -960, -976, -2010], [0, 0, 0, 0, 0, 0, 0, 49074, 0, 5762, 9328, -2904, -2904, -1152, 2904, -308], [1904, 0, 7616, 603, -654, -704, -698, 0, -698, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -27813, 0, -13183, -8292, 1484, 1484, 624, -1484, 1920], [3376, 0, 13504, 1062, 10394, 2365, -1252, 0, -1252, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 54067, 0, 0, -684, 2451, 832, 4622, 1288, -758], [408711, 1955, -14061, 2241, 0, 478, -1434, 0, 478, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 33346, 0, 0, -2724, -2522, -2820, 2560, -1004, 48], [-30143, 815, -10289, 670, 0, -1436, 4308, 0, -1436, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 57714, 0, -166, -2952, 752, 752, -3792, -752, 348], [3680, 0, 14720, 2398, 301, -5066, 1116, 0, 1116, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -48402, 0, 0, -1500, -5927, -438, -3325, 562, -531], [-382571, 9, 7241, -672, 0, 464, -1392, 0, 464, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -78552, 0, -19035, 1918, -1064, -1064, 5824, 1064, 637], [-3472, 0, -13888, -2678, -16127, -2446, -1884, 0, -1884, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -62096, 0, 0, -3780, -330, -1624, -3226, 896, -1078], [2864, 0, 11456, 1087, -535, -126, -690, 0, -690, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -98754, 0, 0, 1836, 2180, -1168, -8126, -2392, 1502], [2584, 0, 10336, 1579, 15708, 138, 574, 0, 574, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -103100, 0, 18702, 2676, -2552, -2552, 5280, 2552, 2490], [-656193, -1938, -12482, 689, 0, -1258, 3774, 0, -1258, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 51757, 0, 6159, -1392, -1160, -1160, -3456, 1160, 2436], [0, 0, 0, 0, 0, 0, 0, 32049, 0, 0, -5340, 6261, -304, 5118, 3256, -2518], [0, 0, 0, 0, 0, 0, 0, 115492, 0, 16623, -5678, 152, 152, -8448, -152, 2611], [-4360, 0, -17440, -1837, 21322, -6433, 686, 0, 686, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -73979, 0, 0, 7716, -2115, 2152, -8326, -2992, 2782], [0, 0, 0, 0, 0, 0, 0, -153412, 0, -8626, 2304, 76, 76, 9448, -76, -1266], [0, 0, 0, 0, 0, 0, 0, 113690, 0, 0, 4044, -517, -962, 5897, -3658, 2503], [5656, 0, 22624, 3549, 2170, -5995, 1442, 0, 1442, 0, 0, 0, 0, 0, 0, 0], [-52326, 2026, 4346, -297, 0, -14, 42, 0, -14, 0, 0, 0, 0, 0, 0, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_108_d_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_108_5_d_b();".
// 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_5_d_b(:prec:=16)
    chi := MakeCharacter_108_d();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 5));
    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_5_d_b();".
// 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_5_d_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_108_d();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,5,sign)));
    Vf := Kernel([<5,R![6389764096, 0, -527623168, 0, 2376384, 0, -3184, 0, 1]>],Snew);
    return Vf;
end function;