
// Make newform 414.8.a.i in Magma, downloaded from the LMFDB on 23 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_414_a();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_414_8_a_i();".
// 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_414_8_a_i();".
// 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 := [11077220, -89140, -8367, -2, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0], [-2, 4, 0, 0], [-110450, -5551, 8, 1], [-207382, 4411, 68, -1]];
    Rf_basisdens := [1, 1, 684, 76];
    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_414_a();"
function MakeCharacter_414_a()
    N := 414;
    order := 1;
    char_gens := [47, 235];
    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;

function MakeCharacter_414_a_Hecke(Kf)
    return MakeCharacter_414_a();
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 := 8;
    raw_aps := [[-8, 0, 0, 0], [0, 0, 0, 0], [-68, 1, -1, 0], [506, 1, 0, 1], [-1028, 4, 7, -3], [2016, 7, 20, -6], [-9252, 19, 80, 7], [1466, 31, 113, -32], [12167, 0, 0, 0], [-54178, -214, 304, 198], [55672, 648, -200, 118], [121470, 1464, -561, 287], [-84874, 448, -786, 206], [181898, 599, -1201, -490], [-84286, 3671, 492, 60], [91924, 381, -4709, 806], [-21690, -3229, -5346, -2338], [521650, -3478, -4903, -2379], [1081238, 10509, -5799, -306], [-567072, 2388, 12294, -2430], [-273318, 2072, 7240, -212], [12574, -7373, -9176, 4019], [-376544, -11034, -13259, 2903], [-369828, -657, -1350, 4239], [471910, -6966, -33518, 9616], [-183426, 27130, -15884, -2000], [-2436234, -949, 35138, -1211], [2094356, -9720, -34559, -14249], [-1451434, -11324, -42383, -13505], [2013212, 9995, 13814, -33], [-5979352, 20632, -65932, 5770], [4233712, -44358, -3150, 9890], [21037528, 100597, -17040, -38847], [-15606712, -42994, 7488, -38452], [35072568, -34017, -70925, 30216], [-5025800, 77344, -162400, 53312], [-13487010, 12724, -114149, 49875], [-28773520, -203110, 77318, -39184], [46855644, 23222, 202298, 32858], [62135982, -97342, -2208, 29222], [58603770, 45229, 41320, -68684], [-5938854, 298446, -28415, 27755], [67262800, -46892, 286186, 43608], [36013588, -384901, -260526, 1020], [78969854, -94394, 271626, 9536], [65532694, 293855, 146004, 24399], [76348652, -84732, 623654, 82344], [176294884, -96074, 223812, 110708], [-1281536, 178210, 516015, 33363], [123820670, -435980, 61377, 14671], [-51516254, -681934, 54732, -151772], [-2078644, -477222, -299460, -106016], [199669082, 11768, -599086, -42796], [-31790764, 930948, -249551, 12349], [-89292962, 127016, -1321330, 264586], [-84152504, 394908, 870940, 19922], [-122588306, 942210, 84470, -93796], [146257824, -668796, 113520, 222002], [120325558, 267868, 274190, 415682], [-167914744, -709195, 242862, -740253], [22306918, 39105, 1067135, -686660], [-58038680, 786167, -545953, 310006], [-127980444, -856968, 389466, 239576], [115643066, -3061249, 1274338, -87198], [-236544010, -452158, 238958, 630350], [195412202, 133980, -2537048, 599638], [-246299448, -369054, 392766, -40120], [-233309802, 1568898, 648116, -76222], [367311554, -1367339, 4162516, 48356], [185859208, -637781, -8490, -760060], [-128716878, -1353166, 3388912, -46234], [311791888, -2272872, -129438, 49748], [-44708890, 340727, -1324724, 84911], [441036342, 1897468, 409383, -683289], [109125450, -1471129, -733687, -720476], [327036932, -2205182, 2981748, 989702], [-473805880, 897383, -4941375, -929208], [758192230, -1064096, 2050584, -102856], [-1004758420, 1238227, 1353276, 274559], [241827536, -5523343, 1758470, 934712], [199025352, -118998, -1753383, -543261], [526607946, -4690338, 2930027, 39053], [-489671196, 450678, 2667534, 1743954], [1082906354, 2731088, -1807498, 1449722], [-1101336164, 389078, -2167488, -279000], [-191342252, 6071396, 2632264, -1184252], [-1419481398, 656578, 3164794, -345494], [-169377830, 5906284, -2048658, -187012], [-326769110, -244692, -4251978, 1085696], [-1963617944, -1865412, -4726168, 1409332], [313240004, -1570672, -7413271, 2160897], [142911220, -11568250, 1202828, 184444], [-678537656, -2287760, -2490460, 3030284], [474934022, -3909701, 4425276, -1507468], [-1256503768, -3800042, 1612622, -4017704], [1018807292, 1313734, -5655726, -372862], [1117032274, 6682152, -8415432, 3986306], [113605916, 4160439, -9708452, 390757], [1568935382, -5998799, 16929813, 2678374], [4234935180, 1228825, -2616434, -2858532], [-835465164, 1332960, 11722486, -6260008], [-846601864, -1595141, 13934741, -1954984], [-12326016, 11018786, -15603793, 831995], [-2737667392, -18430015, 8638468, 349995], [357363646, -1320463, 5108193, -3952422], [-580374364, -9386797, 4893994, -6611572], [-1151054984, 3282010, -455162, -6182490], [3375980618, -11364326, -2636454, 811886], [3334972084, 6465050, 1256000, -9052580], [-2612607516, -13145769, -8653942, 911588], [-3092778264, -8550956, 2739312, -4051452], [1600615678, -7125040, -5916039, 2253753], [4350419956, 6372339, -2200182, 7703099], [-1149146506, 4455773, -34202137, 6069296], [4022991814, 23453935, -2443002, -779443], [946280228, 4133119, 7280668, -1187173], [2280582994, 6225247, 16967, -9704794], [6484241606, 4825705, -14096474, 4430282], [2081565858, 8671388, -6320280, -4145860], [-1787532916, 29885108, -31220235, 3266109], [7885875662, -24150256, -6134027, -1083775], [195983640, 13229889, 10491698, 1679168], [-4446524288, 15512603, -37013265, -4876004], [4132475544, -32002126, -12838242, -5874934], [-2127781588, 7410636, 604302, 3178092], [-3224157796, 25956429, -7397583, -7544450], [2917446926, 21431516, 2214807, 13792385], [2451982214, 23448765, -2790918, 8247622], [-4462723118, 345737, -38295740, -13299339], [5121849738, -25763934, 12134939, -10083991], [-6496874276, -23342552, 9857096, -7737604], [7109642844, 46143762, -15024156, 3181470], [969108210, -6809535, 52309330, 10655819], [1244562690, -6736926, 50072437, -6789097], [613823962, -1506990, 2688672, -2163850], [9618020558, -21058774, 39201842, -2788414], [4351655008, 1649435, 266677, 2918542], [647893634, 15949695, -32071397, 14679954], [-12457713500, -1368663, -8051063, 9906848], [-474851026, -46184792, 49862580, -9077398], [3890455348, -46690140, -28494186, 3672340], [-6018419178, -22134410, -112776, -19255040], [10577378380, 17622906, 6740080, 19570066], [-10835668588, 9306012, 20094657, 3089017], [3714890756, -6577731, 95735626, -9341160], [-12664348424, -2302148, -49564944, 10987746], [-453035674, -26511668, 3735032, -18700808], [341006946, -14156838, -22603032, 94332], [2944477192, -33726066, -26713864, -23991380], [11133709546, -71025965, 1181906, -895650], [-4978698002, 48708924, 37477546, -2979782], [16861499912, 19006937, 34292982, -16192821], [-19728530008, 9889374, 5960674, 15739416], [-1113009322, 50870985, -77338500, -14039840], [-6190213930, 4443201, -19988209, 36886272], [8869617860, 123941774, -41916098, 13936134], [7721224910, 56868419, 5624388, -29209477], [297681606, -38611076, 16292106, -12690710], [2652249578, -8854384, 76715912, 17620868], [4195231924, 17550313, -66250581, 25701420], [-6058498486, 18108965, 37288956, -20902296], [11792786664, 57911317, 7943672, -7031285], [8296088672, -118926592, -8938956, 13313750], [12326732904, -74331838, -99309121, 21304967], [-20186092996, -119981, -68448336, 37776197], [-9958774148, 74380662, 10632762, 13574330], [-5049215788, -101364542, 39727868, 24590038], [-4049800368, -23181613, -129533314, 34533940], [17435688622, -25459354, -72146650, 29682636], [9862931970, -36006576, 40341124, -41381556], [-13437290932, -131487392, -394951, -16740907], [-15940985402, 43024520, -6883834, 20417934], [15618527724, -109619582, 134925748, -2360330], [-21741323878, -46908196, 64656236, 14878214], [6713344144, -17591612, 49460172, -45321874], [8394739620, -15300165, -121213818, -33424647], [-24599304664, 61561022, 119520228, -14439652], [24519380902, 13916110, 35021814, -23356566], [-12739456586, -40785825, 72409626, -32078639], [10097546562, 123233858, -71980281, 55941727], [4090223784, -35564344, -240816, 56949430], [-24459766608, 46936090, -68180903, 1502149], [5765152598, -8899260, 10632326, -28964430], [-6623515442, 78455880, 24320640, 42933362], [-22556555868, 72450350, -137517806, -26672518], [-25048446756, 89083457, -78952167, 10249964], [31442723918, 78478084, -98972232, 23517784], [-53906984086, 46901491, 112298659, -6153410], [37178776226, -5671628, 136238964, 17897728], [-9680525466, -44697323, 116210792, 41382820], [-55795434470, -97078236, -29459880, 54053344], [-45925019792, -100377322, 63212962, -11703218], [-14104790822, -138441405, -47917041, -77732366], [54803577194, 41721656, 61053902, 10266246], [-28488372760, -70704382, 57408701, -18448833], [-4344306248, -86212635, 144862758, -39901903], [33529093598, 106757698, 46372680, -52501664], [2653419690, -51688198, -5335077, -39727523], [-73658292300, -107294753, 103810378, -66387167], [-18736148048, -208648660, 81806252, 14158288], [4325102912, -147412545, -25560147, -31885364], [-3690334308, -54066098, -78079832, 93509418], [32251138406, -24513372, 133504602, -85257738], [-97646794, 72427826, -166608972, 46956914], [-19239405564, 16598032, 120221919, -5702711], [16518319146, -145763356, -256338532, -116164342], [-28755903670, 293059425, -16533492, -972795], [-40242594450, -181904541, 226146878, -118502154], [15014714730, 32945222, -169120554, 5561822], [-33091112400, 33988294, -319935186, 38164620], [28508273170, 259431280, -196284164, -29609404], [-22141568106, 282210006, 26940290, 64470546], [-54833680846, 169466081, -214082458, -9255553], [33364264728, -205932242, -213952385, -65564507], [88423192536, 8215432, 9817898, -58630922], [-77429382946, -139063570, 208331242, -32626030], [95910322520, 114768556, 80100980, 52612480], [37176810238, -102634476, 224788764, -44437846], [-43049827112, 356358360, 138569940, -25311172], [17968978054, 64129458, -221050026, 11318342], [63796690824, -31402601, 92076904, 85433718], [42377957034, -267505171, -10452550, -20773757], [102166701358, -123201748, 245311584, -15784718], [142077575430, 60723531, -83629814, 80308385], [-10211374456, -317730618, 105213504, 109376800], [-33837792412, 262785657, -207956732, 87240774], [46442044068, -458661861, 267954886, -2455689], [-26962014630, 248272203, -311510964, 46485672], [-21472996374, -25772095, 210405474, -80476349], [77815261092, 127711380, 12351484, -9626496], [89419369172, -66583235, -334818294, -11346488], [-42272494706, -127155575, -165333609, 96421748], [30248872898, 522732913, -49772866, 22734475], [85373156526, 109362208, 307530646, 108439876], [-25157128042, -606535075, 398335367, -78233728], [51432216348, 232606530, 180691170, -36129174], [71882454454, 115421058, 10606706, -12567356], [-65948942948, 113078993, -8478331, -105648416], [52222901268, -99314532, -350718454, -178336758], [-64167776462, -444926333, 283292224, -167810700], [-1933242448, 451639106, -363258421, 132795699], [-13184310216, -421451302, 549830130, -95493728], [32178189932, 118583594, -314087044, -128407906], [47829337428, -137597579, 251877836, -178706394], [-66862864758, 492720562, 183269856, 48994312], [48066457128, 278953400, -51628680, -97400956], [13633742156, 473679734, 817944, -16846438], [30390977432, -17584918, -73443643, -12629241], [-23633543130, -97687279, 237862115, 143597824], [-45699868264, 268227380, 521233008, -12741300], [21075405150, 40688192, -475692791, -247707809], [186372759420, -335284717, -167864206, -80286067], [-124096371540, 282744738, -540528984, 97241814], [159235196322, 90842456, -395481904, 76123786], [67215696518, -510852894, -102371694, 55568914], [34060292036, -104247624, -588392020, 171156784], [87562654122, 249585758, 502697853, -143605157], [-98316083674, -10882107, 87896837, -170674218], [-158447826270, 150373836, 86037310, 130603500], [144247568988, -56348885, -437427918, 4676124], [94336623030, -608116221, 26361006, 24037205], [-62448820900, 603572280, 499440117, 122149387], [274268667158, -143259324, 306146166, 4386018], [-119784235418, -263288168, -459973755, -32417659], [-51293117174, -855675774, 137038512, 173291504], [66063063598, -244095755, -711760877, -836308], [-55050618060, 135953609, 517358509, 166728452], [135427738428, 420459775, -14169578, -147600107], [-45126081290, 427011745, -700048045, 227340464], [44103038162, -91651028, 7076674, -159133876], [6732139854, -267275012, -50862982, -45020670], [-53728785270, -80395589, 744159435, 95729346], [-2710022770, -343325526, 995654152, -11486886], [99934797642, -369618343, 1019257978, -1875749], [45989260786, -14397800, -831842864, 97064516], [-84936754644, -145373602, -204259676, -186369500], [-224622695626, -528658525, -222035994, 345620250], [-13706123922, 549489460, -789433656, 171473832], [135558007306, -350191536, 271938904, -189877796], [124887142476, -98054328, 253545927, -7071183], [3053826154, 701618667, 510040434, -286521262], [-359317091170, 2612855, 24531186, -121355191], [-191614585432, -430667308, -202293330, -138574644], [-148031409114, 632320684, 924134309, 185798301], [15110083580, 752972624, -98602238, -334375996], [127745576238, 434725585, -699632802, 78435502], [-75844663766, -169157248, -1079987346, -227885376], [45922872576, -828852981, -344158427, 112380552], [-89991059112, -497819584, -4086144, 319025104], [42548078650, 8858486, 715509906, 168065152], [3699194336, 260097759, 64111543, -313676360], [-357436172380, -103691572, -261036615, -199024725], [-254628165070, 753158462, -841104666, 123938172], [38066585192, -445784790, 1216757211, -120880337], [-25604898312, -161113621, 636422910, -403969460], [37975281916, 1370081005, -626592177, -285725592], [-170125124694, 887104165, 563692460, 360791109], [-74614940386, 603081098, -817901664, 272715732], [126446628524, -310767280, -1548615780, 398137788], [-303177395436, 220434036, -483425840, -47064856], [282038140726, -1212742478, 169765738, 39016814], [30531251568, -198989921, 535070049, 483652852], [277538987498, 152571561, -674854468, -380315139], [-181077108758, -218990363, 157084426, -197876706], [-55550898502, 179068043, 75347337, 594626636], [-18206448620, -532404821, 477732686, -221319136], [155839306504, 686996602, -972718380, 291365064], [352766950726, 581874140, -441446487, 51623199], [-303702943872, -260686144, -82477128, 596742890], [151074680340, 157237881, -1779439528, 490825154], [-460128301118, -549310241, 452555858, 96796422], [-70872471520, 1647617267, -92116897, 151561722], [10551806916, -2210177249, 546846384, -269808791], [124150785244, 550433144, 1656650904, 72130548], [-180022356232, 809816416, -679945106, 178936310], [156055729994, 810732140, -1251705024, -116760922], [174114742312, 1059491742, -668418988, 481923464], [-110601606146, 1400968513, 169312976, -14936976], [-104133751486, 858874732, 286918880, 160573306], [-11141259106, -1616610208, -42681166, -469854462], [-296443704462, -936776081, -232489729, -275446134], [586333769706, 477610064, -191094418, -40625978], [23278843242, -669752344, 1472175554, -356935726], [10191739040, -1658739448, 1031579012, -52293868], [70879776592, 364784561, 139740420, -456285833], [-119438986706, 223499310, 1613410630, 87008128], [-264576528414, -559355521, 223226171, 404306230], [-63297501056, 1145781658, 1327289732, 243732908], [-31882560412, -1225576762, 354749816, -266841468], [25523794964, 253079133, -1308080051, 731736916], [-6090490914, 110756060, 219674730, -425597498], [-186089889586, -400292330, 1205288796, 255945020], [-335558812320, -1477220360, -193634628, -286959264], [-119553680788, -1074189316, 285243954, -9127170], [-227231712186, 475914369, -754096089, -166653568], [316191983146, -613536191, 2829355156, -344136660], [87712761022, 2110687484, -298181025, 772220859], [470247910880, 38131789, 1696084222, 89541323], [-69266905380, -1739169645, 1129673514, -442724116], [99189937182, -1989073789, 1549472202, -232025663], [-331001129588, -836008331, -1708923592, 440979962], [195293227404, 1146923591, 525723548, 152063363], [-76147897826, -3466855854, 1222861318, -35945794], [-399906273398, -546192231, -833566864, -20433227], [234181630696, -812864101, 506762549, 227105086], [-94020314572, -1151085560, -873325544, -598887340], [117525869936, 1795412291, 103141776, -366048442], [131129020316, -1056740376, -119078954, 139874700], [540979102660, -1569348810, -1495265766, -57103102], [95220131560, 1471674647, 615709471, -489789614], [-217645308452, -183803000, -894177332, 703566560], [-331959236080, 1928868649, 1309320338, 512976076], [-344949779958, 439576532, 1323408390, 200463548], [-521143737610, 130900295, -903218836, 162713939], [363259984174, -1059240600, -2525372895, -305113199], [117879029086, 2912614800, 242924160, 354751970], [279675395668, 856596906, -2031868096, 326074670], [1025295032464, 49663470, 151529445, 228699629], [-784931862, -872933858, -2118452668, 290534854], [64310998218, 1973436383, -2016627784, 862215572], [-152159333734, -583402318, -2162460151, -810629959], [265466803914, 377576970, -1905084250, 560328072], [-567858661132, 1798199358, -541656458, 387212638], [147294414604, 335748040, -820041741, 572154723], [59972478256, -2609306794, 2126359964, 445166484], [-257442985174, 971787448, 3498270100, -167426756], [-264473731226, -597536702, -2846820842, 436141962], [201526854886, 1816213579, -1779756824, 967245083], [-13033931186, 540753998, -437812566, -85177074], [7139449654, -733694417, 864873860, 1120347276], [279796958568, -2068215342, 2066020198, -436973788], [-34248902052, 413473186, 1530121522, 48062542], [561797228084, -1006647195, -1508658591, -874679918], [-266467477122, 925905379, -1562848498, 1109553873], [451229111030, -79327088, -747840632, 536971048], [73147460152, -1872645226, 1420736402, -621538346], [-96873407112, 1013970132, -3203008086, -535050234], [-796009396522, 1599510406, -2225840052, -92423492], [360902212884, 1081927367, 1086322188, -1171651339], [675303676948, 517037087, -959019434, 742135752], [460702159236, -3354065831, -2826051675, 95111812], [-445747337408, -883174631, 2625833664, 216199941], [159677531872, 168046248, 2435291336, -321500606], [-945043498846, 629688790, 86485686, -203105110], [-74860448934, 667018747, -1890990531, -1429878648], [-42628822148, -1320004058, -2938419164, 467124780], [-84628748900, -1225783474, 3167948600, 7035990], [846238168246, 2610157020, -122509722, 447455458], [264440974094, -2331388015, 3590388069, -466868998], [-130940334752, -1672087976, 203826022, 418724178], [-846002669390, 2021251876, 309066108, 579802094], [-559093767266, 704929486, 509488498, 1039688172], [223586307402, -1994031719, -1449297978, -326801354], [21576431900, 2683470900, 1385247446, -431380212], [-717924530008, 1964391576, -3549635982, 709319134], [-616027379470, -2654892256, 1107107822, -982938364], [647123748914, 914376545, 2069788266, -1075945249], [-388902668004, 2421173343, 4430982876, -908565891], [-527591839294, -498136737, -1361305689, -230942922], [-109192521802, -4339648602, -1082849026, 1056640834], [179444258910, -6694624084, 3775686620, 29740876], [-758095931102, -172579046, 2136685550, 31752888], [1117106812310, 652420215, -780243776, -481228317], [-511351658576, 2159868913, 1003786192, -925205241], [-41356855878, 23346284, 1832380490, 1014583106], [874132268592, -2146521164, -854102420, -85127292], [919637898050, 20335334, 137879877, 743054075], [-207033356018, -3320869308, 3032056274, -479914360], [221713815606, 364690853, -615093477, -514324580], [717081361390, 5915030027, -2477445540, 805763560], [353023184320, -346883067, -656700346, -989009492], [-254779599362, 208751618, 3771394794, 59470918], [-305926535704, -88907210, -2131082943, 793442951], [301796167374, 2105504961, -654207687, 1042498982], [690916371794, 701843920, 1115186980, 993569014], [-306584701482, -3364028490, -337259808, 312887406], [970305206034, 338108887, 4036707132, -1360267580], [848989877036, -2291659254, -3657734388, -441639258], [1178146386860, 1007917995, -2127441060, 54215053], [-739608038588, -3788735954, 42806110, -524711784], [-302013256612, 274370869, -2639642023, -752150872], [639204604330, -2633185662, 253012951, -915504305], [-1643629271048, -1030566308, -1876448328, 473679492], [779190888738, 3543650949, 1844707818, 757874730], [-270997403662, 5544378772, -2592251236, -1397996], [1343527774090, -3066864672, -4207406240, -608728492], [-6484181676, 3914730392, -6284120481, 852725447], [727425150670, -3275987252, 8327536, 413358288], [43972053824, 1667681550, 1583932102, -1824973344], [97940188398, 4144130805, 408922444, 1792898292]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_414_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_414_8_a_i();".
// 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_414_8_a_i(:prec:=4)
    chi := MakeCharacter_414_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 8));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(2999) - 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_414_8_a_i();".
// 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_414_8_a_i( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_414_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,8,sign)));
    Vf := Kernel([<5,R![538752000, -51728000, -180540, 270, 1]>],Snew);
    return Vf;
end function;