
// Make newform 350.8.a.y in Magma, downloaded from the LMFDB on 17 January 2026.
// To make the character of type GrpDrchElt, type "MakeCharacter_350_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_350_8_a_y();".
// 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_350_8_a_y();".
// 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 := [389808, -31160, -2473, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0], [-180252, 613, 165, -1], [24417, -20918, -240, 11], [140544, -6991, -255, 7]];
    Rf_basisdens := [1, 2520, 315, 180];
    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_350_a();"
function MakeCharacter_350_a()
    N := 350;
    order := 1;
    char_gens := [127, 101];
    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_350_a_Hecke( : Kf := Kf)
    return MakeCharacter_350_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]];
    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], [10, -1, 0, 0], [0, 0, 0, 0], [-343, 0, 0, 0], [369, 65, 11, 2], [-4364, -6, 7, -9], [-4500, 114, -35, -24], [3134, 339, -63, 15], [-35883, 878, 6, -25], [-13071, 1424, 223, -4], [2804, -2890, -105, -31], [-126137, 752, 923, 248], [-67362, -716, 322, 283], [92707, 5478, -1294, 333], [-219834, -10190, -1484, 70], [311550, 308, 112, 770], [-349380, 12230, -3073, 17], [-1066666, 35562, -1939, -21], [-579347, -28367, 5503, 2062], [-853323, -27720, 6482, 651], [-1154138, -7208, 1176, -5351], [-2257981, 7136, -4600, -1621], [2896728, -6611, -1834, 6040], [51360, -49796, -1148, 5869], [-5448440, -610, -13153, -6325], [-598878, -178206, -11487, -4587], [185830, -205056, 8988, -2862], [-3576792, -67483, -12795, 9923], [-4492099, -41636, 6769, 826], [1437129, -116608, 7962, -5686], [-10302947, 133696, -41210, 28423], [-6183324, -318528, -15624, -10620], [-30529962, 23260, -19889, -45284], [1988654, -114871, 30478, 10286], [-23617461, 436856, -5957, 9296], [26605733, 271330, 95360, -11435], [-36911570, 301834, 79793, 32461], [-36617612, 224051, -10419, -28789], [-42893376, -504982, 96761, 17243], [-32504790, -512336, -129738, 21610], [-36162408, -244701, 51481, -78213], [100214942, -227062, 35833, -43765], [35721420, 501502, -134720, -38156], [2248957, 1013444, 15620, 73862], [-26882955, -1764052, 105505, 19562], [-24516358, 594904, 109277, -5507], [92129036, 625369, 161657, -73133], [-49097198, 1400428, 66829, -63107], [-123170130, -1916584, -264152, -66010], [10846838, -410840, 215698, 127702], [-9233625, 3153256, 163837, -147188], [-25524144, -1414760, 179206, -132710], [34403798, -19526, 70077, 79936], [121032828, 1355949, 118489, 310425], [1848960, 1699742, -94213, 250643], [-50395233, 5879984, 2362, 105173], [25364028, -167502, 147567, 54267], [-67542280, 190552, -337743, -274601], [-107617586, 2340712, 86288, 194848], [111621009, -6323604, -327047, 72198], [152247274, -6725753, 316253, -225749], [-107268408, 814670, 918001, -154015], [-195844940, -5816875, 525721, 425753], [-454350876, -8589266, 391132, 231796], [385683262, 2647076, -1013110, -199246], [-92728311, 7505836, 888171, -191546], [-436901197, -1346711, -839717, -62708], [-64466018, 12510988, -371665, -313754], [-176620461, 9567567, -1046643, -703638], [-168360958, 15120036, 326676, -433890], [551380560, -1752990, 93345, 334713], [301605141, -9194060, -150810, -766529], [-38461022, -21361574, 511077, 81289], [465692629, 643680, 878301, 252576], [385569275, 9427755, 1343015, 301092], [513624612, 7100220, -1187907, -86793], [654211173, 7243344, 984801, -261720], [607440670, -6875084, -576156, 24328], [300856245, -11596760, -1252006, 1329874], [174915314, 27744822, -528703, -773340], [701703888, 14017137, 1480080, 1093938], [507246335, -23831568, 33023, -46464], [765422988, 6335416, -3072826, -490970], [-383729540, -33432906, 1462097, 134208], [719360456, 6546462, -1985277, 856833], [-95426580, -3018797, -38979, -2269013], [914863287, 1567936, 510900, -1422842], [492311977, 31351976, -2389552, 312254], [134246244, -25923410, -1709435, -3195899], [-94591892, -8588552, 2666720, -1717100], [2063420298, -8959324, -167622, -171592], [-28112352, -18188104, -4084367, -990721], [-755950697, -8440508, 94264, 1889791], [-733208895, -56942026, 3294898, 1129883], [1324965224, -47163824, 3095860, -1126952], [-1342012602, -54752614, -6770316, -38098], [30832284, -15944586, 6866993, 947337], [1196290794, -40666782, 2773575, -840522], [-1042460564, 65385961, 1540721, 2507773], [618432959, -54086592, -480123, -1876728], [-1567607867, -25425485, 9812619, 310666], [-3475738527, 42172192, -718727, 1505944], [378606090, 16770352, 6847484, 2412406], [1063243737, 18998904, 2037156, 4943856], [-458049793, 39747026, -5487054, -5799727], [-1543409726, -29048498, -5593945, 332746], [-3027796566, -73070747, -4847836, 2277628], [-4225846416, 43778306, -3189725, -3971056], [-4093849341, -55827806, -8486462, -2040863], [2772589892, 24646346, 10389043, 1817426], [-3501878360, -13452434, 1862791, -5374979], [-157865609, 106625460, -8575293, -3263550], [3677407083, -22670824, -7191375, 1826516], [408256148, 18399610, 6283249, 6101407], [-3676634869, -99634262, -2286774, -165935], [1076439057, -102670272, 6613947, 2685384], [-2718249368, 7171300, 9048858, 185350], [-3665051874, 15807664, -1755530, 4987432], [1343179758, 55818384, -14430278, 6110544], [-6387803640, 48780301, -2275743, -154109], [4593579470, -52312476, -14215740, -3994608], [-2697452546, 171793468, -434518, 3579982], [4580152542, 72591204, 8705004, -6120510], [76882443, 82853443, 5862621, 6046006], [-8389987090, 18581293, -3625538, -1925378], [-3058300242, -21377304, 20081802, 2419308], [6008770010, 188746360, 5340730, -4476908], [-13219693506, -10112490, 8732703, 2556243], [-3745595048, 122652294, -6596842, 11378574], [-3711598364, -220496888, -2075276, 2492224], [11265338681, 27963746, -15290284, 8227673], [-2695738032, 59740460, 12367270, 9899858], [-3358605640, -26543598, -10343614, -14843154], [3026301031, -151045324, -13290773, -15329506], [40390260, 20974074, -16177231, -3415194], [539452802, -18687732, -12479698, 1884147], [-8843756568, 113221886, 12724593, -2794777], [-1595338490, -60610978, 6077701, -15030907], [4099684068, -21894032, -25940152, -11999390], [-184140273, -131262740, 18857895, -5488826], [-6254134330, 126719804, 25378094, 9891416], [624202974, -32634960, 38515846, 505224], [8157421345, -194505348, 5441656, 16599441], [20032159287, 166672013, 19984693, 3895406], [7158493268, -276091012, 1181194, -14259994], [-21539552178, -786388, -14863163, -6233167], [-9383490332, -89159264, 14208768, 331366], [10507883298, 166180524, 3853402, 9876729], [-4047175318, 110940843, -12393087, 12847467], [1664770683, -142480494, -10841100, -27801657], [6540973834, 288497628, -6537960, 580698], [-7318900440, -54124598, 18343073, -32507087], [-5822753231, 100256383, -8649243, -16694024], [14260701534, 259089856, 3635779, -10626869], [3679581868, -50881928, 27892300, 19752916], [-14626378233, -4232850, 364422, 3906057], [20271756131, 240163812, -21308014, -1130703], [-26609181354, 178753414, -11329059, 10371103], [-301162286, 191986148, 16359924, -29837611], [-3201282912, 90818514, -45082233, -9986787], [-5533562964, 316927272, -32690748, -3909300], [-21391442799, -110560148, -24337528, -17271470], [2660604424, 94399282, -14894814, 8157406], [-7931867850, -112066221, 8285907, 32365185], [7776082671, -561858652, -7474778, -32991082], [23031112188, 378744506, 12741533, 4746851], [-22026983161, -300121358, 100293400, 8168071], [-7481447198, 10637856, 86700642, 1371546], [13424795807, -246015424, -53097626, 3517832], [-33285070548, 131066120, -23782640, 7197890], [3783319479, 551148579, -17067893, -38997768], [-13499029726, 796509924, -44767968, -10103484], [14151645951, 186552028, 1402810, 21538837], [-11235085730, -390334680, -42740091, -19969524], [3705453242, 347833306, 22728587, -18414893], [16824672648, -318662414, 20847771, 25631302], [-24341144041, -429305649, -52757949, -26327472], [20659570554, -130185348, -56820804, -19103622], [-16076177948, -21461380, -36766079, 9969755], [-28805528788, -71897394, 60752797, 12192213], [-50831263649, 180830822, -5421394, -149719], [-19980135000, -519454845, -100086203, -526935], [-22826360297, -316423152, -95655335, 44221776], [7789890378, 916322898, -20912339, -11914236], [27009627057, 758753060, -59779716, -6285571], [23789270694, 75550076, -34614300, 40943138], [-24041688263, 70607636, -50820103, 7369118], [15776524546, 649588945, -20743639, -20968073], [24101360813, -337386860, -71405500, -39707156], [35620107762, -257032144, -58333107, -30891235], [-67796646626, -211063962, -2741613, 14000478], [-6400228923, 227395717, -54504423, 4956472], [6352933169, -52160449, 90997491, -35953090], [37151706510, 763812144, 31467058, 6408132], [10697163303, -95610337, -64137683, 90830750], [30416678334, -600643666, 29470609, -42591445], [40750690061, 735882440, 43890754, -27641944], [-32168246237, 717809296, 22609617, 35051668], [40253667594, -411247746, -72513231, -12233700], [-4922635260, 1060141676, -9445289, 48922469], [52680630126, 53656232, 108436720, 3645404], [-11332062718, 32057234, -145925878, 34694972], [28264936252, 54500082, -41693169, 27491847], [28810063466, 534860596, -81872196, -24063881], [857678154, 809999478, -79367995, -40941375], [20880600138, -44940310, 30973173, 33938045], [-65314391746, -864789846, -56103908, 20733894], [25319037408, -248171656, -68706662, -20109934], [-25283111793, 1329870352, 101860029, 50711632], [-16677630550, 396429418, -7310667, 75425233], [-94053911189, -386204304, 33671401, -27570840], [18751874604, -131175476, 80478398, 65032918], [-76493279597, -424031638, 136256774, 7618973], [-15488172576, -205312335, 94779279, -13073685], [26373720330, -872105684, -174782839, -29528639], [28916055788, -902971558, -117865251, -4351486], [-74282887337, -125516018, -110537836, -7044917], [61585976070, 602854930, -116962769, -55592846], [-83194221687, 297598938, 176157184, 62637897], [-16134907185, -548167036, -4353399, -66363658], [29401757957, -47399984, -181611847, -97539500], [34564716668, 1188396606, -8736770, 33554322], [26943611007, 2448020916, -11820330, -68253012], [8671974937, 2277793498, -89972622, -57123569], [24991265340, 1476391495, 172516680, 10319110], [-25712635510, 408270816, -44281366, -16010664], [6114522426, 344848696, -140391846, 106185943], [84521422803, -2488674624, 57433218, -78922671], [-1438946048, 2147141792, 89125736, -21745744], [78626032677, -639264841, 113602717, 151902032], [-48239020625, 1020910660, -48848205, -42093170], [56970696584, 38967867, 240689610, 38757132], [-76590230248, 1130849646, -149782886, 124596678], [-10250383869, 476143220, 39449788, -29530984], [-17907276140, -1955436206, 84981029, 119214811], [-37475383344, -478885722, 170550667, -91878183], [-17746341370, -653217716, 103341574, 124915183], [60509200749, 1127733980, 154936457, -16042738], [-18325057755, -1202512537, -40476223, 67865768], [-49972225032, -603472356, -45084088, 66207576], [132031394481, 526532831, -162143963, -82468996], [-85058781280, -1501928905, -66919062, 107576444], [73089794272, -812295292, 183154755, -52852363], [79938998639, -1323434188, -41652497, -43509094], [96156636828, -1052106748, -96162976, 87655007], [-103329463152, -2109689286, 479754604, 80867520], [47507080042, 1614813638, -277881044, -69131854], [37365657546, -694209936, 159334644, -197540778], [59332163048, -2043779631, -255127813, -148856979], [-78143887296, -606334390, -75029606, -206006098], [-22275499118, 3536760652, 77504430, 89277130], [70182395346, -800798824, -257172902, 30172313], [-286844928, -1241880674, 140953178, 48628126], [-20352591448, 849733150, -302072071, -155432816], [-14732252646, 873805676, 223119316, -167066182], [84409867572, -1254866163, 237362829, 288378687], [-53341516075, -1775314936, -163064831, -40636060], [78707572564, 691405039, 151335331, -7727741], [128766136386, -2179614936, 220323642, -190820100], [10109935906, 843885546, 534270765, -63431490], [-111195061244, 3983252518, -70598220, -32305280], [9507986367, -244049819, -296287703, -48949214], [100920596636, 543997886, -169999935, 34294997], [-171397608752, -218745350, 66931935, 128836345], [51849843222, 2822880316, -341817098, -122647739], [-91859337760, 1702437791, 132893873, -142893067], [12140902815, 2469663988, -69534001, -157228574], [91122762006, -1065885570, 218931573, -27096669], [-75278386877, -1145375277, 209563899, 153688944], [-110682134889, 1005518496, -234799461, 61905000], [-16864113100, -3456242080, 263330172, 60173108], [-42471333020, -5129993321, -232401165, 1798141], [-55113700064, 107889706, -381322361, 215369020], [48059518463, -1811077024, -58316008, -223660417], [115332909220, -196892324, -6723416, 77503078], [-160395312500, 2401300868, -352500722, 125332478], [63722775759, -2925005013, 105773003, -106724184], [-77161874122, 1986175536, 231222072, -10504128], [-32271753097, -1668847604, 704672359, -28002146], [13728189096, -227996953, -70891975, -184641127], [170921949114, 1317414168, -39036123, -79355763], [-111410653300, 6601168, 329615636, 298768624], [-212014726248, 445640154, 309162007, 149419461], [-101661678988, -22778928, -393412096, -179719062], [535786990, -3601319147, 425452916, 59937604], [140658572277, -3347490838, -483319394, -271135297], [-300722755055, -433894036, 411608053, -179240266], [49304105253, 1351905348, 539531929, -79806150], [-90310475308, -4321350916, 247399068, 275966000], [61838714034, 1984301884, -421214710, 237615658], [170061510087, -4330715004, 260803879, 96210618], [-213427163808, 493099198, 882033775, 219908653], [15760113507, 2057999004, 253811134, -158521008], [243504919254, 46227703, -346274110, 317495746], [-223485318635, -332777316, 217573901, 188711694], [-256096047048, -1378039520, -110864964, -149252912], [-73285133350, -4181430152, -578899489, 3567091], [14241916692, 1165251954, -228964449, 149071953], [11269022142, 3517482598, -211990863, 195786145], [-18991646174, -530361609, -817669811, 375784803], [104485770058, -7465791372, -166271742, -339765063], [-27049664082, 2171165576, 24344136, -64683340], [-236453445709, 3665644232, -322636388, -255588769], [-166888319541, -5254946233, 1055877827, 245036360], [78179698571, -2551207741, 209548567, 474396260], [-6845607062, -1858845836, 56806349, 117961906], [-185091935103, -1525726202, 22910006, -84774473], [-161665771468, 668720686, 673316385, -78401225], [-186591552345, -958732250, -672017878, -279664595], [-200298542678, -1154590280, 38207924, -204958856], [193846837638, 4462097344, 407883917, 253843105], [48544142754, -6922871668, -427470048, 59466758], [-141830371035, -330309244, -172487222, -236081698], [-441002779964, -6649687980, -440404156, 187216500], [170489984301, -2951830396, -808827524, 149851145], [-127725841840, 1221827316, -797956796, 188994558], [37595677446, 2774718803, 225957235, 368569337], [142220265000, -1829317434, -587184332, -444453156], [-259804281758, 498282848, 54448142, 266638211], [221064192177, -3907902868, -206540618, -531462388], [-308131487512, 3565999412, -123023586, -167636110], [70191081250, 451765180, 388006015, 164744740], [246269957274, 7584600404, 832382572, -126280930], [-22498058447, 1019799482, -1146486148, -362313859], [-39551460507, -8657066440, 660093047, 194340068], [15659174108, -2830631894, -92418263, -318148631], [244014875891, 3134076987, 803336105, 150872910], [253216957018, -416336808, -979339312, -195293646], [94740687045, -4555499486, 154796882, 45102835], [143010589515, 2613227436, 705973893, 431620974], [-51301081042, -1897802860, 702478430, 28821434], [394886343447, -4558225376, 492251309, 517372816], [-280421597086, -3274876768, -622002584, -569943406], [267326524644, 6459272541, 627321527, -360633921], [-487309862260, 2553890815, 184044539, -699394871], [-184340175126, 5091006028, -533583022, -550884392], [257062482665, 5330405640, 241865519, -183520344], [249605720808, -3301022894, 63870233, -696678515], [-273179131624, 7797456800, 72118480, -90498031], [-112190904182, 4744627048, 692214915, 20343343], [-189066046550, -3396475872, -258721202, 490495272], [63114285027, -8241065372, -326415770, 161211742], [116215764294, -3410129086, 1418950701, -573766507], [86867607239, 10048342778, -341297394, 280949513], [229751062419, -1504579924, -473227785, 230169470], [312290823645, 2617154090, -190202044, -330705811], [59409920078, 4227376674, 491071357, 209941461], [47490547087, 4922882093, -338357797, -140543260], [-4719874662, 8836465710, 604060352, -628916754], [25044665298, 9356033250, 1181994317, 245692083], [336166232558, -5784135493, -621373410, 205792958], [230996933341, -1263179468, -107704551, -366255566], [-315781363842, -2267304080, -882272144, -834831248], [212572013170, 3047985694, 458402952, 640180894], [126887167187, -49498660, -51705355, 262283678], [172412780454, 2483326870, -2018508681, 165166030], [565799882592, 9272258100, 1255821693, -91465677], [579521860218, -982055403, -129804850, -384779346], [687475568094, -2669852144, 357506168, -496577768], [-325731349896, 7899925850, 285725898, -125240530], [-95145900059, -9618877992, 426737249, -95717520], [117126815724, -1745807332, -1822425234, 247263671], [294721611900, 4902625066, -699144370, 30265966], [-193541632803, -5090462478, -782583094, 58870767], [364359565138, 7088098315, 1430334325, 369794767], [244615053970, -3089388812, -746147127, -709118696], [-128991000558, 3412922660, 1873386956, 70082522], [-350381064569, 9568392070, -342908960, 92761087], [-338752807297, 3037369284, -735433570, 156776772], [-303827452191, -1595427782, 1338746436, 70682713], [821771022044, -1425061043, 10508778, -476485304], [-487060465263, 1503936208, 611691636, -1119434675], [276256953426, 6483421564, 662693578, -250303070], [17144482592, -6319472224, 375695509, -909709021], [-366131981663, 2233451384, 26189701, -719276380], [58913860656, -13405088585, -2156180943, -1154507111], [-7396477743, 6878547136, 81063750, 940031203], [822816777076, 4933645010, 1341685177, -399188302], [787312669686, 1030912338, -118637687, -118744704], [-572557527458, -6452307274, -646886919, -216398869], [-36278761962, 1999393826, -790929979, 57657749], [-371719727787, -5686200236, -74615554, 225896332], [-790624141211, -9573493662, -132833466, 335117295], [145861464837, -7636884864, 222805660, 553107996], [123096317774, -2940679890, 397262985, -31323231], [139182143988, -9306968414, -1211017374, 103997806], [501228159701, 1906483934, -2037557288, 1116583781], [375860286148, -13346774594, -132956523, -101319665], [141838271731, -10285962886, -490799518, 130706405], [9716402238, 20822112872, -545711537, 386692967], [386395408877, 12369509032, 1403411602, 433066108], [-57575971104, 11671724146, -1168141821, -593496767], [-72928839219, 8645312595, -1331802655, 888539928], [-281123736878, 3720834135, 2440593127, 1261007961], [644550319305, 9371749108, -833970324, -603708923], [8388095695, -2382431208, -1243163354, -68362038], [-1024720429900, 148051780, -487533984, 488089324], [873812234268, 9024592208, 11777346, -321738163], [-338739148276, -4218867505, -1015677227, -1160823481], [-950421958563, -513213356, -994669609, 3821890], [86143087796, 15247638818, -1090706925, -532171453], [298906623213, 11973478792, 2553517152, 1545217522], [280541451349, -6319913532, 109321264, 1478306709], [-454240463112, 11048981492, 891227512, 680547173], [-1132283632842, 15468978704, 218791090, 712922516], [446086795496, 11871253924, 634664317, -875142101], [506990401369, -1590976956, -2573295085, 1122776982], [-208175327094, -7424327736, 2962425928, -96424860], [214999616026, -18192296894, 1455131419, -798259613], [-134446454748, 21787079495, 214160576, -751310662], [1113334364752, -4955488844, -342062420, 4528075], [190073392707, 22137080832, -2005826629, -393413280], [-352425501132, 10340949115, -155158465, 1241676709], [1187482747307, 6086430622, 1415160514, 610253965], [-1565110609385, -2265826648, 174586830, -502870012], [1190348230986, 11690430104, -1220142910, -192156226], [-1149322787124, 9639807850, -1255665766, -1153945694], [-311568915194, -7371195968, -656403741, -2254926005], [-69213267816, -17356177342, -2113972217, 724446362], [-762245523084, 5550958680, -2412698911, 753083163], [-1015658349606, 7880880956, 2293629752, 387483674], [-997197509246, 20791641582, -1848440293, 1608864717], [-241810079580, 3732243508, 335826512, 620732140], [-46735162404, 2748975649, 1657800557, 310901413], [34603901224, 6047153820, -1330054362, -299381805], [983834308818, -16645665238, -997520447, -372743239], [-1052814601221, -24807194790, -146826218, 225595881], [-111157505826, -4437203724, -479762679, 97288938], [1205602166924, 3457052783, -283385697, 415766327], [350333708430, -17580869504, 2021344346, 1807541836]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_350_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_350_8_a_y();".
// 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_350_8_a_y(:prec:=4)
    chi := MakeCharacter_350_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_350_8_a_y();".
// 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_350_8_a_y( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_350_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,8,sign)));
    Vf := Kernel([<3,R![1379340, 135786, -4597, -42, 1]>],Snew);
    return Vf;
end function;