
// Make newform 128.5.f.a in Magma, downloaded from the LMFDB on 12 May 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_128_f();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_128_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_128_5_f_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_128_5_f_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 := [2097152, -1048576, 491520, -139264, 31744, -19968, 11456, -4960, 1432, -312, 62, -34, 15, -4, 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], [1279524864, -1316257792, 429211648, -51930112, 5960704, -11499840, 10623840, -4619080, 748984, -24954, 16062, -26581, 13444, -2875], [7904428032, -5795840000, 2235252736, -414198784, 58993664, -81223104, 63665440, -22287000, 4629992, -445086, 92170, -216535, 81068, -11609], [45595492352, -17134354432, 2196488192, -180005888, 133770240, -398883776, 170800160, -35554520, 877992, -197678, 959162, -482591, 167756, 23279], [-3419275264, -494927872, 637231104, -170023936, 5933568, 24398016, -34400, -3340360, 1232776, 122070, -10778, 13019, 6652, -3499], [20694433792, -16046653440, 4972855296, -982549504, 134759424, -203316544, 150852960, -53625160, 9651512, -1159226, 537790, -396085, 175428, -30299], [359268352, -93421568, 7045120, -7527424, 5232640, -3000512, 1252384, -206648, 936, -18854, 8306, -3179, 588, 187], [-123104133120, 52640448512, -7324450816, -2507641856, 531149824, 1063292352, -675003680, 151698840, -5702120, -5318178, -2827082, 2372471, -666028, 54457], [4344512512, -16313188352, 7022559232, -922754048, 199142400, -67802816, 157086880, -70629560, 16189512, -1485958, 303682, -325931, 248956, -63941], [-1804861440, 423264256, -46219264, -7715840, -9518080, 13415232, -4973408, 410632, 156488, 21354, -30894, 16237, -1028, -1373], [-98412789760, 35844947968, 1135230976, -1198050304, 16526336, 569406528, -288799200, 15561640, 15043880, -2291022, -871398, 819089, -163572, -60737], [139540561920, 6744604672, -12649414656, 4742575104, 198482944, -991562688, 55001120, 130720680, -59111000, 2939442, 1949018, -780399, -198708, 191167], [33873985536, -41333391360, 12085280768, -2131233792, 682642432, -547344832, 393864480, -152847000, 32206056, -3926878, 2145610, -1270135, 484524, -107577], [31120424960, 11285659648, -10052583424, 2863123456, -344812544, -122103872, -34664480, 64026840, -32112040, 1410158, 473862, -236161, -103372, 108593]];
    Rf_basisdens := [1, 678952960, 678952960, 678952960, 84869120, 678952960, 2424832, 678952960, 678952960, 9699328, 339476480, 678952960, 339476480, 339476480];
    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_128_f();"
function MakeCharacter_128_f()
    N := 128;
    order := 4;
    char_gens := [127, 5];
    v := [2, 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_128_f_Hecke();"
function MakeCharacter_128_f_Hecke(Kf)
    N := 128;
    order := 4;
    char_gens := [127, 5];
    char_values := [[-1, 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]];
    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, 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, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [7, 7, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0], [1, 1, 1, 0, -1, 0, 0, 0, 0, -1, -1, -1, 0, 0], [-2, 0, 2, 1, 0, -2, 1, -1, -1, 3, -1, 1, 0, 1], [-49, 49, 0, 0, 2, 0, -2, 1, 5, -2, 0, 0, 2, 2], [-76, 0, 4, 8, 0, -4, -6, 2, -8, -3, -1, -2, 0, 1], [-56, -56, -36, 3, 6, 0, -2, 0, 0, 6, -4, 0, -2, 0], [0, 20, 4, 16, 4, 4, 0, -2, 16, 0, 3, -2, 2, 3], [115, -115, 0, 0, -13, -59, 8, -5, -2, 13, 0, 0, -8, 3], [0, -6, 67, 11, -12, 67, 0, -5, 11, 0, -3, -5, -2, -3], [112, 112, 7, -40, 8, 0, -4, 0, 0, 8, 4, 0, -4, 0], [0, 400, 18, -34, 0, 18, 0, -4, -34, 0, -1, -4, 2, -1], [65, -65, 0, 0, 3, 187, -2, 9, 4, -3, 0, 0, 2, -3], [-194, -194, -39, 50, 6, 0, 22, 0, 0, 6, -10, 6, 22, 0], [303, 303, -261, -14, -5, 0, 10, 0, 0, -5, 13, -7, 10, 0], [573, -573, 0, 0, 44, -50, -16, -5, -5, -44, 0, 0, 16, -24], [-1484, 0, 84, -8, 0, -84, 10, -30, 8, -3, 7, 30, 0, -7], [0, 242, 243, -80, 41, 243, 0, 20, -80, 0, 16, 20, 17, 16], [0, 2172, -174, 2, 20, -174, 0, 22, 2, 0, -10, 22, 28, -10], [-1236, 1236, 0, 0, 30, -3, 22, -4, -16, -30, 0, 0, -22, -14], [0, 534, -295, -44, -81, -295, 0, 0, -44, 0, -4, 0, 31, -4], [74, 0, -248, -105, 0, 248, -15, 37, 105, 23, -7, -37, 0, 7], [1649, -1649, 0, 0, -39, -297, 64, 25, -16, 39, 0, 0, -64, 1], [-3772, 0, -304, 68, 0, 304, 22, 34, -68, 5, 9, -34, 0, -9], [3853, 3853, 10, 205, 156, 0, 4, 0, 0, 156, 4, 5, 4, 0], [-764, -764, 428, -21, -24, 0, -84, 0, 0, -24, 4, -20, -84, 0], [-322, 0, 86, -252, 0, -86, 2, -16, 252, -78, -12, 16, 0, 12], [0, -7060, -124, -96, 116, -124, 0, 34, -96, 0, 61, 34, 78, 61], [7093, -7093, 0, 0, 156, 174, 28, 51, 187, -156, 0, 0, -28, 100], [0, -1538, -299, -449, -102, -299, 0, -69, -449, 0, -31, -69, -108, -31], [7586, 7586, 61, 298, -196, 0, -44, 0, 0, -196, 84, -62, -44, 0], [-1098, 1098, 0, 0, 228, -434, 50, -18, 183, -228, 0, 0, -50, 10], [12292, 0, 800, 116, 0, -800, -122, 34, -116, 69, 33, -34, 0, -33], [-1439, -1439, 837, -100, 5, 0, -106, 0, 0, 5, -13, -185, -106, 0], [8772, -8772, 0, 0, -92, -83, -176, 60, 188, 92, 0, 0, 176, -56], [-18272, 0, -1352, 24, 0, 1352, -40, -64, -24, 81, 4, 64, 0, -4], [4493, 4493, -1195, 140, -189, 0, 56, 0, 0, -189, -13, 43, 56, 0], [-11404, 11404, 0, 0, -198, 365, 174, -12, 472, 198, 0, 0, -174, -14], [2830, -2830, 0, 0, 4, -1378, -78, 142, 15, -4, 0, 0, 78, 82], [0, -22996, -520, 164, -276, -520, 0, -134, 164, 0, -129, -134, -70, -129], [-1758, 0, 1668, 455, 0, -1668, -227, 221, -455, -269, -7, -221, 0, 7], [-1752, 1752, 0, 0, -228, 1320, 20, 160, -191, 228, 0, 0, -20, -64], [-22872, 0, 2320, -840, 0, -2320, 12, 52, 840, -183, 146, -52, 0, -146], [-15762, 15762, 0, 0, -90, -625, 62, 138, 46, 90, 0, 0, -62, -166], [0, -24804, 336, 948, 84, 336, 0, 258, 948, 0, -45, 258, 450, -45], [23676, -23676, 0, 0, 84, -691, 92, -76, -900, -84, 0, 0, -92, -60], [-122, 122, 0, 0, 482, 626, -332, 230, -589, -482, 0, 0, 332, 222], [0, 3354, -1697, 812, 873, -1697, 0, 176, 812, 0, -28, 176, 345, -28], [0, 23060, 3942, -74, -324, 3942, 0, 18, -74, 0, -94, 18, -268, -94], [-8810, 0, -866, -471, 0, 866, -459, 31, 471, -297, 23, -31, 0, -23], [-25208, -25208, 375, 836, -66, 0, -22, 0, 0, -66, -302, -176, -22, 0], [2342, 0, 970, 424, 0, -970, 178, -108, -424, 954, 0, 108, 0, 0], [-20628, 0, 3628, 328, 0, -3628, 454, 110, -328, 741, -159, -110, 0, 159], [-21808, -21808, 1280, 23, -612, 0, -140, 0, 0, -612, -264, -72, -140, 0], [0, 29800, -4518, -1066, -992, -4518, 0, 16, -1066, 0, 173, 16, -314, 173], [-16093, 16093, 0, 0, -267, 2993, 118, 179, 962, 267, 0, 0, -118, 495], [0, -12646, -157, 80, -963, -157, 0, 64, 80, 0, -240, 64, -451, -240], [-21349, -21349, 1804, -1905, -282, 0, -198, 0, 0, -282, 386, -325, -198, 0], [8200, -8200, 0, 0, -168, -3616, -152, -608, 1081, 168, 0, 0, 152, -184], [-23315, 23315, 0, 0, 606, 390, -498, 723, -2793, -606, 0, 0, 498, 138], [14704, 0, -3620, -1044, 0, 3620, -292, 176, 1044, -183, -374, -176, 0, 374], [0, -6946, -655, 357, 1064, -655, 0, -203, 357, 0, 163, -203, -450, 163], [710, 710, -5630, -975, 576, 0, -306, 0, 0, 576, -130, -54, -306, 0], [6139, 6139, 3540, 4011, 960, 0, -252, 0, 0, 960, 108, 195, -252, 0], [-18182, 0, 1388, -924, 0, -1388, -936, 308, 924, 464, -140, -308, 0, 140], [-18458, -18458, -2343, -550, 138, 0, -74, 0, 0, 138, 302, 462, -74, 0], [-11068, -11068, -6968, 1959, 766, 0, -246, 0, 0, 766, 248, -100, -246, 0], [16366, 0, -2546, 656, 0, 2546, 1054, 292, -656, 102, -240, -292, 0, 240], [5924, 0, -5688, 1404, 0, 5688, 110, 258, -1404, -1131, -67, -258, 0, 67], [0, 31480, 5302, -1318, 0, 5302, 0, 96, -1318, 0, 67, 96, 1210, 67], [39925, -39925, 0, 0, -245, 7735, -302, 21, -1096, 245, 0, 0, 302, 73], [22730, 22730, 1733, -3674, 822, 0, 898, 0, 0, 822, 122, 258, 898, 0], [0, 9456, -900, -660, 1608, -900, 0, 528, -660, 0, -54, 528, -228, -54], [-42321, 42321, 0, 0, -981, -9055, -580, 407, 1178, 981, 0, 0, 580, -153], [-54038, -54038, 9402, 433, 402, 0, 196, 0, 0, 402, 334, -898, 196, 0], [17734, 0, 1974, -1863, 0, -1974, 605, -353, 1863, 255, 503, 353, 0, -503], [0, -16610, 1433, -323, -1472, 1433, 0, 165, -323, 0, 299, 165, -682, 299], [-15001, 15001, 0, 0, 1296, 4064, -392, -127, -815, -1296, 0, 0, 392, -808], [51494, -51494, 0, 0, 542, -4446, -112, 974, 3787, -542, 0, 0, 112, -794], [0, -69396, 3930, -366, -84, 3930, 0, -418, -366, 0, -518, -418, -668, -518], [22286, 0, -1638, 3701, 0, 1638, 613, 107, -3701, 1487, 299, -107, 0, -299], [-42496, 0, -1480, 3640, 0, 1480, -88, -528, -3640, 145, 284, 528, 0, -284], [14639, 14639, -4896, 1443, -822, 0, -118, 0, 0, -822, 106, 399, -118, 0], [-10422, 0, 5224, -1737, 0, -5224, -751, 261, 1737, 2103, 169, -261, 0, -169], [0, 26042, -5605, 2627, 1324, -5605, 0, -421, 2627, 0, 261, -421, 790, 261], [-79334, -79334, -1574, -103, 1854, 0, 1544, 0, 0, 1854, -90, 822, 1544, 0], [0, -70932, -2066, -3634, 1948, -2066, 0, 294, -3634, 0, -80, 294, -488, -80], [12993, -12993, 0, 0, 1410, -10110, -1442, 1151, 3779, -1410, 0, 0, 1442, -14], [0, 139132, -912, 1172, -12, -912, 0, -110, 1172, 0, 411, -110, 1362, 411], [63256, 0, -1276, -4900, 0, 1276, -752, 532, 4900, -2655, 168, -532, 0, -168], [-42206, -42206, 421, -2342, 1656, 0, 220, 0, 0, 1656, -716, -190, 220, 0], [73666, -73666, 0, 0, -342, -5285, -154, 22, -2486, 342, 0, 0, 154, 762], [-148524, 0, 940, 1360, 0, -940, -990, 610, -1360, -1107, -37, -610, 0, 37], [31691, 31691, -793, 4070, 939, 0, -130, 0, 0, 939, -391, -1019, -130, 0], [0, -28202, -8223, 4283, -1998, -8223, 0, -1249, 4283, 0, -1243, -1249, -1276, -1243], [-102611, -102611, -11206, 789, -1432, 0, -1056, 0, 0, -1432, -32, -1259, -1056, 0], [-34545, -34545, 4627, -4374, -105, 0, 822, 0, 0, -105, -1579, 2009, 822, 0], [-101163, 101163, 0, 0, -2688, 15750, 244, 211, 2699, 2688, 0, 0, -244, 20], [146395, 146395, 3331, 9242, -507, 0, -1976, 0, 0, -507, -11, -1219, -1976, 0], [51587, -51587, 0, 0, -1314, 8468, -486, 1149, 265, 1314, 0, 0, 486, 886], [0, -39062, 15423, -1627, -690, 15423, 0, -1215, -1627, 0, 283, -1215, -1604, 283], [104547, 104547, -10996, -2441, -118, 0, -758, 0, 0, -118, -2230, -1437, -758, 0], [-10622, 0, 16480, -700, 0, -16480, 172, -180, 700, -1708, -1004, 180, 0, 1004], [-38815, -38815, 19358, 2641, -2376, 0, 1180, 0, 0, -2376, 1044, 57, 1180, 0], [-62366, 0, -12288, 948, 0, 12288, -1140, -1060, -948, 5268, -276, 1060, 0, 276], [-210936, 0, -5628, -1108, 0, 5628, -424, -628, 1108, -2319, 1124, 628, 0, -1124], [0, 28030, 3453, -1716, 3515, 3453, 0, 1344, -1716, 0, -1404, 1344, 2187, -1404], [0, 26272, -1072, 872, -4648, -1072, 0, 1568, 872, 0, 660, 1568, -3896, 660], [117738, -117738, 0, 0, -502, -2674, -664, -270, -6953, 502, 0, 0, 664, -1414], [0, -39906, -16407, -2700, -3981, -16407, 0, 604, -2700, 0, 1820, 604, -421, 1820], [-156965, -156965, 2348, 5339, 1044, 0, -1348, 0, 0, 1044, -276, -349, -1348, 0], [-52796, 0, 3640, -852, 0, -3640, 4494, -1742, 852, 2357, -1699, 1742, 0, 1699], [3946, 0, 6120, -1413, 0, -6120, -435, -559, 1413, -5157, 1509, 559, 0, -1509], [-118967, 118967, 0, 0, 3844, 4938, 352, -1649, 9455, -3844, 0, 0, -352, -952], [179388, 0, -6992, 124, 0, 6992, -3798, 1246, -124, -1347, 1463, -1246, 0, -1463], [-263492, -263492, 10764, 3171, 2688, 0, -316, 0, 0, 2688, 1324, 460, -316, 0], [61720, -61720, 0, 0, 1398, 20313, 294, 1072, -6332, -1398, 0, 0, -294, -2094], [-200810, 200810, 0, 0, -648, -5490, 1270, -1802, 8831, 648, 0, 0, -1270, -3166], [72218, 0, 12128, -2861, 0, -12128, -115, 489, 2861, -3349, 1469, -489, 0, -1469], [109075, -109075, 0, 0, 3555, -22715, -2952, 2715, 8318, -3555, 0, 0, 2952, 2243], [13940, 13940, -2453, 4772, 5280, 0, 1944, 0, 0, 5280, 872, 2868, 1944, 0], [164750, -164750, 0, 0, -1270, 15967, 3018, -3910, -2874, 1270, 0, 0, -3018, 206], [72225, 72225, 173, -6324, -3411, 0, 694, 0, 0, -3411, 579, 1871, 694, 0], [-129623, 129623, 0, 0, -6471, -23017, 2384, -567, -9368, 6471, 0, 0, -2384, -535], [0, -207308, 25614, -3178, 1572, 25614, 0, 898, -3178, 0, 786, 898, 228, 786], [26648, 0, -15936, -3016, 0, 15936, 2212, 332, 3016, -3527, 326, -332, 0, -326], [-7646, -7646, -31482, 7301, -1840, 0, 2810, 0, 0, -1840, -1174, -1058, 2810, 0], [-68154, 68154, 0, 0, -4060, -31441, 1816, -1462, -262, 4060, 0, 0, -1816, -768], [240008, 0, 18048, -2136, 0, -18048, 1292, -1404, 2136, 9, 1730, 1404, 0, -1730], [0, -69908, -25590, 3826, -1380, -25590, 0, -2338, 3826, 0, -182, -2338, -6268, -182], [273554, -273554, 0, 0, 868, 31882, -1938, 1082, -1917, -868, 0, 0, 1938, 254], [0, 32222, -17903, -1047, 2364, -17903, 0, 1593, -1047, 0, -369, 1593, -950, -369], [18618, 0, -2608, 5995, 0, 2608, 1253, -1455, -5995, 10483, 485, 1455, 0, -485], [-150439, 150439, 0, 0, 3993, -18825, 4592, -2103, 4952, -3993, 0, 0, -4592, 2585], [1764, -1764, 0, 0, 3070, 31965, -4078, 2612, 7312, -3070, 0, 0, 4078, 2206], [-84537, -84537, -49365, -7414, -3405, 0, -878, 0, 0, -3405, 917, -2999, -878, 0], [0, 87450, 3683, 7615, 3528, 3683, 0, -1249, 7615, 0, 1017, -1249, -2230, 1017], [-97599, -97599, -9554, -3735, -3556, 0, -2160, 0, 0, -3556, -3352, -2839, -2160, 0], [319305, -319305, 0, 0, -4305, 14419, 1074, -5671, 6660, 4305, 0, 0, -1074, -1411], [38800, 0, 17500, 5036, 0, -17500, -2708, -1728, -5036, 1321, 274, 1728, 0, -274], [-152257, -152257, -20808, -1701, -5166, 0, -794, 0, 0, -5166, 2126, -2257, -794, 0], [35851, 35851, -38601, -9802, 2387, 0, -1786, 0, 0, 2387, -3895, -1979, -1786, 0], [85984, 0, -16788, -4052, 0, 16788, -972, 8, 4052, 1977, 558, -8, 0, -558], [-317423, 317423, 0, 0, -1185, 39859, 2898, 1577, -10452, 1185, 0, 0, -2898, 1205], [0, -37422, 16411, 4181, 3186, 16411, 0, -2815, 4181, 0, 251, -2815, -7008, 251], [70082, 70082, -46723, 12438, -230, 0, 2358, 0, 0, -230, 142, -5366, 2358, 0], [0, 164212, -7012, 5688, -1500, -7012, 0, -2178, 5688, 0, 2655, -2178, -790, 2655], [402886, 402886, 47790, -12771, -2450, 0, -2556, 0, 0, -2450, -2142, -2982, -2556, 0], [41498, 0, 17804, -13608, 0, -17804, 7908, -240, 13608, 10596, -1136, 240, 0, 1136], [4605, -4605, 0, 0, 910, -13730, 3370, 2163, 11231, -910, 0, 0, -3370, 310], [69512, 0, 15168, 15048, 0, -15168, 4460, 1284, -15048, 8745, 866, -1284, 0, -866], [48684, 48684, -55181, -11292, 8852, 0, 996, 0, 0, 8852, 2852, 6044, 996, 0], [0, 23280, 28190, -3230, 7632, 28190, 0, 260, -3230, 0, -1791, 260, 1022, -1791], [307052, 0, -15544, -7388, 0, 15544, -4006, 2790, 7388, -4547, 815, -2790, 0, -815], [248402, 0, 6476, -3045, 0, -6476, 3185, 1097, 3045, 2415, -267, -1097, 0, 267], [0, 267898, -19009, 15668, -1087, -19009, 0, 296, 15668, 0, 1980, 296, 4225, 1980], [442812, 442812, -28300, 3987, -3576, 0, -2044, 0, 0, -3576, -196, 2964, -2044, 0], [-398147, 398147, 0, 0, -210, 19382, -1586, -2045, -22969, 210, 0, 0, 1586, -886], [0, -117870, 18499, -3955, 12714, 18499, 0, 1233, -3955, 0, 259, 1233, 3608, 259], [-496048, 0, -392, 7592, 0, 392, 832, -4584, -7592, 513, 3280, 4584, 0, -3280], [303482, 303482, 57917, 106, -4260, 0, -4624, 0, 0, -4260, -2776, -3542, -4624, 0], [-87738, 0, -32986, 12509, 0, 32986, -23, 4395, -12509, 9843, 2867, -4395, 0, -2867], [-121824, 0, -7380, 7148, 0, 7380, -2796, 552, -7148, -5031, -1506, -552, 0, 1506], [0, -486024, -20724, -2788, 8648, -20724, 0, 1276, -2788, 0, -3112, 1276, 5824, -3112], [278753, -278753, 0, 0, -6907, -3993, 1868, -2719, -22472, 6907, 0, 0, -1868, 3769]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_128_f_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_128_5_f_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_128_5_f_a(:prec:=14)
    chi := MakeCharacter_128_f();
    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_128_5_f_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_128_5_f_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_128_f();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,5,sign)));
    Vf := Kernel([<3,R![2016379008, 43496175744, 469137324096, -34747646976, 1358008416, 786717792, 409777200, -14203392, 551960, 288664, 62860, 448, 2, 2, 1]>],Snew);
    return Vf;
end function;