
// Make newform 50.18.a.h in Magma, downloaded from the LMFDB on 16 April 2026.
// To make the character of type GrpDrchElt, type "MakeCharacter_50_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_50_18_a_h();".
// 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_50_18_a_h();".
// 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 := [-348077240, -3151882, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0], [-3, 10, 0], [-210119961, -16600, 100]];
    Rf_basisdens := [1, 1, 17];
    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_50_a();"
function MakeCharacter_50_a()
    N := 50;
    order := 1;
    char_gens := [27];
    v := [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_50_a_Hecke( : Kf := Kf)
    return MakeCharacter_50_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 := 18;
    raw_aps := [[-256, 0, 0], [2504, 1, 0], [0, 0, 0], [-5969735, -128, -1], [-36024563, -16633, 103], [-1779633635, -122018, -169], [-2877261388, 743638, 1397], [-9117577818, -2706223, -5798], [46360205306, 5454466, 36854], [2490691892243, 10816114, 196877], [660914191878, 389974094, -366062], [3580232992217, 2143586658, -1267743], [21377966912193, 2208225936, 540276], [-37877865414083, -1232427482, -4506241], [-42851811557183, 13265820242, 9889663], [-184899898953422, 6506910032, 36060892], [-209869339808569, 88450836358, 6577589], [1318510692656639, -37468986642, -72848349], [222012470209949, -1426879179, 94608063], [1817694862893495, -209118198282, 209579433], [-2978451421083832, -485027932998, 248798127], [-2484940639315327, 317812023372, -1401066561], [16212802171289537, 388414434985, -1928271853], [22385163912380370, 634715503710, 4480178025], [-51974803234609824, 649914896900, -5702979662], [50891096701064089, -6252637222054, -8615635187], [116868572445422891, -2765585222130, -2712234075], [-26168420376605245, -7478820042389, 19947971345], [153231275931044305, 9379563699226, -1763903491], [40945032113203691, -8878856104304, -24145897756], [-607176600740843140, 29456143948146, 37108788540], [1382978672700381821, -9553210740674, -35645205433], [-443658583036990041, 92711141012892, -16210921098], [867082846199756741, -50281775520777, 184721169159], [-578800301384287899, 459989342190, -399836808693], [1072975701740008277, 73030724535120, -159054592245], [140053668107090020, -129198142627148, -156066468346], [1179242955845617515, -546029537386135, -145730666567], [6297623640397670891, -10835245538714, -254248104403], [2243654789850289576, -462312415717720, 408195309160], [-5343322878067485304, 932709947221921, -427589486224], [-4599257490397003674, 962311587450224, -165949581836], [-11786358175743700840, 1091688704941918, 1329716067608], [-20743586667016784380, 72011335424790, 2046778764693], [36452947059951414004, 1271514658951916, -330214462142], [-18380591413498552460, -933077663241716, 1156426636076], [28639999368572409793, -1874959757306075, -1276592942413], [49986723800196804618, -1322334043385776, 10190130306670], [11772363379231594773, -7693629164284002, 2690802816639], [13408891055474772498, 5134412029523588, 3926027272018], [100094119321963176702, 3004963519871328, -7858930874856], [2435715401178047515, -3413796584599078, 424495909693], [206603313087579537984, 4760078612537870, -4873269617051], [187462368209137987540, -4615423136327485, -6622439145404], [-28921355418161122684, 4032688070946868, -52768006981030], [124746495030033518218, -20832173948508406, 2452173143950], [-49358490409093588646, 3419124803249396, -23937722006978], [495650920816080736664, -9680261270173374, -9617077935672], [-152989713180206803659, -18518374935506938, 72928123674451], [315715534714429661752, 53640044612624540, -55675858746410], [191297324429819741664, -39050189926985101, -46188214745168], [-224440964426881169295, -9485448180354510, 122131104757413], [-415690606383585295108, -50742253561756335, -194475385492140], [-609050068292158616521, -90427791540605336, 38738420915945], [-1135090854206136306996, -27893470112183572, -140159056490162], [313822442698981504816, -88528270787129584, 149854845884692], [-2123949189285461193703, 40203165419866227, 154781897956683], [341029429879472584923, -115897185200970040, -277731953036048], [299019559415309867907, 186095697723232179, 190723864839321], [1097660078496031401473, -21405652600019022, -48292307552187], [-1896512768829595229220, -125538705060515868, -545041158380214], [592859195034082138753, -157767913118891956, 137572362651607], [1304764537834806417908, 260452873493260548, 446304349059924], [-4797169419190687798200, -259901081011691740, -141660264749342], [-3509603522579934104298, -112441668405159781, -705572389049630], [838188529605198304103, -461874606767508272, 1290502640630441], [7323951466844886811190, 496224509951065408, -782722140292648], [-6298636380899575112736, -56207961423740776, 1414899036793780], [5634489226435634207946, 467853491210840994, -882537148829721], [-545592752901892799001, -324572964294069676, 1503541261554214], [12766148270399277058502, -516216208858442387, -482322523457974], [6397579138403438329742, 394707709097589660, 126707035028790], [-6031746465374574510339, 105054349077201540, -1424289606435237], [11733924155708017794634, -909945423641821022, 1626483666981623], [-713972870404393558141, -555826667183869326, -1064093891332251], [359840062205470420094, 85045687135577107, -4394460353729806], [16345403981465573967172, -1118718022559861218, -1429990883925383], [43108667845157736600731, -468855256861850700, 3812816763912558], [2207485224338644522176, -2119177948697603760, 6032784093621348], [-1470433003404992602798, 170259726639678312, 2617421866466190], [-18714499050541416712869, -2541244436816982654, -589964635232583], [2867496474335361024110, 272691673115357410, 7550788517421650], [70694808342585091403464, -2316383924580376262, -1586994889314064], [-17473194086417949898961, 4531391518015377794, -663406898079635], [-91676482361303463652471, -1153583893740283746, 939423710432139], [-20617218417110134236250, 6922011216621612208, 8372514571332770], [-7732004209512451970646, 408546163049949072, 10226853777755736], [-90632907749806155446175, -6080949151905333720, 2711048921767596], [-64307608703909247163567, 5721277565603689083, -9719004662940429], [104935202616792963974260, -13445127910134896192, -7828902645829132], [56078745830622381467936, -4717217132228372487, -14292023930181120], [-63078973938576014361, 8587019964519541674, -11422414096800435], [235956611624810600303989, 6065328644143507418, 9165334877090143], [173364530173836516697309, 9509780888979530648, 9731108243656420], [180863457298728736730761, -8537574131427010490, 11744350944646883], [-69087537363858385141681, -2560627779971955792, 38548882028678316], [-331730485954535962755792, -12401137830513690969, -10213949921162304], [1374867355502265923173, 8813655873756233492, -2850055785528878], [2761406332852238819415, -11050747332127949184, -32651395162786191], [461785385984351444943388, -2023577763071386118, 16996206101476475], [139937198678113769658752, 36934259101022187768, -11260614626488488], [-79799791967633352073474, 13813200013852349616, 27340065707740944], [-180753894397585647124722, 42827114816855461440, 31653961800306912], [382745216039467345104875, 7397997139416903330, 52776214130259105], [30641110816473897178434, -27782586010917828706, -65262033954116930], [-121134946156855499029884, 34527624116793061260, 2761335734234838], [257841284415284662449935, 4286659048094975898, 95166325455163125], [-666005988256179140095774, -378323617114881008, 9427087085724086], [-444860399988672376933531, 11659098488411655322, -26263777961466271], [-90732088427151949181695, 9195911791342800721, -17899791448778461], [-295992456440484972417985, 2734854463654063074, 91777085416241577], [-1001088319599988075839490, -26049477626095481880, 19053768052109868], [-785899500182642877586174, -4024063555168814084, -34309376768348578], [799212392151410655135347, -40634174813388698321, 89807210480980553], [-1137816151774031454122116, 8164004404421412105, 20006546308935564], [-1095093368254800157844573, 45760569250419160922, -110712571174698407], [372285694876066588936830, -107923344776850846388, -19986400316168282], [-315464274289911867387021, -103530194047155869220, -166022379829711707], [531689863005274712987321, 36625038573297049302, -176807869677876729], [-2140805135750896801550215, 47013008411785185846, 156019589057414187], [1059342527148331347623771, -172754772119882752614, 52456028773333641], [2045565382733260316037078, -112420565009417246310, -130990231072614006], [-3507707747671962747889, -110002054887272102334, -29299461627418023], [-1068378707817484179728116, -226115825918709005712, 324903861012323196], [3733235081751844036209161, -136468394992480458128, -84236290940889124], [522134892210961334680132, -94250376319163677898, 202253449484619677], [-590024540796091800331801, -281654993087255625590, 82277384443117361], [1107787552651223940198185, -34225554312734028738, -520220857807090821], [1627689725593611311856826, 127400309576338441568, 468441802876220080], [-2607378243647273634025632, -239862099806215243308, 485749364131735074], [1702820817825619986155025, 184603849638077518262, -471333623674356581], [2311682599927484864143576, -323836671624889849516, -386138141083946606], [1565142965152270047415162, -202008667651630337576, -39651902252731162], [4819344343539564819090688, 152995057642142727719, 252107461651997968], [4934612044185835936992419, 324008457765985143738, -617334169897850895], [-2811279810688975085959758, -428625964052700871308, 349539983123539542], [-6339514254030845293260244, -454490265243910120884, 295570666065317454], [3559728825914447247960877, 210415233154579208576, -532445845230056336], [4165149880019583651186593, -285107070678168034161, -293985079378796133], [9367358446388915931664949, 271836883316887897678, 325254803839725203], [422922390954905922368020, -134461797306237884120, -337446335830744744], [640333469612290785141780, -494517566262717374220, 58503270151559466], [-5909343684145945981905684, -571739164914076615, -1865476114741994540], [13330398283373425255143752, -88206188439303783620, 578040374933343320], [13554612783259068027632693, -316706714638264130274, 373271510859526791], [-8914801937289690528900540, -246349841737630280820, 740058631513170756], [23129045510954956574787284, -63176250712937844426, -80133909930730236], [-15352862891157220479063238, -306734778636403718840, -828374160127208956], [195452028589861602768754, 61880434120128810550, 2457170021882039069], [-318834560211196306380757, 614035387653146256034, -1636242152217841687], [-2133096367056297034867043, -201570311857572005470, -1022701067084719385], [-300905761096043324526991, 1369587081203610285088, 73346721481247288], [-63335387909253303871024, 394697633580728199480, -1595877714162642072], [-3804497289793176575429539, -136591604829438480065, 1277310818750012783], [-15836414093857164105615642, 401194762666264672722, 1311034590201556215], [41965327051368906830478311, 93726195918337373008, -441537389318037463], [-9462535941190541924410345, 1064533362172989095400, -3962805686860711119], [-5305387124235060727775470, 752426321333611721964, -49321894626263958], [42373060334502605322934298, -1587352956097982336766, -1308374067285762993], [15911739448697994971719949, -99568878354797690642, -314196491425716277], [23688044845205450038294070, 2340772720507982809579, -59402624458052374], [26337173249234975359130351, -2985643285980569783634, -1838689790248883373], [386697542152044513302425, -2508856589655624832300, 2827092899114327911], [-51069035721479911718178512, 796953733612386820354, 36272775532945055], [60484503586420930540117723, 356326358496306220234, 2249915555858874197], [-46557921070678862027531188, 287579666546664920098, -1005400628924134249], [27926749599577696535353020, 1619215190616239007707, 1868920798186833004], [-30477278713636132021830475, 338325987149817461434, -4721309464074223063], [-38571433937356755959539106, -730942721410013569316, -4047698725142628718], [24470483854380606484617724, 3947597092806137178196, -1668114460285580338], [46238658242266607702961258, -1048349307125315764768, -1663483652930756810], [-49764745628730860031790606, 3231362420928239449333, -2002849313211261034], [-69642938992062264549244549, 3825472404856996502022, 2319077585307109083], [-22865538868134673464319084, -2178184900786122666662, 2819859392988567815], [-12909507246567242112042811, -1746097945789979801942, -1550602675530224797], [-44851446964629140497670686, 820891106850631951996, 3354696611221056362], [89027070915839246938409009, 1871241973504426354794, -395593485063513855], [11387761406403420707583414, 1174523760027402083441, -2988747144474544670], [38595709072913229230363379, -3959806143558871750012, 6680268848263779550], [4847156062804055793027835, 3603440504842839909770, 1592507656745939581], [-36322030443660743066569053, 4888429937638073485256, -1595854606435646084], [60426728859245517201350498, -3235412852637273979217, 2993577925156835126], [11434369681525691806644949, -5626495586573496203627, 3331780116995578391], [-23343293177548769400362826, 9040718929035046050600, 4309831072337898864], [-66530382996324061672839012, -2278870276562614420443, -7806373439892452100], [-49482525268277919174986402, -4444680980716267817992, -17509904191706287124], [147483924014947270565687687, 5195913308853905754792, -6366081630192664932], [-6085064400767020435486432, -7912207664105563204812, -5521778677088977014], [-19600243556506414854440023, 4631195474609612755204, 12200496779346494306], [145603772248595511652358113, -298868334590640087004, -5095068010369756697], [-26374840759536675058459972, 8722195428792886643428, -9014965968187558162], [146419337026749467449490876, 8715428781404142319188, -13951506232318187220], [-6976320546580966840814788, 17534719976533450909104, 2740129668892025196], [14944113257900853336443147, -14067904459510987725768, 11512672281090861792], [124882187443729929728966595, 1928773282142347343586, 31416933389461456329], [-772673399449833220249456, 6808981692256309885444, 31928402964082686650], [212040634608427879713631686, 1389350879265101884334, 1833495883925154178], [52321377127843345486093165, 9107121432902749547174, -23182345430267982521], [-23747661497746568249961402, -19773919797093034794912, 2896799704512168648], [175837480969091884542414555, 7100782949494949672558, -28237444480649389967], [-89110833963757423777188150, -19630235903906853999280, -18956105780322110504], [25774680209084382354148993, -1169775597158455433542, 1245066185152915129], [-66919344445788219696663025, -1945238730181422929502, -14666113243373144295], [-56705972044159690580687853, -9067335651145781336937, 6688987722320441457], [69287295778116396094831042, -12079640230899727181530, -33358269309201327386], [53896131692569844726370779, -24414614597060364235236, -4333731993133211370], [-174737669845342176039857888, -13716137618600088039374, 13624298973612571904], [-437374201992903870410695624, -695709932550980595098, -2303277296962405399], [198489726394427054167018373, 6768154674075078275740, 19928396143505895227], [-41187947985010365618890061, -17833678247120977696722, -11523896724893222217], [-351221922691704546263988906, 8323266475957702567496, -45010323446977962272], [-216118041428234818823737555, -6758708280641621120406, 2164755399253420251], [38437670887062884456213656, 9261606548686700106110, -25628169257056955123], [-668294406309678626837418697, -12320168568890366906952, 36530607083845826121], [-216380095778610097519950066, 1343094383773212818757, -33202664538793215198], [-50382193105575561549978467, 25371519446550281036602, -51736699105911537271], [-148414798435058518562267466, 13319829390732906657270, -47532060992080116579], [-276903960461888872274902857, 61300736012736436576242, 68502288365850239889], [-85433515664804040855877413, 17217700349329255152494, 62622758969024310541], [602316988816559634906150608, -56682829096197949403537, -65242184546100820696], [138873089957904965941790935, 11082518125641683229166, -45874555278670536733], [13035228419547800357998499, 52124161632398713124733, -11385905919791361015], [56292686418543641658783307, 1972886881337660212996, -95536565824109203771], [-182430069348950877867317362, -45204887593085956955618, 14058517754288871605], [-259837521992009083689519973, -21954477664558205116866, 10122815299488571233], [-54032602300602098722044481, -806599893596942854016, -59693057866406784055], [-788844935552220200314856656, -13712547727773654267762, -123278696317838751615], [1317503556527709040142516751, -16064508250915667478486, -13461246311185877319], [-1053361170465207076811047278, -56260944365369928802089, 30132535471378331118], [87232220439991956899640926, 5593545452538993462880, -7874453176246846942], [565102198316318841654597742, 95785539459507340712237, -91561039487707544630], [301485973876096117018954184, -83798486724045796310697, -6102479407113285384], [283419205180357432412933564, -43431324984342871634406, -129980611657364155188], [-565033230527528808666537790, -24462636221011316827836, -19256777718176609214], [1297075892034442504127857663, -47197133357525975528224, -34013281404866492852], [526225870780232170079891814, 20768383198029101639268, -62359473787647231270], [-407820225662767585147037703, 32867255931704996788892, 12022344176327546743], [1922732135746506763913589079, -4411002697268721679702, 47678860864044133501], [-960752963386470232509374994, 21887019163618165478459, 5183008076718843418], [845694508614602877706388509, -16334723832544468327138, 237455636045354609419], [-49513481322360601176064270, -72768076031172617264124, 176771308800469361670], [983616127323648264635919223, -45152368266605581604920, -818364662800971068], [1255764552219785330266867393, 54732121956190791106628, 3187521836825670079], [-458945287107430719591198868, 125521616708905624133850, 167135775005454865659], [-317783381034486569858033113, -57004533845711461251662, -140199115542757690471], [754804428317170894705788389, 107322647266516552001689, -40414355280594857041], [-1603674122032859779631424769, -19338860041115171986158, -122219101469992726119], [-1635023682610506143923641010, -8922741167985342120069, -29079166858170149910], [1066126653191744898950056715, -135176027870671591602578, -105282346806204177121], [-621972139746114167177495737, 43639551708052874953908, -197667083414917287786], [-1293421198522590988324834155, 69536881321007792052956, 179049051194828369947], [1887459600693428275063487535, 58865481936662213133729, 13846329947267738757], [-990997334658483809299617181, -178188809008108419366702, -99969374208418396635], [1211017356555692061883924981, -143701666674833629119722, 76018588369290925607], [1910290541908713754042956170, 61590513692003744985034, 46438583523220104527], [-2338529850698154782857469236, -99949962829674859408551, 237392207875359197364], [1325911222487812524349454240, -125047536160644363654236, -267018707871525024874], [-1207284292487859434397772716, 271379432701624501065972, -3775938409298779158], [630076609643723851725897827, 68268769605043334433903, 162281224959175404969], [195294029054001530226422373, 165946697709530326437546, -270982308946421755827], [-211057864365195036600948509, -122163397200121507742774, 362222545642883301617], [-1404056171897863715433118975, -12246895998027549733671, -73157120589566716533], [3239218493584416881727937424, -217949153899681698991950, -52293020476338720429], [-4568592844767302647421927281, -27031934596635680639430, -230011471504355611047], [-2120025424696347881238637470, 119098718083137133078976, 456254952269525178400], [1737091370844802812928092986, 32116251963008928277776, -370100119198661030946], [-28072233386739149733260299, -143269276908340106070701, 535050990190254452159], [-3100380974068754898260006868, -32883639919992122260336, -551716397682983897660], [4018517293021705305670152738, -179773088670231698867368, -106573239819143228900], [-1943713234356272729331853340, -108635277408639395208415, -251138804308732340324], [-819263976022096841812877338, -133483822923180695304488, -501654623598429055990], [3785043889296415584464199962, 119945348780482684399962, 566011679154355461678], [-288410538798737519112058112, -140291939572731927862336, -172263009614393644232], [536830242293661540116213888, -115127455250375805578088, -90907251537633352620], [-5196444805457108641471275694, 6373155098454124083471, -534702636189195555258], [2818581834873179120556551222, 446082270664972952711140, 244980804945483387170], [-408665284973648111272478678, 429722595716571242867368, -542054624005364453356], [-6438473694448364933419942517, 46107224823676811999546, -801332502544814230979], [-4455404566044224795803281550, -175326222067885304644860, 77066922184928385750], [2196228728295277773866039266, -115189951424977181571904, -767387292347583811904], [-897893208719556338052876735, -406966777231298463240222, -317090506404167581407], [2321828363808628587759691205, 333255290457413361323614, 644177827231011132527], [5062578220258077548100277612, 158426651862537399375914, 584155660445895796723], [-8758896878524932813440251876, 406944607184005378334539, 299998815971960727380], [-5546340423461124734843670700, -8366103532512108299064, -389703305550564534048], [4245695429274651072802931552, 267468704627829054812236, 466740299391827015678], [-5417218255086117637782171135, 179732801938227252746720, 512749958949409519591], [4668021286758857268738883221, 608721549749200157282790, -364084159039032375285], [3236441293956269878001265909, 403280716388933970354486, -616985721059056730553], [-3231812671797721540030347073, -517892596622014608015867, -722216071604332417923], [-10322028804450174263137090009, -60602286384196376709708, -313168379159714360382], [8905293262764203449033832491, -924808336998903254834434, -460998076482021456653], [-1869582455467265285303135144, 723310756652541439383016, -357681761731359978064], [9324896850129146841057046440, -415429366555559651015115, -216728642266193332512], [-1887716633690995444415558032, -627338361091875348345285, 807149273433618034272], [4799086701804722387623278946, -611466050644406360866598, 247684091030567854211], [7768790832491009826671308089, 1099571062742879358259278, -1035511301597107078989], [-7111248360522662918569631719, -1161641505820679042502558, 1382944625666612205645], [1309874195393828345319022830, -320677308750567425720154, 1974496171990889183154], [-6430980971206400242666585921, 1267077722288599810183374, 701842113957085820487], [11072222561039467694453873059, 1246474881381123800456024, -1143530409527414927603], [-11171710827339084070544075690, -2460444662620207103320, 206285122748524935100], [11953506730080774980589522976, 124598920048474125578246, -238000737982689910643], [-3636116734481411799999940287, 1705391586045365429205674, 483721108402515548035], [2348580682632650281301156520, -96980498326033968830220, -86332050087678109584], [-11482627830595655511201691100, -331224695777202551423420, -1318617551231953710910], [4190283236663952455789559418, -546480505800808984866175, -952152245517737757554], [-1625652716702892045333917888, -1578629449895268371232688, -207765883731757235192], [-12500366366335930053538906059, 444670594655016212332388, 1174476643283616794842], [-6496101436571315912761451651, 1199638457686797370561820, 225238276477067100598], [13355124372134627857693430981, 507086359804684806421158, 2207577609320509969695], [-221949647972020236135271049, -142413286649967245500652, -1110598081086436763410], [10649034142373296185142373343, 456084417388189697531994, 1241099766842605216053], [6239681174238468942063206022, -1499732639543669297955226, -937369760073106736942], [9491832506444083364095024620, -38943006039944297156100, -327212758288635006642], [9764763464926780424945604668, -1321979349132615928836132, -2014284469596504951546], [8490123718087768473479099843, -106384681845850108398879, -2815736075359354483215], [-462266926520519980240506529, -1177944697223130213977310, -1566739934983894214835], [25714716245327104925091679463, 1407053964351539377831420, -541614179166071606383], [3987303740263802346963070039, 51460029255588551162210, -1607817433791756066659], [1363077194827002812483661689, -1341237375214140592604610, 1315493056161204903819], [-11114563179501497848618061301, 133728673442987859961446, 1913553236155716508383], [14761981249875265400190914721, -1553808847884091133725180, -288355621054515204713], [6360270795620300314934747436, -1509758448109393333009707, 3792221956602525882852], [-6690249119265615948327762529, 1175533789474952682032223, 2955489487833364198605], [-18563819073687902644375659705, -654480734553577500078666, 748669994061425611797], [-5438620727217892876265843965, -1756666718985139525986702, 1538567659212055234917], [29974716411948529722449244690, 390736323227821066672128, -550166177270104275120], [11693585976864618682832808358, 1801617293519554018542358, -887140219301484900811], [4806558948742964431923746981, 207787015178931707577288, -3220620995280593041965], [-38125330877005563243587226138, 1139974857160679700786140, 1221210009213591684442], [35753673480134718781125856539, 268329850142463627879492, -1484336815448257078578], [-15018208219221138338633678874, -3432367460659975497668136, 2418221925546937495968], [31559156436203289815233464385, 695838334757294593901026, 244818726028745931455], [-22102329697063399437196621070, -831955702291871354432992, 5719301844453311980], [-487225235123449020882775513, -251991293431784176656326, 2756299860314250197165], [-6282195937188958488397060477, -481440917066913614323854, 3129236379424654220601], [27509493969718922797898094556, -2898659910128199995528573, -2232018149609005125964], [-8302253622184374565157560823, 2649489285861837495684470, 6198107691154168054855], [50956806861840479649101891939, 578157215248068438781798, 3971113092726874130771], [-17274976289822872957015495937, 741216334815054365732221, -2483399941586748321739], [-14596775436552498080990949460, 546197144091141194365596, 1025733560192033719350], [-26884933396862286918031332719, -408350060393910056130550, -2019725774653439373707], [-42801007178741603475827807509, -2289893440775089736304354, -2470078831423613307531], [8384424691900625438524532210, -3289269030434179226015448, -3143893629315653206872], [26984352589932324296406894944, -1374841073745221278115006, 3046529577391565662247], [-28446788588842259411002754483, 2027295875127461189013338, -2219538040571841359429], [-23599160141296570066991990725, 167657852840354579053015, -2111686549695253434799], [-15170905912651933334609232938, 1220037826899148522500080, -2223321643555901227880], [51633404405686999409059446942, 147154535948375452901568, -3284688382742946188766], [44294275521276403765913590425, 1463669372018875322533898, -1650390145768923425207], [-3467713331485798896965647854, -3453041068356260935621602, 1019447292811371913845], [-13701657061872066507928994277, 454340757720569027561496, -9225769969398230844579], [15408354674336811950890450891, 2012160041468569182603290, 289995873326532540817], [2852294067957595629592551149, 2645126850614373961046553, 989708122865094384471], [32534223151462230831162095374, -449848091100108217253498, -6031507270217683689391], [-57269917546073492155852340253, 3432666454644425408811210, -2022431557613257257555], [-4366423154795562829593528520, -85345285433346094596528, 3858164922184778425296], [38706798909865583096709353755, -2394122384365952825913548, 6542479659490570108874], [-27677610224518403058418386451, -3710290811980872504470594, -8089860243696020289097], [-14842935612683597917217675591, -500920000148925594953897, 4249505149315030588475], [75781038321253709406032073328, -1944880986442615166165908, 5764659940557374337232], [68866655581339422969063979436, 1233033952590976537063432, -1480046975920480894600], [21113143975154477405258212826, -4679040976071770662699044, -2590105300638925275258], [59072765664772636344702578085, -3457767798165967426935190, -8163895471690964393039], [-95434516725349177388735938340, -4981436622208030523336587, -1952499876048621295268], [48316845240794228958451524685, -3755631188620515344745400, -5388890007066258299309], [-37457277793089766157917728239, 1578840655292003673015676, -15074837238436056820846], [-4416927677219266036424296780, -5539841120014620107292650, 3584573672069348760545], [7516026310988533349715134870, 2692664361703289151595464, 12702031249814023074492], [-123695532534562442731501913864, 2146306616839266347047724, -1822171735809081044726], [28819571997467506835455877119, 9804601816216369459814588, 1274505436985664676858], [148639115315832822006757170317, 6115400767321178143285542, -6993468916955941064637], [-15630174076463119240840693285, -12895410046834613804008496, 942924491181421386932], [20631713689710972565428475265, 7143568897280092437056610, -8861238990666156287325], [-73759986624751835740724935843, 9169906805804061502723216, 4606560123689502404051], [-80713449985627304035380122356, 764400790647827761852992, -7658227720838566518708], [-22537425813487957304983419076, 700624611384055340950152, 8670851041215736217412], [-61720402424830860697756211665, -85807144018858005168162, 901756015283152404285], [-12767682404974974476057499042, 11364959048697187165008366, 2360760926603181397986], [24680117063034109761756265905, 3142801471498891217027420, -15791016631681658990990], [50267533343491794981347492162, 1343285011170257368102996, 6332804471186014826306], [153076095219169870344788286128, -1099049404212029198817509, 8092287200933261023520], [20379277949658123332252054805, 155634371080833576854897, -12341704058570844998321], [59962242873458036792433622182, 3252205218259443747708126, 11604118192363513569114], [-66574638138662439928900336459, 1702973182432515779855064, -2166927572113290740064], [-45638158177956842453947645764, 6116411626934510459853380, 5220776963448445003372], [109082765270562566394598433727, -501875415166369498758444, -2085707619489891729102], [38273894730352599118255815733, -2394454901204362331826185, -286399443464827576153], [-100980428273225178821138193748, -1626803877709276744414364, 3695057742896848028174], [32696910025623282017368277249, 6560759984146155582898782, 15232177145935971678111], [69175454305349442912697055626, 885869879387420529723746, -3635134963539178987961], [-130578652354252579090538106231, 5578548664506118070277002, -13241784985861831660433], [-153238022970522812077839554419, -8486317960861319629293608, 4188702443048628256076], [-4972296275606235564931926760, 13704610503000951412343512, -19403737946269128152272], [19213187748795864365011684685, -9305795101231205954693466, -19296179108650657516413], [-90780944112174329214781934814, -4719627273055578168166960, -4122322903903425946832], [20905180020896503296994609748, -1809984983552748581559092, -7462584461129646680986], [-54016244339617113592221804487, -1905449277558475299799050, -29534338372769623468821], [116364045873676293224821632141, -4705294760037422339563059, -20942540620789054153809], [155361468302380491432030991101, 16939644947106356087704772, -7432145185447138231742], [70948084051653880388856337276, 9132289374534919912954088, 12280217910299854654900], [-154702219671475586676420125252, 1533815738428093896285167, 21420466193509541358172], [223882070717534165316953405933, 6369352015639590471375414, 10269691554291929737623], [19130204211843323161023640438, -11951825274543940364544338, -8940732398478407419435], [66373862859764380848229544233, 1163688112626741366549698, -11372094096983318645171], [16461425705442838715838108424, 539095096018871604758510, 18267895407993071295208], [3519488222472967834638306222, 10133535407080235601893678, -1729993153534082653478], [189359146607236081267886226866, 11998690173084521878274386, -26714463967786164431773], [222631683384058959642715401721, 5443808805004544806722812, 3527742859853458895383], [144653444543783099482558382567, -14062556481939122067488342, -20797284876707550611719], [-162621379696084123698355947359, -191410370947368171183254, 24529752173980406825237], [163425123269269137993591181194, -10532263535771189006677890, 21593481587375296094454], [145976744201044096361212879316, 9877026704258369685365335, 446657414585275724612], [301373958906764044035626305565, 11770850561341096457531256, -22840429050833584033488], [-89693688833843970263148320709, -20117145069362058424764678, -8255212832514598458579], [-204593271772185909728957787135, -4493074510075346920048758, -23626183474080565372029], [9170433167942252199592988584, -20921782012118666270658454, 33604146007108855140607], [-134982928249000702162502317477, 16193723535906787340607039, -14678815377533705943927], [-95846649540111778935337265776, 20924511044662279949964766, -20322313307147424739168]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_50_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_50_18_a_h();".
// 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_50_18_a_h(:prec:=3)
    chi := MakeCharacter_50_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 18));
    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_50_18_a_h();".
// 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_50_18_a_h( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_50_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,18,sign)));
    Vf := Kernel([<3,R![424502140689, -296373177, -7513, 1]>],Snew);
    return Vf;
end function;