
// Make newform 300.5.c.b in Magma, downloaded from the LMFDB on 20 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_300_c();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_300_c_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_300_5_c_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_300_5_c_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 := [4294967296, -1610612736, 335544320, -113246208, 32243712, -8847360, 1884160, -632832, 234752, -39552, 7360, -2160, 492, -108, 20, -6, 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], [-91883040669696, 49525033009152, 8277215674368, -5466618593280, -579352461312, 247514284032, 46803376128, -10408187136, -1871005056, -107470272, 386713392, -30915852, -17236980, -419412, 1177062, -22761], [2036619804672, -1341573300224, 1190882443264, 118742056960, -98598322176, -16265150464, 6049992704, 674989312, -105520768, -57734336, 1251056, 7032284, -410780, -410316, 746, 21677], [-30036719566848, -1341573300224, 1190882443264, 2791520337920, -98598322176, -16265150464, 6049992704, 674989312, -105520768, -57734336, 1251056, 7032284, -410780, -410316, 746, 21677], [-1621026286862336, 634581954854912, -22392426463232, 637742612480, -6616495357952, 1942748332032, -335353413632, 73112360704, -42390216576, 4237170368, 617126032, 269177748, -139010900, 17073788, -2497938, -109161], [-8782637694976, 20061389586432, -3572647329792, -356226170880, 295794966528, 48795451392, -18149978112, -2024967936, 316562304, 173203008, -3753168, -21096852, 1232340, 1230948, -2238, -65031], [597877969649664, 517403670740992, -317222417334272, 2510022246400, 1279264882688, 3794299502592, -966521116672, 141704772864, -29554953856, 21538701248, -3305599408, -270249492, -142283500, 62915828, -4691478, 699729], [-11637750759424, 4618734010368, -1410993225728, 455715061760, -72525611008, 11648237568, -7138510848, 2470986496, -551716224, 93980992, -27159632, 6009172, -454100, 241292, -105482, 16351], [-2265573908021248, 751684808605696, 29091843538944, 18693416550400, -13983082151936, 2144612663296, -440713701376, 177359884032, -64428230528, 5667009344, 84682736, 699098404, -156454180, 5696444, -4346834, 528347], [1937016023416832, 579146912628736, -113014531424256, -15751914455040, 3541552922624, -456613249024, -812485687296, -65625180928, 20024460672, 13491647424, 1107584336, -39385396, 59858740, 34112084, -11482214, -1660583], [1053528902598656, -712848841900032, 246835725729792, -44969388933120, -1017690390528, -2210368438272, 1161470072832, -250126258944, 62880326016, -15539076928, 3773057808, -206745588, 66251380, -71945868, 15383658, -1668199], [-1917097173057536, 403359706120192, -111042229174272, 45681956618240, -8632613404672, 1605397184512, -733386637312, 281339002624, -54975181696, 7081148608, -2576039408, 635794548, -103582260, 29651228, -10261698, 1651199], [-80052016381952, 199582667505664, 164881567318016, -36538636042240, 1798418661376, -986195705856, 1342089216, -247700366592, 25054599808, -5793879744, 3576049264, -228275884, 50899500, -3207764, 7613094, -3400017], [-386897901780992, -47861236498432, 30237331030016, -2502974767104, 780827033600, 197005836288, 78454321152, -27023719168, 2203154816, -2666809024, 338099312, -18736100, 7231524, -203980, 2146026, -362307], [4459902227447808, -1065137897209856, 176630483910656, -46545584783360, 16930287845376, -5661721051136, 960995076096, -416548658432, 114776696448, -14708375744, 3260490224, -805581644, 291078860, -63863604, 8732214, -1827337], [1607357956096, 77615771680768, -27160124325888, 2757534679040, -853910028288, 322552496128, -83272363008, 25508211456, -6334100864, 2041696512, -341380192, 26117452, -16702380, 3714332, -1253922, 244581]];
    Rf_basisdens := [1, 21382226247680, 2672778280960, 2672778280960, 10691113123840, 2672778280960, 21382226247680, 334097285120, 10691113123840, 21382226247680, 21382226247680, 10691113123840, 21382226247680, 2138222624768, 10691113123840, 1336389140480];
    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_300_c();"
function MakeCharacter_300_c()
    N := 300;
    order := 2;
    char_gens := [151, 101, 277];
    v := [1, 2, 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_300_c_Hecke();"
function MakeCharacter_300_c_Hecke(Kf)
    N := 300;
    order := 2;
    char_gens := [151, 101, 277];
    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], [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, 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, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0], [0, 0, 3, 1, 0, -2, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0], [-10, 0, -3, 0, 0, 2, 1, -1, 1, 1, -2, 0, 0, 0, 0, 0], [-1, 1, 16, 0, -1, -3, -1, -9, -2, -2, 0, 2, 2, 2, 1, 3], [-12, 15, 23, 3, -4, 0, 0, 7, 0, 0, -2, 1, 4, 2, -1, 0], [-16, -18, 26, -1, 3, 5, -1, 5, -5, 0, 7, 1, 2, -4, 2, 5], [135, 4, -66, 6, 0, 0, 3, 2, -3, 0, 7, -2, -2, -2, 2, -6], [-18, -34, 57, -7, -1, -4, 1, -4, 1, 0, -2, -1, -12, -7, -1, -1], [68, -16, 65, 1, 9, -10, -5, 1, -5, 6, 6, 3, -7, -7, -3, -11], [107, 5, -78, -10, 5, 1, 3, -27, -10, 10, -2, 8, 0, 0, -5, 5], [-18, -7, 92, 2, 23, 22, 17, -6, 1, 0, 18, -6, -27, 1, -2, -1], [52, 28, -162, 0, -12, 54, -32, -14, -8, 0, 14, 12, 4, -14, -6, 8], [87, 2, -98, 12, -12, -30, 19, -24, 15, -18, -23, 16, 16, 16, 14, 18], [-44, 26, 154, -26, -6, 64, 6, -54, 14, 0, -4, 14, -14, -14, -2, -14], [-244, 36, -92, -5, 31, 56, -14, 26, -58, -1, 32, -31, -21, -21, -13, -29], [-24, -191, 143, -41, -10, 116, 22, -75, 38, 0, -22, 29, -32, 0, 3, -38], [-64, -42, 120, -9, -63, -141, -3, 63, 17, 0, -83, -3, 8, 8, 0, -17], [-772, -14, 101, -3, -17, 40, -25, 107, 33, 34, 52, -37, -23, -23, -13, -33], [-36, -158, -36, 64, -18, 140, -62, 74, -46, 0, 76, 16, 24, -14, -32, 46], [-96, 334, -6, 32, -30, 98, 10, 164, -6, 0, -6, 52, 84, 60, 34, 6], [-196, -114, 346, 6, 44, -150, -10, 52, 4, -20, -10, 46, -14, -14, -4, -24], [-123, -76, -597, 53, -11, -266, 35, -69, 3, -4, 80, 95, 5, 5, 29, -19], [-299, 60, 780, 54, 28, 120, -49, -92, -103, -70, 9, -62, -2, -2, 26, -30], [420, -34, -1032, 38, -8, 198, -84, -124, 4, 0, 42, 26, 40, 14, -28, -4], [-388, -310, 657, 63, -54, 450, 14, 269, -10, 0, 64, 117, 26, 62, 9, 10], [-1664, -12, 739, -68, -44, -142, -107, -235, -67, 11, 128, 68, 36, 36, -16, 88], [-296, -30, 618, 82, -92, -82, -30, -536, -20, 80, 94, 90, 38, 38, 60, 16], [-510, 484, 957, -35, -3, 716, -5, 11, -37, 0, 166, 163, 87, -41, 31, 37], [192, -38, -907, -11, 78, -284, -42, 259, -106, 0, 54, -25, 48, -12, 105, 106], [-7400, -194, 104, -72, -86, -318, -2, -254, 140, 152, 32, 192, 36, 36, -18, 90], [30, 558, -341, 57, 25, 570, -21, 273, -21, 0, 140, 119, -113, 61, 25, 21], [4218, -274, -144, -46, -12, -230, -34, 574, 220, 138, 148, 6, -98, -98, -72, -124], [-582, -148, 1305, -37, 199, -306, 117, 34, -131, 0, 156, -91, 122, -85, 83, 131], [3870, -196, -1689, 2, 58, -446, 137, 525, 153, -67, -52, 110, -22, -22, -10, -34], [918, 55, -1954, 40, -29, 138, -363, -668, -91, 0, 178, -76, 49, -243, -192, 91], [404, -146, -970, -1, 237, 737, 69, -81, 1, 0, 259, 97, -106, 74, 74, -1], [407, 82, -400, 132, 116, -114, 81, -850, -323, -56, -55, 160, 40, 40, 86, -6], [316, 678, -214, 104, 24, 350, -28, -784, 60, 0, 86, -32, 334, 10, -154, -60], [-7490, 296, -4018, 19, -33, 168, 402, 596, 246, -223, -478, -63, 107, 107, 63, 151], [100, 2158, -798, 385, 51, -365, 43, 975, -113, 0, 65, -85, 4, 286, 14, 113], [387, -334, 21, -151, 67, -40, -5, 355, 221, 334, -8, 47, -139, -139, -145, -133], [17034, -166, 3234, 244, -198, -430, -128, -908, 2, -162, 72, 196, 168, 168, 206, 130], [-2112, -180, 5072, 18, 14, 18, 438, 395, 30, 0, -50, 46, 231, 128, 80, -30], [-1890, 63, 5796, 102, 131, -374, 557, -160, 141, 0, -82, -210, -37, 105, -138, -141], [1182, -1700, -2185, -587, -11, 234, 159, -1008, 407, 0, -452, 179, -160, 33, 213, -407], [636, 954, -3603, 205, -348, 16, -576, 1103, -312, 0, 66, 203, 354, -6, 101, 312], [20502, 348, -4846, 329, -355, -172, 616, -1696, 204, 51, -480, 427, 345, 345, 337, 353], [-15075, 737, -2786, 26, -399, -251, 9, -1467, -380, -198, 408, 212, 348, 348, 187, 509], [820, 1218, -884, -275, 309, 133, -59, -347, 17, 0, 227, -145, -1154, -338, -80, -17], [20433, 284, -9341, 351, 119, 70, 455, 1335, -17, 174, 552, -275, -337, -337, 7, -681], [300, -5012, -2102, -168, -276, 474, -136, 420, 40, 0, -222, 372, 414, 150, 278, -40], [-18906, 188, 4748, 576, 144, 1152, -106, -592, -318, -144, -186, -468, -120, -120, 228, -468], [-1344, 2590, 1372, 843, -399, -885, -115, 2187, -335, 0, -51, -63, 624, 432, -76, 335], [18555, 52, 1862, -134, 372, 620, -261, 1314, -271, -144, 99, -482, -270, -270, -202, -338], [-3480, 5638, 9142, -680, -274, 1450, 638, -210, 422, 0, -350, 480, -406, -124, 134, -422], [30472, 1000, -10941, -284, 92, 1622, 463, 1185, -57, 643, 178, -596, -332, -332, -308, -356], [2065, -529, 7850, -266, 511, -253, -769, -429, -788, 86, 544, 36, -268, -268, -267, -269], [3546, 1509, -5260, 66, 513, -1642, 511, -1372, 639, 0, -574, -662, -931, 491, -214, -639], [18496, 602, -3316, 94, -536, 1058, 380, -786, 502, 398, -350, -138, 194, 194, 144, 244], [-3570, 585, 10274, 324, -249, -2806, 433, 42, -63, 0, -454, -752, 211, -223, -484, 63], [2572, 3164, -8282, 138, -774, 1212, -1362, 316, -274, 0, 128, 438, 124, -326, -190, 274], [-16213, -950, 14810, 246, 124, 1126, -460, 440, 642, -20, -980, -466, -134, -134, 56, -324], [37138, 534, 1110, -794, 232, 374, -240, 160, -458, -364, -404, -54, 194, 194, -300, 688], [-7020, -12324, 17824, -156, -86, 1284, 774, 856, -90, 0, 380, 164, -678, -458, -212, 90], [-45989, 1522, -11750, -136, 774, 1662, 624, 1564, -978, -458, -404, -756, -260, -260, -198, -322], [1220, -7494, 1736, -770, 516, -3662, 1160, -450, 904, 0, -1322, -946, -2806, 122, -12, -904], [34166, 560, -1594, 298, 810, 1108, -22, 2478, -790, -776, 52, -978, -454, -454, -78, -830], [-10861, -229, -3484, -40, 617, 43, 623, 2017, 308, -518, -1282, -102, -98, -98, -69, -127], [1924, 5302, -5506, 149, -609, -2641, -129, 2325, 243, 0, -1195, -197, -986, 538, 146, -243], [-3096, 7718, 8942, -112, 6, -3390, 582, 545, -50, 0, -566, -768, -537, -308, -146, 50], [30554, -676, 12760, -831, -847, 600, -528, -3502, 968, 1273, -830, 691, 497, 497, -167, 1161], [-2238, -5389, 6318, -28, -167, -1698, 831, 1744, 367, 0, -834, -232, -1165, 407, 68, -367], [-1308, -9424, 8580, -692, 1074, -1436, 1334, -1016, 582, 0, -132, -856, -3042, -342, -232, -582], [13915, 528, 4750, -716, -398, -484, -269, -2358, -263, -562, -681, 632, 820, 820, 52, 1588], [53590, 2076, -13090, 623, -241, 956, 1282, -1144, -390, -1179, -1242, -131, 687, 687, 655, 719], [46457, -1201, 8168, -272, -187, -1813, -161, -815, 684, -326, -830, 910, 462, 462, 95, 829], [-25867, 2394, -8569, 233, -1069, 2436, 225, -2127, -349, 392, 752, -689, 357, 357, 295, 419], [-76, -3018, 1115, -293, 96, -1892, 1172, -735, 724, 0, -1238, -127, 1130, 914, 483, -724], [-50348, 1044, -27569, -305, -77, -594, 1497, 2523, 469, 370, 274, 149, -129, -129, -217, -41], [6180, 13294, -9922, -1793, 1869, 1657, 549, -5099, 785, 0, 507, -175, -2040, -606, 402, -785], [6613, 1366, 11582, 132, 46, -1990, -1112, -3492, -2542, -2898, 516, 536, 1168, 1168, 650, 1686], [-4710, -676, 14449, -151, 1313, -228, 807, -1810, -521, 0, 1406, -785, -340, -1029, -357, 521], [-2912, 13040, 11942, -1502, -204, -800, 1348, -5122, 1260, 0, -1516, -118, 1156, -308, -66, -1260], [-20310, -186, -6166, 714, -468, -450, 1568, -3140, 1110, 156, -2240, 1102, 694, 694, 704, 684], [-34626, 344, -17669, 579, -1129, 106, 1847, 555, 2227, 618, -1212, 313, 395, 395, 487, 303], [-59049, -394, 12540, -422, -618, 3662, -1139, 3730, 1601, 1494, 693, -1922, -810, -810, -616, -1004], [2544, -12902, -10894, 1972, -1638, -1526, -910, 3278, -118, 0, -1110, 260, 2818, 1704, -150, 118], [11016, -13172, -25739, -861, 1548, 810, -988, -2499, -20, 0, 912, -159, -1776, -384, 497, 20], [-6508, 12484, 6476, 1236, -1014, 1476, -930, 8234, -1682, 0, 1132, 1056, 476, 146, 592, 1682], [-762, 15880, 1151, -1115, 441, 1978, 827, 254, 419, 0, -132, 779, -578, 237, 933, -419], [3868, -22432, -10440, 550, -228, -1514, -40, -3074, 304, 0, -838, -70, 4690, 1090, 236, -304], [-5580, -747, 13711, 1443, 1236, 3184, 8, 2377, -1368, 0, 3070, -343, -1646, -734, -809, 1368], [-1076, -10294, 8916, 109, -1587, 385, -211, -3491, 1225, 0, -1393, -349, -1082, -434, -1768, -1225], [50630, 142, 10240, 3110, -160, 1354, 562, -5226, -664, -674, -760, -222, 178, 178, 1644, -1288], [31881, -2271, 3928, 1652, 855, 157, 597, 8471, 2152, -942, -1046, -1530, -1130, -1130, 261, -2521], [3576, 23289, -14283, -363, -1782, 3012, -2262, 2605, -294, 0, -282, 1479, -622, -384, 273, 294], [-30212, 4236, -17313, 2322, -2178, 3338, 1111, -3115, -269, -779, 1150, -1410, 858, 858, 1590, 126], [-2790, -16390, 12449, 971, 467, 4030, 1817, -3185, 1225, 0, 228, 69, 809, 1279, -917, -1225], [27520, -2500, 4624, 1190, 466, -4940, 428, 4024, 1128, -2482, -852, 858, 238, 238, 714, -238], [12940, 22620, -20975, -889, 2178, 2738, -698, -12495, 974, 0, 1376, -1067, -2, -1154, -1239, -974], [33481, -509, 8770, 18, -1049, -3513, -1797, -1297, -748, -382, 3648, 640, 280, 280, 149, 411], [-1992, -40739, 14143, -497, 1726, -4732, 3310, -907, 1550, 0, -1398, -1731, -3800, 896, -157, -1550], [23983, -1424, -25619, 1367, 1587, -2394, 1713, 4513, -75, 472, 928, 213, -1457, -1457, -45, -2869], [4100, -28678, -16133, 2067, -1332, 7872, -4656, -575, -2184, 0, 3598, 1149, 2294, -1714, -1597, 2184], [-31197, -501, -19700, -2764, 777, -1049, 1089, 7097, 1750, 330, -1856, 354, -182, -182, -1473, 1109], [5816, -116, -11492, -414, 1002, 5562, 626, 2106, 1146, 0, 454, 882, -5752, 1016, 284, -1146], [-43185, 3034, 9119, 657, -653, 4420, 797, -9991, -1305, -680, -3572, 215, 1645, 1645, 1151, 2139], [-16488, 26414, 34530, 2378, 424, 7224, 1824, 9508, -1328, 0, 2988, 1334, -826, 1148, 98, 1328], [44202, -1844, 36117, 2689, -607, 1002, -591, -6047, 665, -582, -1872, 115, 529, 529, 1609, -551], [11159, -2853, 1598, 1958, -925, -1841, -217, -1725, 1424, 2986, 3168, 580, -1156, -1156, 401, -2713], [10158, -5893, -23016, 782, -2553, 3214, -1951, -4140, 1633, 0, -2014, 902, 1783, 1145, -1270, -1633], [-3234, 25802, 9453, -877, 1529, -4846, -893, -2834, -1925, 0, 2032, -1819, -212, -3199, -397, 1925], [-75066, 3222, 10298, -4514, -528, 3998, -3912, 1108, -2626, 1536, 4448, -1878, -310, -310, -2412, 1792], [-8946, 24034, 16083, -1055, 2753, 6594, 2451, 7621, -973, 0, 2964, 1687, -3493, 421, 2449, 973], [-3660, 28852, 8654, -1706, -654, 7744, 558, -3062, 1022, 0, -84, 2138, 1110, -138, 546, -1022], [-88920, -2646, 33170, -1628, 1998, -4090, -2442, 3220, -1552, -3006, -658, 648, 152, 152, -738, 1042], [5880, 10002, -26263, 3849, -4302, 5676, -3934, 5995, -622, 0, -474, 2331, 4992, 2352, -875, 622], [78494, -1604, -1139, -1039, 4305, 3050, -287, 11529, -1367, 146, -760, -2541, -2879, -2879, -1959, -3799], [221400, -2318, 10007, 2511, -1847, -1620, 537, -5843, 2275, 1670, 188, 1337, 331, 331, 1421, -759], [-92465, 766, -41782, -5282, -254, -6262, 1067, -4004, -641, 2456, 777, 4418, 1162, 1162, -2060, 4384], [-7232, 45652, 14930, 5636, -462, 1658, -1206, 5580, -2286, 0, 3386, -1052, 2140, 736, -2614, 2286], [-972, -50196, -2272, -2880, -3906, -3424, 778, 4792, 2490, 0, -6304, 2056, -1050, 1574, 1964, -2490], [126331, 750, -18250, 2090, 1222, 5170, 4011, -6856, 423, 1952, -5835, 486, -170, -170, 960, -1300], [-17664, -2768, 4569, 2146, -1426, -854, 443, -1729, 2767, 2543, 1052, 502, -590, -590, 778, -1958], [-6632, 28898, 21656, -347, -1497, 1321, 2323, -865, 2271, 0, -2665, 503, -854, 1324, -600, -2271], [2208, 32284, -1012, -3164, -1944, 8032, -2536, -9247, 1016, 0, -120, 1700, -1181, -3288, -1140, -1016], [-202098, 352, -24474, 2362, 938, -2892, 2874, 3598, 218, -3288, -2316, 382, 394, 394, 1378, -590], [2100, -42544, 6418, -3238, 2698, -2768, 1142, -8726, 694, 0, 484, -1802, -4238, -2826, -282, -694], [-2904, -38092, 430, 2264, 582, 4202, 2022, 6884, 46, 0, 594, 1432, 2532, 3684, 1374, -46], [9990, 75192, -18257, -1701, -1709, -7296, -2355, -6319, 909, 0, -2890, -1531, -1615, -2051, -1259, -909], [-72416, -996, -2652, -261, -681, -2008, -1502, 8018, 1030, 199, 4336, -1239, -1029, -1029, -645, -1413], [-188444, 4392, -10092, 1868, 52, -872, -1076, -4676, -5556, -2968, 4760, -676, 444, 444, 1156, -268], [10041, -1758, 18140, 4436, 2474, -1766, 62, -230, -2708, -3452, -284, -584, -840, -840, 1798, -3478], [84253, 1728, -218, -1672, 2218, 604, -3943, 10122, -4941, -1006, 7777, -3332, -2440, -2440, -2056, -2824], [17298, -49661, -51052, 3670, -3967, -3046, -5513, 4398, -793, 0, -1666, 182, 2971, 1551, -1326, 793], [-198774, -1608, 6194, 1854, 2946, 288, 128, 5314, -1584, -1644, -554, -1370, -1634, -1634, 110, -3378], [333059, 3781, -63570, 358, 677, -3703, 2711, 9145, -1494, -3146, 2318, -472, -80, -80, 139, -299], [22236, -82173, -58895, 2817, -3744, -3692, -4564, -835, 732, 0, -3266, 83, 4548, 2422, -1127, -732], [132628, 7354, -32948, -2378, 208, -2086, -2588, 5918, -6746, -4594, 8050, -2010, 410, 410, -984, 1804], [-23094, -50434, 50643, -403, -4981, -6850, 1513, 5282, 385, 0, -4784, 683, 4920, 83, 101, -385], [-13952, -25106, 35769, 425, -6066, -9988, 3142, 1547, 3526, 0, -8938, 91, 5836, 3388, -563, -3526], [84102, 1340, 9255, 2351, -1889, -3450, 951, -14965, -1361, -2286, -1884, 3149, 2927, 2927, 2639, 3215], [5044, 20066, -876, 1843, 4923, -8585, -3541, -11195, -4481, 0, 7241, -5971, -968, -6446, -3808, 4481], [38478, 4232, -66380, -3765, 1979, -4764, 1974, 6662, -3442, -2273, 1456, 1249, 323, 323, -1721, 2367], [-37554, 7204, -20332, -1460, -3780, 11480, 930, 3960, 3134, 756, -1470, -4304, 1188, 1188, -136, 2512], [-20256, -75400, 43698, -1606, -1124, -8592, 6588, 15154, 1900, 0, -5724, 878, -2596, 3872, 3578, -1900], [13480, -25436, -46130, 5122, 2256, -104, -2416, 14306, -3232, 0, 4172, -334, -1580, 2872, 982, 3232], [-233142, 2968, 32210, 2433, -23, 6352, -28, -19372, -3924, -221, -3704, 539, 1609, 1609, 2021, 1197], [-46846, -5258, -24486, 7938, -1060, -3594, 6412, -10196, 5026, 3340, -4196, 3582, -306, -306, 3816, -4428], [-31152, 78703, 79615, -233, -3934, -5804, 4826, 2027, 1898, 0, -5078, -99, 3846, 812, -853, -1898], [-8580, 59944, 14564, -3132, 798, -11364, 186, 10466, -2182, 0, -540, -1200, -6816, -2994, 2320, 2182], [34884, -49116, -71886, -5934, 8002, -9280, 1438, -15074, 1710, 0, -92, -3066, -4826, -906, 3318, -1710], [-30580, 109860, 53816, 6552, 3006, 11532, 1082, 16702, -6614, 0, 10396, 1596, 7160, 758, 820, 6614], [8100, 78814, -39864, 4642, -3596, -6038, -3352, 13193, -1936, 0, -1930, 982, 7559, 3958, 1252, 1936], [93107, 3331, -13424, -332, 2069, 8495, 1011, 11613, -276, -1634, -2678, -4622, -1350, -1350, -841, -1859], [221991, -3130, 98242, -2862, 908, 7434, -5112, -7012, -190, 1168, -4748, -1118, 302, 302, -1280, 1884], [53016, -5642, -35768, 374, -1908, -3338, 3624, 4630, 8062, 6618, -658, 2230, -1390, -1390, -508, -2272], [-23096, -79120, 34937, 635, 1692, -7894, -524, 19225, -6492, 0, 4736, -467, 64, -2876, 2981, 6492], [-453176, 5020, 62426, -2378, 1762, -5488, -7018, -27194, -14774, -5848, 4872, 3890, 3454, 3454, 538, 6370], [20616, 117150, -79022, 3594, -800, -14304, -1848, 21844, -2232, 0, -3292, 734, 5934, 6820, 5458, 2232], [-36156, -120618, 71618, -2972, 360, 16570, 6380, 5280, -172, 0, 1626, 6284, 10350, 2046, 5190, 172], [246928, 15920, -105474, 454, -2054, 5720, 7548, -7498, -3884, -6352, -5586, -274, 4774, 4774, 2614, 6934], [-18300, -103716, 28412, -4150, -4488, -7834, -100, 2906, -892, 0, -4734, 2278, 9702, -1626, 3416, 892], [52122, 128026, -120901, -2339, 5915, 16646, -2903, -6216, 2561, 0, 3512, 2171, -12278, 2235, 2013, -2561], [-90310, -4852, 16054, -606, 1886, 19472, 1714, 35506, 12510, 5096, -8128, -10322, -5590, -5590, -3098, -8082]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_300_c_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_300_5_c_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_300_5_c_b(:prec:=16)
    chi := MakeCharacter_300_c();
    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_300_5_c_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_300_5_c_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_300_c();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,5,sign)));
    Vf := Kernel([<7,R![55052665246124996150837761, 0, 1073357410042249038453752, 0, 3220136517901201939484, 0, 4195788114349404104, 0, 2891061394272838, 0, 1109365466056, 0, 232923164, 0, 24568, 0, 1]>,<13,R![6282398897791921, -33216073577608, -7653778912948, 9799175336, 2076207574, -3887096, -85588, 88, 1]>],Snew);
    return Vf;
end function;