
// Make newform 100.5.d.c in Magma, downloaded from the LMFDB on 06 May 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_100_d();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_100_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_100_5_d_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_100_5_d_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, 0, -20480, 0, 5376, 0, 560, 0, -199, 0, 35, 0, 21, 0, -5, 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, 45056, 0, 5376, 0, 560, 0, -199, 0, 35, 0, 21, 0, -5, 0, 1], [0, -20480, 0, 5376, 0, 560, 0, -199, 0, 35, 0, 21, 0, -5, 0, 1], [-26624, 0, -128000, 0, 15920, 0, -1183, 0, -2213, 0, -99, 0, -13, 0, -23, 0], [-18432, 0, 5376, 0, 560, 0, -199, 0, 35, 0, 21, 0, -5, 0, 1, 0], [207872, 0, -42496, 0, 880, 0, 3321, 0, 99, 0, -43, 0, 59, 0, 1, 0], [810496, 0, 21760, 0, -600, 0, 16087, 0, 1517, 0, -229, 0, 117, 0, 7, 0], [81664, 0, -33856, 0, 9372, 0, 479, 0, -491, 0, -45, 0, 45, 0, -13, 0], [0, -1458176, 0, 347904, 0, -41888, 0, -18521, 0, 1469, 0, 395, 0, -475, 0, 47], [1135616, 0, -175360, 0, 11920, 0, 18407, 0, -2243, 0, -629, 0, 357, 0, -33, 0], [0, 503808, 0, -126720, 0, 8512, 0, 9643, 0, -727, 0, -257, 0, 113, 0, -13], [0, 219136, 0, 14144, 0, 6682, 0, 2573, 0, 103, 0, -63, 0, 39, 0, -9], [0, 2543616, 0, -733952, 0, 2624, 0, 50059, 0, -9271, 0, -1697, 0, 1041, 0, -45], [124416, 0, 251264, 0, -21808, 0, 1973, 0, 4663, 0, -223, 0, -81, 0, 61, 0], [0, 1128448, 0, 185088, 0, -55176, 0, 35713, 0, 3803, 0, 605, 0, 275, 0, 49], [0, -745472, 0, 436096, 0, -49092, 0, -11785, 0, 6685, 0, 267, 0, -331, 0, 107]];
    Rf_basisdens := [1, 8192, 8192, 15360, 1024, 3072, 7680, 3840, 122880, 15360, 24576, 15360, 122880, 7680, 61440, 30720];
    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_100_d();"
function MakeCharacter_100_d()
    N := 100;
    order := 2;
    char_gens := [51, 77];
    v := [1, 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_100_d_Hecke();"
function MakeCharacter_100_d_Hecke(Kf)
    N := 100;
    order := 2;
    char_gens := [51, 77];
    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, 1, 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, 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, 0, 0, 0, 0, 0, 1, 0], [-1, 0, 0, 1, -4, 1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0], [0, 5, 17, 0, 0, 0, 0, 0, 0, 0, 4, 3, 0, 0, 0, 0], [0, -3, -15, 0, 0, 0, 0, 0, 0, 0, 7, -2, -5, 0, 0, -5], [3, 0, 0, -3, 8, -3, 0, -8, 0, 4, 0, 0, 0, 2, 0, 0], [0, -8, 7, 0, 0, 0, 0, 0, -6, 0, 0, 0, -12, 0, 3, 12], [-142, 0, 0, -18, -4, -12, 0, 0, 0, -20, 0, 0, 0, 0, 0, 0], [11, 0, 0, 5, -8, 5, 12, 4, 0, -7, 0, 0, 0, 11, 0, 0], [0, -49, -121, 0, 0, 0, 0, 0, 0, 0, -20, 21, 36, 0, 0, 36], [644, 0, 0, -35, 26, -6, 0, 0, 0, -38, 0, 0, 0, 0, 0, 0], [0, 16, -54, 0, 0, 0, 0, 0, 3, 0, 0, 0, 16, 0, -22, -16], [0, -88, 413, 0, 0, 0, 0, 0, -100, 0, 0, 0, -4, 0, -15, 4], [0, -107, -135, 0, 0, 0, 0, 0, 0, 0, -96, 39, -12, 0, 0, -12], [-9, 0, 0, -15, 0, -15, -24, -96, 0, 30, 0, 0, 0, 36, 0, 0], [984, 0, 0, 101, -24, -16, 0, 0, 0, -8, 0, 0, 0, 0, 0, 0], [0, 32, 46, 0, 0, 0, 0, 0, 327, 0, 0, 0, 56, 0, 38, -56], [25, 0, 0, -1, 32, -1, 76, 84, 0, -19, 0, 0, 0, -77, 0, 0], [0, 3, -225, 0, 0, 0, 0, 0, 0, 0, -3, -122, -7, 0, 0, -7], [28, 0, 0, -32, 84, -32, 48, -32, 0, 30, 0, 0, 0, -46, 0, 0], [0, -64, 74, 0, 0, 0, 0, 0, -193, 0, 0, 0, -76, 0, -18, 76], [-2954, 0, 0, 40, -20, -36, 0, 0, 0, -52, 0, 0, 0, 0, 0, 0], [0, 105, 933, 0, 0, 0, 0, 0, 0, 0, -279, 204, 69, 0, 0, 69], [-7214, 0, 0, 184, -68, -12, 0, 0, 0, 44, 0, 0, 0, 0, 0, 0], [0, -328, 1075, 0, 0, 0, 0, 0, 162, 0, 0, 0, -148, 0, -121, 148], [0, 16, -980, 0, 0, 0, 0, 0, 613, 0, 0, 0, -248, 0, -156, 248], [2584, 0, 0, 151, -156, -20, 0, 0, 0, 116, 0, 0, 0, 0, 0, 0], [0, 435, 1467, 0, 0, 0, 0, 0, 0, 0, -37, 176, 227, 0, 0, 227], [0, 384, -1829, 0, 0, 0, 0, 0, -906, 0, 0, 0, 72, 0, -125, -72], [-39, 0, 0, 99, -16, 99, -208, 432, 0, -127, 0, 0, 0, 19, 0, 0], [0, 965, 2133, 0, 0, 0, 0, 0, 0, 0, 425, -124, 89, 0, 0, 89], [229, 0, 0, 7, 316, 7, -96, 120, 0, -10, 0, 0, 0, 228, 0, 0], [-2880, 0, 0, -89, 492, 252, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0], [35, 0, 0, 41, -52, 41, 180, 252, 0, -95, 0, 0, 0, -153, 0, 0], [0, -1089, -1881, 0, 0, 0, 0, 0, 0, 0, -444, 285, -372, 0, 0, -372], [0, -112, 1836, 0, 0, 0, 0, 0, -639, 0, 0, 0, 416, 0, 28, -416], [0, -360, 1311, 0, 0, 0, 0, 0, -1074, 0, 0, 0, -276, 0, 339, 276], [0, 417, 9, 0, 0, 0, 0, 0, 0, 0, 812, 83, 596, 0, 0, 596], [-313, 0, 0, 181, -804, 181, 160, 264, 0, -234, 0, 0, 0, -216, 0, 0], [-12030, 0, 0, -256, -216, -424, 0, 0, 0, -632, 0, 0, 0, 0, 0, 0], [295, 0, 0, -91, 332, -91, 172, -300, 0, 107, 0, 0, 0, 193, 0, 0], [0, -613, -1561, 0, 0, 0, 0, 0, 0, 0, -1283, -674, -343, 0, 0, -343], [0, -401, 507, 0, 0, 0, 0, 0, 0, 0, 206, 1379, 842, 0, 0, 842], [832, 0, 0, 148, 668, 148, -24, 536, 0, -212, 0, 0, 0, 808, 0, 0], [399, 0, 0, 429, -680, 429, 600, 1016, 0, -631, 0, 0, 0, 247, 0, 0], [0, -1552, 6619, 0, 0, 0, 0, 0, -1998, 0, 0, 0, -448, 0, 203, 448], [0, -2592, 9312, 0, 0, 0, 0, 0, -1819, 0, 0, 0, -1180, 0, -108, 1180], [20626, 0, 0, -170, -720, -896, 0, 0, 0, -1072, 0, 0, 0, 0, 0, 0], [0, 2775, 7947, 0, 0, 0, 0, 0, 0, 0, -85, -712, -961, 0, 0, -961], [-870, 0, 0, 762, -2492, 762, 232, 1560, 0, -986, 0, 0, 0, -466, 0, 0], [28972, 0, 0, -687, 1770, 90, 0, 0, 0, -1590, 0, 0, 0, 0, 0, 0], [-1147, 0, 0, -77, -1940, -77, 104, -1944, 0, 307, 0, 0, 0, -151, 0, 0], [0, 101, 2589, 0, 0, 0, 0, 0, 0, 0, -495, 468, -855, 0, 0, -855], [0, -16, -547, 0, 0, 0, 0, 0, 3124, 0, 0, 0, -320, 0, 333, 320], [-14424, 0, 0, 467, 2400, 1464, 0, 0, 0, 528, 0, 0, 0, 0, 0, 0], [919, 0, 0, -863, 2824, -863, -372, -1740, 0, 1127, 0, 0, 0, 513, 0, 0], [0, 499, -3893, 0, 0, 0, 0, 0, 0, 0, 1898, -2129, -766, 0, 0, -766], [47972, 0, 0, 593, -2290, -690, 0, 0, 0, 910, 0, 0, 0, 0, 0, 0], [0, -1056, 7056, 0, 0, 0, 0, 0, 4101, 0, 0, 0, 540, 0, 156, -540], [0, -2159, -1887, 0, 0, 0, 0, 0, 0, 0, 632, 2231, -760, 0, 0, -760], [0, 2640, -10166, 0, 0, 0, 0, 0, -3525, 0, 0, 0, 792, 0, 658, -792], [211, 0, 0, 425, 1012, 425, -1644, 2508, 0, -533, 0, 0, 0, 521, 0, 0], [0, -5529, -13137, 0, 0, 0, 0, 0, 0, 0, -4335, -1310, -1735, 0, 0, -1735], [0, 2847, 6435, 0, 0, 0, 0, 0, 0, 0, 2434, 367, 406, 0, 0, 406], [781, 0, 0, -785, 3032, -785, 552, 344, 0, 673, 0, 0, 0, -1349, 0, 0], [0, 1857, 7785, 0, 0, 0, 0, 0, 0, 0, -3489, -1322, -1369, 0, 0, -1369], [0, 1856, -8794, 0, 0, 0, 0, 0, -4133, 0, 0, 0, 652, 0, -1470, -652], [15722, 0, 0, 2274, 1608, -264, 0, 0, 0, -2136, 0, 0, 0, 0, 0, 0], [0, 4399, 3351, 0, 0, 0, 0, 0, 0, 0, -935, -5774, -767, 0, 0, -767], [500, 0, 0, -1076, 4120, -1076, -2392, -1608, 0, 1576, 0, 0, 0, 848, 0, 0], [0, 2064, -16265, 0, 0, 0, 0, 0, 918, 0, 0, 0, -1776, 0, -617, 1776], [0, -5315, -17483, 0, 0, 0, 0, 0, 0, 0, 4262, 833, -1058, 0, 0, -1058], [4147, 0, 0, 649, 4780, 649, 360, 5520, 0, -1384, 0, 0, 0, 1770, 0, 0], [0, 3232, -19217, 0, 0, 0, 0, 0, -7250, 0, 0, 0, -824, 0, -585, 824], [-35256, 0, 0, -4949, -4656, -3240, 0, 0, 0, -1824, 0, 0, 0, 0, 0, 0], [0, -1621, 7967, 0, 0, 0, 0, 0, 0, 0, 124, 7405, 1856, 0, 0, 1856], [50778, 0, 0, -4068, 7248, 3312, 0, 0, 0, -624, 0, 0, 0, 0, 0, 0], [22016, 0, 0, -5475, 5730, 2514, 0, 0, 0, -702, 0, 0, 0, 0, 0, 0], [-1687, 0, 0, -869, -1700, -869, 1880, -3360, 0, 1054, 0, 0, 0, -2500, 0, 0], [7400, 0, 0, -651, 4884, 3396, 0, 0, 0, 1908, 0, 0, 0, 0, 0, 0], [975, 0, 0, 1497, -1624, 1497, 2444, 6228, 0, -2581, 0, 0, 0, -1451, 0, 0], [0, 2943, 2595, 0, 0, 0, 0, 0, 0, 0, 1467, -4608, -4449, 0, 0, -4449], [1200, 0, 0, 960, -1528, 960, -1848, -1544, 0, -536, 0, 0, 0, 5240, 0, 0], [0, 6960, -31956, 0, 0, 0, 0, 0, 8005, 0, 0, 0, -68, 0, 3048, 68], [87792, 0, 0, 81, -2082, 1086, 0, 0, 0, 4254, 0, 0, 0, 0, 0, 0], [0, 169, -4823, 0, 0, 0, 0, 0, 0, 0, 6275, 778, 611, 0, 0, 611], [-66758, 0, 0, 148, 2140, -780, 0, 0, 0, -3700, 0, 0, 0, 0, 0, 0], [0, -6312, 35233, 0, 0, 0, 0, 0, -3084, 0, 0, 0, 924, 0, 901, -924], [0, 1504, -3644, 0, 0, 0, 0, 0, 8693, 0, 0, 0, 1868, 0, -1728, -1868], [2608, 0, 0, -208, 4696, -208, 2208, 5136, 0, -710, 0, 0, 0, -2398, 0, 0], [0, -1152, 1985, 0, 0, 0, 0, 0, -10668, 0, 0, 0, -504, 0, -2263, 504], [1261, 0, 0, -289, 1360, -289, -2040, -3576, 0, 991, 0, 0, 0, 4193, 0, 0], [-1635, 0, 0, 1743, -7956, 1743, 3000, 816, 0, -2220, 0, 0, 0, -534, 0, 0], [0, 2424, 915, 0, 0, 0, 0, 0, 18938, 0, 0, 0, 4244, 0, 303, -4244], [-20254, 0, 0, -58, -5680, -816, 0, 0, 0, 4048, 0, 0, 0, 0, 0, 0], [71962, 0, 0, -7228, -8480, -4320, 0, 0, 0, -160, 0, 0, 0, 0, 0, 0], [0, -5232, 21956, 0, 0, 0, 0, 0, 2097, 0, 0, 0, 60, 0, -4384, -60], [10522, 0, 0, -9028, 3300, 1820, 0, 0, 0, 340, 0, 0, 0, 0, 0, 0], [0, -544, 3148, 0, 0, 0, 0, 0, 18177, 0, 0, 0, 860, 0, -2152, -860], [0, -12077, -35109, 0, 0, 0, 0, 0, 0, 0, -2646, 591, 2706, 0, 0, 2706], [0, -7504, 35756, 0, 0, 0, 0, 0, -23555, 0, 0, 0, 544, 0, -3396, -544], [-198992, 0, 0, -5563, 1306, -582, 0, 0, 0, -2470, 0, 0, 0, 0, 0, 0], [8275, 0, 0, -1451, 17132, -1451, -1824, 7184, 0, 781, 0, 0, 0, 2023, 0, 0], [0, 12141, 22749, 0, 0, 0, 0, 0, 0, 0, 5793, -764, 6353, 0, 0, 6353], [0, 14800, -59234, 0, 0, 0, 0, 0, 11703, 0, 0, 0, 4332, 0, 1770, -4332], [0, 7031, 27543, 0, 0, 0, 0, 0, 0, 0, -5383, 1586, 2105, 0, 0, 2105], [4074, 0, 0, -2046, 10980, -2046, -3168, -1632, 0, 2646, 0, 0, 0, 2982, 0, 0], [-49492, 0, 0, 14021, 8838, 4742, 0, 0, 0, 646, 0, 0, 0, 0, 0, 0], [0, -152, -347, 0, 0, 0, 0, 0, 1764, 0, 0, 0, -764, 0, 1185, 764], [0, -2551, -20779, 0, 0, 0, 0, 0, 0, 0, 1594, -3227, 5078, 0, 0, 5078], [0, -3687, 15861, 0, 0, 0, 0, 0, 0, 0, -7795, 7664, -3799, 0, 0, -3799], [-8165, 0, 0, 1717, -16608, 1717, -2904, -9488, 0, -168, 0, 0, 0, 3014, 0, 0], [-5655, 0, 0, -21, -5828, -21, -2676, -3148, 0, 749, 0, 0, 0, -2057, 0, 0], [-264892, 0, 0, 5941, -22, -1638, 0, 0, 0, -3254, 0, 0, 0, 0, 0, 0], [0, 1840, -10954, 0, 0, 0, 0, 0, -13185, 0, 0, 0, -500, 0, -254, 500], [0, 3904, -35027, 0, 0, 0, 0, 0, -25944, 0, 0, 0, -5952, 0, 2349, 5952], [0, -1439, 8853, 0, 0, 0, 0, 0, 0, 0, 4930, 6061, -5978, 0, 0, -5978], [4661, 0, 0, -4385, 16700, -4385, 3096, 864, 0, 3890, 0, 0, 0, -6584, 0, 0], [-111552, 0, 0, -10659, -9192, -6168, 0, 0, 0, -3144, 0, 0, 0, 0, 0, 0], [0, -4065, 16347, 0, 0, 0, 0, 0, 0, 0, -2361, 13172, 163, 0, 0, 163], [0, -3713, 12195, 0, 0, 0, 0, 0, 0, 0, -12518, 7879, 4942, 0, 0, 4942], [0, 2752, -28706, 0, 0, 0, 0, 0, -3625, 0, 0, 0, -3400, 0, -4746, 3400], [-9425, 0, 0, 5677, -21984, 5677, 312, 9256, 0, -6873, 0, 0, 0, -4051, 0, 0], [165728, 0, 0, 21429, 5708, 4692, 0, 0, 0, 3676, 0, 0, 0, 0, 0, 0], [-64566, 0, 0, 1162, -18276, -12380, 0, 0, 0, -6484, 0, 0, 0, 0, 0, 0], [-8858, 0, 0, 4094, -20348, 4094, -1608, -24, 0, -3890, 0, 0, 0, 350, 0, 0], [0, -14976, 76349, 0, 0, 0, 0, 0, 10284, 0, 0, 0, 2304, 0, -5443, -2304], [0, 13217, 31169, 0, 0, 0, 0, 0, 0, 0, -14120, -12857, -3112, 0, 0, -3112], [-225, 0, 0, -243, -212, -243, 4752, 3320, 0, -766, 0, 0, 0, -5756, 0, 0], [0, 14848, -73619, 0, 0, 0, 0, 0, 6144, 0, 0, 0, 1368, 0, -3483, -1368], [2673, 0, 0, -5181, 13028, -5181, 1764, -8612, 0, 6037, 0, 0, 0, -3409, 0, 0], [0, -22437, -76629, 0, 0, 0, 0, 0, 0, 0, -21582, -21001, -11102, 0, 0, -11102], [34874, 0, 0, -1644, 1376, 3024, 0, 0, 0, 4672, 0, 0, 0, 0, 0, 0], [175462, 0, 0, -9952, 3468, -1204, 0, 0, 0, -5876, 0, 0, 0, 0, 0, 0], [0, -8855, 4557, 0, 0, 0, 0, 0, 0, 0, -25890, 4209, 3186, 0, 0, 3186], [0, -3232, -6434, 0, 0, 0, 0, 0, -34053, 0, 0, 0, -7240, 0, -874, 7240], [0, -4569, -37581, 0, 0, 0, 0, 0, 0, 0, 16314, 1095, 9750, 0, 0, 9750], [128566, 0, 0, 39540, 2560, 1824, 0, 0, 0, 1088, 0, 0, 0, 0, 0, 0], [5021, 0, 0, -6229, 11820, -6229, 6456, -17320, 0, 7587, 0, 0, 0, -647, 0, 0], [394576, 0, 0, -3571, -5468, -4452, 0, 0, 0, -3436, 0, 0, 0, 0, 0, 0], [0, 16120, -36997, 0, 0, 0, 0, 0, 28158, 0, 0, 0, 15820, 0, -3857, -15820], [0, -20224, 124658, 0, 0, 0, 0, 0, -4905, 0, 0, 0, 6612, 0, 3702, -6612], [-166344, 0, 0, -2021, 17400, 14944, 0, 0, 0, 12488, 0, 0, 0, 0, 0, 0], [8900, 0, 0, -2276, 9344, -2276, 72, -12696, 0, 3854, 0, 0, 0, 12238, 0, 0], [0, 12201, 16413, 0, 0, 0, 0, 0, 0, 0, -2994, -16607, -10030, 0, 0, -10030], [0, -3555, -12987, 0, 0, 0, 0, 0, 0, 0, 35369, 18596, 4145, 0, 0, 4145], [-5945, 0, 0, 2545, -10112, 2545, 6408, 13344, 0, -5014, 0, 0, 0, -13200, 0, 0], [0, -18872, 100513, 0, 0, 0, 0, 0, 30216, 0, 0, 0, -2196, 0, 12741, 2196], [0, -42593, -123185, 0, 0, 0, 0, 0, 0, 0, 9824, 4593, -5232, 0, 0, -5232], [-142524, 0, 0, -3511, 25062, 14118, 0, 0, 0, 3174, 0, 0, 0, 0, 0, 0], [0, 43936, -216880, 0, 0, 0, 0, 0, 4737, 0, 0, 0, 328, 0, 1816, -328], [0, -3968, -3575, 0, 0, 0, 0, 0, 58024, 0, 0, 0, -8600, 0, 2385, 8600], [0, -18800, 99708, 0, 0, 0, 0, 0, -29535, 0, 0, 0, 4288, 0, -7156, -4288], [1367, 0, 0, -5831, 8856, -5831, 364, -19644, 0, 8241, 0, 0, 0, 1755, 0, 0], [-7866, 0, 0, 7254, -13484, 7254, -5232, 27056, 0, -9982, 0, 0, 0, -6998, 0, 0], [229528, 0, 0, -31347, 4126, -8802, 0, 0, 0, -21730, 0, 0, 0, 0, 0, 0], [0, -15567, 9381, 0, 0, 0, 0, 0, 0, 0, -2307, 34592, 15409, 0, 0, 15409], [338162, 0, 0, 6560, 12800, 1200, 0, 0, 0, -10400, 0, 0, 0, 0, 0, 0], [0, -23808, 58926, 0, 0, 0, 0, 0, -18185, 0, 0, 0, -19472, 0, -1698, 19472], [0, -31873, -45441, 0, 0, 0, 0, 0, 0, 0, 11009, 31634, 2081, 0, 0, 2081], [0, 43960, -169789, 0, 0, 0, 0, 0, 14886, 0, 0, 0, 16444, 0, 679, -16444], [-17421, 0, 0, 3393, -28248, 3393, 3168, 1872, 0, -4023, 0, 0, 0, -13785, 0, 0], [0, -8023, -32595, 0, 0, 0, 0, 0, 0, 0, -17411, -12872, 193, 0, 0, 193], [0, -7776, -15459, 0, 0, 0, 0, 0, -30164, 0, 0, 0, -19160, 0, 3141, 19160], [-6889, 0, 0, 1997, -6932, 1997, -20820, -8924, 0, 1721, 0, 0, 0, 15695, 0, 0], [0, 37651, 105319, 0, 0, 0, 0, 0, 0, 0, -14368, -17479, -12956, 0, 0, -12956]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_100_d_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_100_5_d_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_100_5_d_c(:prec:=16)
    chi := MakeCharacter_100_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_100_5_d_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_100_5_d_c( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_100_d();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,5,sign)));
    Vf := Kernel([<3,R![27889920, 0, -3415680, 0, 73136, 0, -488, 0, 1]>],Snew);
    return Vf;
end function;