
// Make newform 570.8.a.b in Magma, downloaded from the LMFDB on 25 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_570_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_570_8_a_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_570_8_a_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 := [497070, 50476, -3046, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0], [-5670, 38354, -330, -14], [5400, -58888, 660, 28], [-1281960, -143716, 2640, 76]];
    Rf_basisdens := [1, 1485, 1485, 1485];
    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_570_a();"
function MakeCharacter_570_a()
    N := 570;
    order := 1;
    char_gens := [191, 457, 211];
    v := [1, 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_570_a_Hecke(Kf)
    return MakeCharacter_570_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], [27, 0, 0, 0], [-125, 0, 0, 0], [-186, -1, -3, 2], [-86, 5, 11, 4], [-1596, -9, -10, -24], [-4110, -14, 85, -39], [6859, 0, 0, 0], [-16896, 278, -23, 68], [-30216, -189, -57, 54], [-55712, 240, -243, 101], [-102528, -91, 1002, -820], [52220, -151, 450, -60], [-245490, 803, 614, 160], [-94432, -3154, 273, -636], [-313838, -330, -6531, -2240], [-196644, 5254, 4735, 690], [-853294, 5738, 4560, 4399], [-270032, -3578, 1980, 7162], [-522400, -6180, -15146, -9960], [-63034, 2822, -958, 3246], [-531336, -6556, 14781, -2560], [-2193040, -14428, -7070, 10072], [-4594196, -12307, -12562, 17440], [6624, 4173, -20960, 24956], [-4561586, -6502, -48222, -32734], [-3996624, 40126, -2044, -7930], [-4404916, -52564, -53564, 24442], [-7160310, 18738, 29473, -20134], [-1095766, 4496, 49875, 43464], [-17971812, 13080, 28974, -938], [363566, -3517, 43133, -6214], [-11141402, 92084, -69959, 12498], [-13406264, -57598, 40664, -58636], [964422, -89702, -58738, 121576], [-1669472, 18756, 38845, -131403], [-1430866, 62406, 236455, 18562], [-581366, 169481, 235460, -78694], [-1081552, -20332, -72460, 68861], [-4273394, 162456, 46183, -172636], [-3216244, 43818, -344391, -83620], [-19317894, -219498, -613939, -15030], [31075410, 169501, -279683, -33294], [-13890756, -122313, 119986, 3512], [3321494, -352862, 50256, 255295], [-45897828, -378842, -207242, -142616], [-45532, -96240, 383330, -105058], [24073712, 349058, 832438, 19598], [114742284, 21004, 461462, -131411], [-63125534, -469942, -901862, 536323], [94384838, -309052, -520903, -630478], [-111815858, -65025, 684325, -122176], [-118833310, 897244, 444866, 184432], [-34693750, 297493, 1085621, -584610], [-1576278, 852868, -816213, -226900], [5191980, -1467148, 790263, 16774], [-154627296, -319517, 905747, -158990], [-10303956, -844718, -1583630, -140138], [-284912514, 808430, -525561, -769234], [78812192, -1088569, 81774, 49644], [91190498, 1581789, -990256, 302822], [-109611178, 1312584, 546955, 659250], [-7242224, -1115178, 607182, -535198], [-167798534, 291049, -1653199, 530972], [247073322, -1374156, -1074202, -58092], [-185602806, 2343426, 555639, 2097504], [169395684, -30936, 325268, 205767], [-128658288, -1802375, 1630654, -939824], [-62690872, -3988, -2509026, 4145754], [-24513786, 159292, 315012, 223044], [-406569074, 1005456, 608137, -1070518], [34829922, -839171, 3939795, 714422], [-11194742, 752341, -830053, 988284], [82563876, -2904945, 2849314, 232424], [234576780, 2058208, 2654722, -2656205], [-422792712, 2251072, 3183278, 1882498], [268855738, -63996, -5128464, 667558], [808754326, -1689682, -2501511, 2056560], [-108954792, 3229659, -2912232, 1735224], [780295454, 862034, -3220190, -1750906], [-665353758, 3450113, 2423121, 2304724], [-6293122, 3122616, -4873651, -1682920], [440099380, -3073862, 2857422, -12666], [525669028, -2786029, -1195074, 5237532], [-54013176, 3994996, 11146185, 6855414], [-914351420, -3154, -1618430, -6347154], [1138976148, -1376935, -1306428, -2657612], [1135414634, -4837208, -3863856, -4822354], [-123924242, -594670, -5196686, 1758066], [-314518950, -4966775, -2844595, 1787468], [166172396, -7944410, 283306, -7412836], [-280936102, 6946009, -1825537, -3099612], [82150976, -3176042, -7035066, 661724], [1537065750, 522459, 678399, -10171020], [-524624160, -11805314, -7312976, -856250], [-1080989116, 10184036, 1259577, 5167236], [1497950836, -7118487, -1844283, 12031462], [2048638544, -6883189, 3969522, -4193112], [73825396, 12162272, -1394036, 7580848], [-369327890, -20176, -15219616, 17972468], [-9103376, 9618670, 9987866, -167262], [585079434, 5240068, 14033614, -5523000], [67176172, -4534244, 12870544, 13232353], [2079370308, 12728493, -1667016, 2886012], [66199616, -16673074, 8400132, -10705532], [-682596414, 6674512, 24435768, 3519648], [-686175652, 11921810, -1369440, 3743808], [3857555094, -17733260, 2272975, -5157894], [4163118204, -3773466, -18235138, -9031552], [1523087566, 8600806, 6546864, -3772418], [-243380200, -13540298, -34155594, -13755610], [2004322462, -15475378, -106327, 4785536], [-6800918, -6174950, -20318741, -661343], [2834360672, 828598, 7591718, -4009340], [1163909352, 12321032, -10604126, 9509838], [3143455236, 19200249, 3088972, 7118248], [5518467794, -3812599, -22851166, -6051684], [2592303724, 22513148, 20915791, 4957194], [3067889086, 538174, 4851796, -27031085], [5868296960, -7933072, 9676455, 2152920], [6686209034, -2759678, -1334953, 23676526], [4610062320, 36774789, 14730856, 1420856], [6960160066, 4825766, -5475071, 7638864], [6938389588, 4612896, -18655766, 1609286], [-3451905528, -18279354, -26943396, -17483336], [4860714534, 21960730, 39851926, -18090648], [1091078226, -10109158, -47084750, -2208681], [11341501174, 14292627, 17042483, -3801756], [-1972462366, -21272991, -44239599, -17451234], [1983216706, -36162160, -27023771, 6951346], [5034683508, -23391764, 11871810, 2489898], [210498392, -19712708, -51319924, 3036354], [-8764403576, -20824544, 2519683, -17751397], [727538642, 24001580, 29918157, -17701010], [624487686, -11936126, 49479992, -48096824], [3909277746, 33273904, -63774712, 32312336], [6286480266, 22475478, 21902847, -15461370], [-3008856308, 30726344, -44586182, 35896228], [5410478318, 3626968, 93305023, 49480526], [13472133986, 41874356, 655142, 11762018], [-5272205460, 20949500, 43119420, -17678734], [306386902, -6818570, -21295958, -14001704], [1931085194, 36085505, 78494879, -255960], [-2078550516, 9825588, -70401990, 46449837], [-2677963990, -54723678, -60753783, -7664478], [8695046408, -36057468, -28527742, 41014372], [-1754479918, -5334540, 25377319, -3851774], [-2780722042, 17201466, -1981615, 41294818], [7049558644, 63093828, 25680634, 46270638], [8908733608, -9968748, 19276146, 31019152], [-13406547892, 13364783, 59707260, -4851572], [1865767374, -44768942, 29081322, 62624816], [-1305676382, -43175915, -39193098, 38921218], [-5168742128, -74334704, -115603406, -31344530], [-14010008076, 22261132, 66404094, 14583978], [-3943030624, -5551448, -701650, -54745098], [-14784504024, -2353264, -34295898, -21052576], [11737760834, -12046532, -7348384, -36085998], [-10004931226, -28568406, 41381568, -14730546], [-12773168592, 60566671, 5200609, 25901994], [1455181280, 5203196, 15531444, 22043010], [11310924754, 45706892, -117467813, 52238424], [-7459455718, 57107333, 102028009, -28547362], [-5529585160, 43026584, 34952939, 21075008], [-9814572034, 13089530, 101131265, -65940580], [-6637453800, -72452988, 15446676, -75664521], [-30420651680, 28734608, -20628011, 17272456], [-7619306338, -90730334, -177404649, -41971402], [-21275081134, -137245108, -98317366, 14682330], [-7171148246, -3806768, 35596966, -40634252], [13648143016, 59271488, 121420285, -12004230], [-38529654562, -30254912, -94909873, 49434880], [-44864248022, -41815307, 32734189, -47051942], [-19352381406, 70723504, 11570574, 28187304], [-379886664, 50803920, 29052237, -89179130], [-19402291038, -55477416, -31299870, 123500058], [-45860450320, -20678474, -47431100, -5626122], [-3824643922, -124661586, 11823358, -88209156], [-6602673776, -50030794, 109547520, -925566], [-13002551322, 70158112, 38655912, 162438672], [662999038, -42468137, 40101289, -81724156], [17732554672, 110227536, 39607313, -81093228], [-1066730860, -4822729, -74189896, 248220360], [-26415228214, 49456304, 49121779, -64343804], [6919649448, 79021386, 83918105, -33093760], [-26353810930, 196549750, -116896030, -119010174], [-44234523736, -124282067, -140451150, -25497616], [-7403933676, -32073124, 25393638, 106796372], [-19465438138, -155582874, 175165598, -99778972], [12996696326, -50980953, 267448741, -11033070], [-5141233652, -49673605, -95187954, -61452756], [20371946140, -48891342, -111396728, -48638620], [-43686185332, -117062376, -65442064, -91967068], [-1505073832, 82145327, 109480859, 194855114], [-1468652252, 188519966, 264868636, 183832302], [3486287418, 40355084, -170772885, -100206002], [-17695837946, -96459214, -62905502, -99588551], [-15428104614, 200113280, 123803127, 31730324], [34816347498, -48883762, -10518691, -131568231], [55861647824, -179166402, -64485109, -23604206], [-11755059568, 30174507, -205324741, 198783454], [-33642160272, 131375436, 43257345, -62918810], [-6276192780, 133291867, 28092440, -3448420], [-34201042654, 95926332, 187936328, 6915104], [16658971510, -33082905, -282631343, 162789194], [11809309646, 185885838, 316240622, -245869319], [-65644805504, 90989564, -103086274, -32253454], [49913809788, -45886304, 37637970, -229687483], [41259768622, 161079054, 40601542, 200791094], [-23821523252, 88721048, 358436192, 165812738], [-775094582, -239391016, -262330234, 17447654], [-11221256598, 236482028, -185539444, 51857448], [79459077194, -174044607, -897869, -302953844], [-27521663948, -68388480, 250357428, -37835081], [54515635468, -82830498, -8887804, 46235556], [33863912830, -137426994, 75098178, -202614934], [55110949818, -7468723, -298412123, 225240396], [-5416519296, -110378849, 180967230, 289890476], [-31954549088, 10261484, -144208894, -60087377], [36143059078, 100515374, 90392094, -183070963], [21519895790, -55385048, -138669381, 322302188], [-29396964424, -121629984, -185641093, 292149743], [-10235198604, -211908967, -365308796, -55425628], [50143668294, 427512887, 107474515, 111213528], [-7147012860, -81932668, -501259414, -399741507], [3483728350, 16656312, 83693120, -205815572], [95945475826, 267453252, 476974207, -103278340], [-21109502156, 281349634, 103204170, 413515698], [-1224927972, -301062104, 281655350, -326149588], [-21258527858, 310490187, -18831731, -309680830], [44951678146, 151578836, 178929275, 67940936], [-23030940276, 69204164, 440406996, 195010121], [-53393561688, 132890804, -23752181, 282719844], [-90753171188, -273474435, -397745582, -52305820], [52054097910, -299758825, -130129024, -231575618], [-127242812864, -30279774, 269885777, 193168044], [-24077019802, 132623698, -77786394, 2672909], [92608274226, -176850560, -87696972, 13906232], [-4083898834, -141003301, -236793921, 57044382], [17944368332, 367598398, 242827002, -214753376], [46572189796, 817576304, 304224530, 68233888], [21684280180, 37847284, -58805144, -132332542], [178769784310, -222186169, 129472861, 127173826], [-17327885382, -352183570, 350370377, -603938162], [79604663646, -334794386, 202209421, 335628216], [-42519434410, -325373841, 581179171, -305680806], [27995167614, -727622145, -355649783, -307345888], [-95660584844, -8647574, -241451741, 498800410], [51554661676, -43861492, 344035970, -58525927], [32700910300, 273830828, 264970213, -258667554], [-63450795158, 689292748, -173889383, -190590610], [1474905378, -424582720, 255578052, -175464884], [-43908123500, 567625436, 84911251, 179634060], [-25430310386, 822656530, 401958016, 112125038], [18733848086, -253257138, -144555128, -508799559], [-320119614, -111766799, -535484229, -596386342], [-164326851958, -76374142, 599079460, -97888075], [37121134236, -136134408, -159003344, 60621362], [-68775994310, -138478798, 381120349, 99980562], [6706584054, 219318686, 941721190, 82861752], [154220186616, 58139254, 662249610, -142129170], [-53541627868, 197144148, -167997550, 16736728], [-17607778386, -938953808, -555132142, 211676876], [24546614476, -321378629, -384270296, 55078004], [-130894563366, 180466054, -250497845, -602483427], [-56138360988, -229457088, -964729274, -214659295], [-130402572424, 249879087, 711655699, 34726350], [20936712114, 260352052, 757476792, -905531818], [75730633252, -301553340, -494082618, -483514168], [-78156551922, -57357610, 11421630, 299827765], [-131752073106, 650961008, 18237199, -561993108], [-135954438832, -649886934, -661007132, 166446238], [92364985838, -328778294, -298773946, -415816562], [30759143684, -107444410, -332467972, 148476918], [32468114272, 793303025, 986227082, -243609256], [134700538458, 208877085, -1344020465, 639590894], [-26341685056, -1332871116, -412760772, 144052730], [-166162917422, -130705710, 297560477, 96001342], [-81641714898, -45567794, 594516400, 509009998], [-56832970314, -587219757, 906686233, -21214244], [24654474128, 880380608, -872714788, 829760192], [108843229952, -1093571056, -162672414, 78746980], [-105901775840, -85305266, 483331525, 376362934], [-142416488162, 292303060, -957376653, 94722982], [83451728670, 282357187, -815283462, 92728974], [-92820340038, 625162589, -34409937, 356415064], [150175978426, 368957852, -1147814992, 783006764], [-260926449582, -239497574, 1024346663, -576910538], [-45619402536, 798570268, 917609118, -405906858], [-59033599452, -203077091, -217109758, -816893912], [-332600561778, -70792062, 810525114, -522256200], [77213017064, 95778976, 440849830, 36753968], [-36657973042, -152432526, 1037165557, 474216828], [-111817567096, -350392480, 674932409, -808499938], [-36457023020, -647499697, 409179370, -569636168], [87251211658, -2281296, 1850884756, 718930628], [-129716940632, -271333068, -1725531011, 256099434], [-102580615898, -431183686, -679217232, 602147423], [227255986828, -376993894, 343551563, -364588424], [80842656486, -145766185, 878363698, -91750866], [41299776126, -1149727926, 587758674, -978457598], [-102711598734, 437588834, 2032463933, -141175386], [-126371832816, -606134728, -1071671572, -808939442], [88466530908, -965532828, -732741002, 441450421], [238783430544, 1337209114, 923799852, -2943360], [65567636752, -180579339, -40023470, -1940397540], [-189099409972, 873517040, -1321197894, -318040332], [-239314856010, -72298136, -358574333, 149927890], [326357685034, 958933625, -305639051, 574040676], [59666853130, 586195972, -1967944631, 1006169306], [101376817560, 455865426, 1031980373, -1921444204], [136827548762, -217518288, -142551392, 1024600080], [42836734728, 182329563, -435633048, 758460960], [-77838059456, -1058954954, 566438128, -335197174], [169598763436, -63104156, -1594523219, -929081600], [-230032880814, 464457328, -809579952, 1061229312], [51256325662, -572325241, -1383123693, 156985250], [-110203879872, -1821741684, 173131410, -880038816], [-195742099430, 1499554824, 1490386618, 1018547106], [-78557149962, 1861518362, 139879628, 1002686316], [48824631140, 1144053088, -1559221752, 529929725], [-245710729498, 275772870, -308331658, -930954448], [-329011753040, -1646775601, -1765786463, 319638894], [-233609550532, 1525452200, -55013528, 1221080900], [53669425706, 1078504426, -654907647, 780267829], [-92680076126, 1765951932, 1498175866, 557310822], [-107778726844, -2221686452, -681656596, -398763008], [-61176469460, -19262320, -123232340, 1121346196], [37357906288, 388290304, 422759188, 1878647857], [-305687684154, -401659962, 924076404, -983119371], [-18352427946, -647466128, -1209031638, -1161023796], [-141908883654, -401515522, 1271255017, -1353850336], [216745300764, -894523790, 804363530, -1596458098], [-69869545584, -2073269520, 1588264944, -337899330], [-407362595296, -211676318, 1226283820, 787466040], [300806436584, -327686108, -82150558, 1699642308], [-480520123490, 1171987136, 202880205, 1102964598], [-477490303954, 148090002, -977773503, -460853716], [-120681590346, -1105843442, -1786789786, -886525447], [56607791326, 929581083, -570035969, -980424198], [-387426963964, 1157960831, 199491296, 727834356], [-144358113706, 1271504720, 743134687, 1574091550], [98969709020, -10015115, -2612985853, 394082178], [-365442871352, -271693468, 3421493715, -1576804683], [-349134188574, 641913650, -123755551, -464111856], [581697802840, -122528080, -2054984039, -220585890], [21780808154, -2047123698, 1051167500, 167263793], [172813645192, 790475114, -1734236446, 1077039380], [-250260397396, 2116462430, 686895476, -854921656], [24192049834, 1175144304, -2600459884, 555782796], [95456106260, 190237972, -919716922, -650548553], [539693361172, -654563009, -131268920, -1357612408], [-104130628854, 714363588, -1802995740, 214937952], [99365199536, 290371486, 1889704846, 45562182], [134886797394, -1586303330, 972469683, 1633268880], [39005037198, 261561974, 3460152621, 357022342], [346015038558, -1315425285, 1752504285, 1781693346], [13401943002, 448911873, 517415025, -734532804], [75040930106, -137099166, 2223315351, 17541047], [452575117760, -261956572, -1163110936, 1933045784], [547910285238, 695777662, 611967195, -179792592], [-270063464954, -4138698, -1113618956, 1588346810], [51383727600, -2588333620, -1396889784, -2080635272], [441800391112, 386307304, 678801897, -1766823564], [1050709931610, -203706215, 1115152354, 700401574], [-198846527396, -2233968249, 1111300092, -446294404], [374702599594, 250933388, 2937972976, -941177004], [86961349088, -4337319414, -525838350, -157330716], [-549234030746, -145899094, -514583418, -2445958188], [-296963808938, -2450204217, -6110636065, -1247199762], [15186386804, -692527728, 808190418, 1777473804], [142162556372, 3769900188, -309848601, -754114648], [-12904297164, -1572787887, -2659992785, -1685153162], [545238565984, -1516474668, -3039503934, -2386251964], [-93096632242, 2090528682, 4203860443, 152895772], [816255361660, 2336711190, 1876971209, -110838504], [-63323519234, 1324305327, 1494424883, 682958478], [-151232857734, -1441194900, -3619269212, -1805371480], [601040368202, -1714438808, 1236403332, -2330647946], [463873841832, 326816773, -4374971770, -525651544], [-230704218044, -3556999871, 2932092841, -2073546590], [-743535348126, 930579022, 292554043, 2613103593], [-112031910862, 169651317, 1094686945, -1917910658], [1003530959870, -956815332, -452729759, 835933542], [-537698765900, -1945520620, -4583805196, -2233423399], [175549570360, -2237438324, -2534817452, -89142449], [-60084136180, -344103370, 2134345050, 1617077152], [512678432790, -2004409054, 2603000075, -889468358], [201214531442, 4399249453, 624836402, -1098264176], [153115132480, 2913949280, 1617974164, -3202487751], [-529728726042, -568627230, 1558872128, -2867784534], [-104274894246, -721289206, -4326119547, -343872446], [557666573738, 3428811733, 245594897, 1779039624], [574980167450, -1148866223, 674190246, 4525208684], [-978378861420, 664390862, 235761744, 1059737122], [-474939450924, -2834657281, 1392408426, 922430420], [367778268536, 3090849528, 2168590299, 512571681], [-242989560312, 3717299319, 1887363664, 1041911500], [587413692852, 260163356, -4655916704, 3515412495], [-201712790390, 1434587636, -1708340372, 3681181350], [-539335535362, 4414724400, 1091492979, -345298296], [-765848061526, 195412470, -1659377465, 4834965849], [468918819636, 938301376, -2747622414, -1431576210], [280948199586, 1357256332, -5366674669, 763665034], [274223190488, -2175239141, 1902871689, -1354877018], [-531432559720, -16291484, 5615245410, -2187767674], [8596304302, 1769205298, -6928657389, -1333162922], [-2491897876, 2672040661, 5142678164, 3083383056], [497695306920, 4255119422, 202891378, -840533394], [1047028612026, -1859681595, 378821347, -431738924], [-370452532856, -1044199835, -2713905874, -3546368892], [-11554108698, 4241039058, 8907206290, 2204402731], [-1173764420844, 1260931044, 1700649300, -1129183512], [176831399184, 4377112226, 6315904246, -241839078], [-573849854058, -2979727890, 2456741834, -13128342], [-523821535026, -2236687786, -6632116586, -1168999492], [268474809852, -4576279070, -2357494626, 3247556498], [-384882693028, 1568859828, 1545175488, -2304101016], [446489280670, 1972863740, -267619959, -2218461394], [-160192167048, 6781259864, 2246476058, -365052306], [252740908092, 6285516653, 4987916199, 1254640042], [-211673457972, -2274270357, -3598651860, 2961372028], [55889308096, -4897122458, -637874095, -2695416586], [-58183958868, -549570362, -5588200817, 1689857184], [-517190781052, 396676407, 8922785210, 1238072108], [-293440141850, -5175480660, -7655521493, -1983713548], [-504115603452, 2127937340, 2449985268, 1269873262], [969585849810, -2228956924, 1679562104, -1859528892], [90530716640, 4418601842, 535146722, -2578570680], [1056754586782, 5647236059, 2234281483, -1651212234]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_570_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_570_8_a_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_570_8_a_b(:prec:=4)
    chi := MakeCharacter_570_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_570_8_a_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_570_8_a_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_570_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,8,sign)));
    Vf := Kernel([<7,R![139045611104, -472147984, -955488, 742, 1]>],Snew);
    return Vf;
end function;