
// Make newform 1.50.a.a in Magma, downloaded from the LMFDB on 25 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_1_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_1_50_a_a();".
// 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_1_50_a_a();".
// 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 := [71708842875120, -27962089502, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0], [447393412688, 58056, -24], [-743587680658656, 59389824528, 39888]];
    Rf_basisdens := [1, 14051, 14051];
    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_1_a();"
function MakeCharacter_1_a()
    N := 1;
    order := 1;
    char_gens := [];
    v := [];
    // 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_1_a_Hecke(Kf)
    return MakeCharacter_1_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 := 50;
    raw_aps := [[-8075056, 1, 0], [-108984897468, 4110, 1], [21294678572359750, -830946040, -192420], [169797159166237064, -6197674750596, 657909714], [-6946662064237271871123508, 1063535619042334570, -33484749559965], [-62508285732446872760780338, -57281740925974331832, 1632545471760060], [-1101678545415825086394704964846, -46615381368280383041040, -1609842257538727608], [-15294314267643821585718565506220, 515179397762024205196422, -16168497468226428699], [1511130849341028884487863469271192, 41575353325588051258331636, -4642952063906422903626], [372696639772120656783058978058498270, -4932532089887193220553259992, -22780717823915256819636], [311408938719192858463052114113175072, 128791978232618110119691797360, 5259479255888177287852680], [80711716173124376976307617272854994534, 7849000763176644687755011191912, -168931657423214646502789332], [-2070579891992163605232099123960144241238, 44912880516425216966581789240160, 1690041462591772736627536080], [-2598391320962490879220222077937571260948, -269463044008422732220912317359718, 5326643180962329212965914507], [24252572612957050996962691041071481963824, 978312925490828802299908970127208, 65864822576911423337975692716], [-51950296890144015320671684003925556564618, 37320198726742550347461892562909160, 57285182321852935596828749676], [-20865642645607337920478674675202193847795460, -216987487253393211843166353411120814, 21731455223754109630623208371663], [-8012421322596478406398782685025955603251458, -2037128737158019029334208342561710200, 3572704369678694559847973103900], [-339680284108101700273926384516373054702486396, -14795454090916012378069443826262227410, -964089902670823429471733316294543], [-1069376445097316864455954514728591156442778168, 40553666516595059720616793932357351900, -158289728362351019999442527939550], [1889369358775137388604811961178892464288439242, -226856646163706098067911309310710321104, 1482496406144581594731035651780904], [-2623788465126768806704083908081672905041788080, -1465985608239345358584604852335536851752, 39462867100218292219889275550220084], [31388227300453743118616618217967928826859028372, 4536597502281765795047731295138455709734, 106472865840386651772907900482402453], [122602400520388451526485925733444290397371592410, 2173074286829888638825695737046021551664, -1147698510475575861734244988026915288], [-3477036194593555266650169463064042244931253466526, 197421661219357873520809814304924489801648, 595593372775927994670785388740184936], [-2611421051097029023903069389782208537827101566298, -147040217500887120354668665889227253087960, -1651301593867069909149816497082556980], [-6478853656955903201660957469890308675541636537368, 861423773715811039484022844529095756306380, 12803913170217283644183644489693454186], [-18119740223045093315062322794027736912347102215636, -1333006593555706261059296568957384596180166, 13932171991765630010629198774223749179], [-53734632973107960894399883659012887227169506835410, -1123821887315469539379126900943825351274904, 113890091876906166228023037101091879468], [14493282034794763465485274819841660902427729390962, 2215348703709475406288700243078466411461248, 37423855366392657166858593469165406400], [1800499187806659298836123514404812005833647973513344, 30110719290353505616171025091936824063090496, 2714710075062263970406644944769757342560], [-3989154114697151305262517618124356220327979670656828, -206463150982114683886687244319809324628111730, -9036415797656378709743323508936795703615], [-11485532695114548656762680571451595998316500628299766, 61960435893737592149274623715526507698745312, -32954324315900226992346724111242968011632], [3688344683490711919489845606717418538954346110224460, 603565676497826792781125097820670360979344874, 70125586608690653084068465153994319749667], [-80975434360103512455203910757566464147215957714270250, -602524523223063162925325188201767820365608440, 361141331626234976922103221406965900335580], [301253675192339329795442032745565220245375511056720152, -3512448565475051621992152902647373133318339660, -108067173974186461060218370367831899884330], [174628483158878526946723325663469491517376064946469214, -11218276951397418618245594808825892945685215416, 451226315516412441758605652990742313311804], [659551280446536644401304803569531017440458515273015012, 7041419764524331010242628383228662305283431358, -1428618856107007585526070217646955641567895], [-753391309957248842781721092470383607303164854476046296, -111980959059235283731585352483502240868643261140, -1997122830922092037334044568010391637545158], [-5851561949436496261893335055165520960175091056906170258, 54578423991006973486518678236500008658785350536, 2213835500451929002222812647900955403210524], [7996144177894595585015850040281360397186623960008581620, 21722697958709352599978460971710359177404919798, 3486941551354378401002100742736556176403309], [5437669620158123570650489129660278962011523196295583222, 444831387913694189145915882150410935563932320200, -5348617741307952551097170541975357243504900], [36318388239720785338256503613625942177979524522388075712, 3201206630035563322066805479750397889037353406240, -21532786398701807344131123543616274927396880], [8701176672109266260176989376341911230349212479563332802, -189494428985865057235122711566830187214669209808, 74696307247238775087447099305044435958463912], [74205966421271811721871320947311698228232633514120615174, -3216286881625064050561770677035759164575745709752, 63631931632193782931752277031820930959058236], [-199834024812099853675081948458443011808819857295218627000, 509154042761704660546645549066086028011794788380, -102649617383509012573982426647932803719718910], [-498772775048866570823774873843585272232774522167211747308, 47028955803313775880929786589825767461234632281190, 112481629689907002103725093647430655195753845], [1699846972235485585383701683917205394977727252545581716192, -8511588307821326992489167821164470514373874764784, -267202372676133178678958703055713894684785736], [-2953954568611113186058895293411045244284154557241182811356, -151529220246510838935815049303464880669938711669474, 6378229242964192226750676248072485053334656825], [2359134821696511912257622328118881296570166782323048178470, -250005638775427202077434295414525469341603541389752, 1047267525191301389941412781739428290922589884], [-6819531397300720601482777481325697720863696279073949545878, 42901868190881888601149440938254946586027719079344, -4521908720247118091394099156542171202037200792], [-10379670135071349744532582459456070806507603506240715277840, -308726367584887799255664067191169265504437879718776, -1297725545879876365497667910090283550828644708], [5863691445258463338325477516571043858980598427422702501362, 875726961175282301729020998897215623752185771266800, 18264840842694101959073128955546547527030963400], [3144435115178019887348881323062983042338317620693013112252, -1865615834064784578925355486137778266509656957249550, -34834845033609563620420133160658249624964609025], [117029810654743040448715336036395927644415488856491660947714, 1176884684142362536077541205596498809793045670426624, -3921399390110929418493106529841064067524402176], [-102968712916116454977625537809303481422037173373216876557688, 775237622382401467236061348246623427305687615704188, -76615097203375443631660240611378693847039808430], [318662720145932407604722276574516322712419808185994154842830, 6073263166197873287957955849228025082465187097062312, -263851209494533090896905002374951385668158534004], [-164774644464108567318097782285192738695174105672437350877168, -12401968451495069189943997779224862510265534310693640, -353942129518718927161872186296957448349778537820], [20531214411353409795909494313474407335475390606612703326294, 16373203287370007666454632261259289386341385721059816, -1583696912643056661454436438914156118817427941780], [738144419078998750332847710847074913590426897679542583399322, -33968145818127069904301022137831955651017648671863440, 130328573785963817564725839726456990710008358280], [-1029226269463599773712023605245838123645375258723385484424228, 22044779379761950675459379009350485276727892820060834, -282616994237600259985600862556299059154419215897], [792463124815531120323064901189045730112146816394337119993702, 23228823978076783157132740468707752661042150983031752, 4340417197286542419241968566968067803420427178492], [2387517491453310575165819285399552919372408626892735208462964, -134793941825794853334325497715972000003845315079892106, 3055639226529214043780318806381127920043541281709], [-11152330551555855114864110798862656318912797171161416908200008, 63245570934952938081533167072427830748706600884940260, 10042709899311154397232745043980362252412660965630], [-6025351201507150645199731388002266282892359627356001114029638, 272749466817516918250800853518622451733489880043761248, 12408574039181479070898463547027228799625080882000], [-7724169474748605958601149360278004651354486340849922336210946, -78872836384178653922883302772895033647577074563696600, -16374931712999038472299143314001345575951269886388], [-10741736891076607471208355195984115006098072111591787533955828, 2451853766511815398360540463024906193930490833606585930, -27201730574665638549811355472325032689439199206285], [-45477165426795906712605187424284073757461182312155030535374766, 381426809860824532304254875188114514847230339002745792, 139381401602457034258344544423319441795328981112608], [168907417329238985284671847821796742283057130078636159786039324, -1385441399712588422313220175659141451428745271236687422, 63536123965502479228918409870529355213188204872151], [-140734000114226985724024224248328010179316418781093416033927650, -7829702945350750454268194979798288905307341608547744280, -339297684879349052800187793779580299985753277697940], [-212272351598747120297010093828983072692187118282331907825269918, -341501000980510373877158864517961297193535452191741760, -263687578794126757010052194921812675433331169644384], [2081476824413176683025343831940252009473949967511622504977640, 4519057599583837083338141686167913508016611981974933836, 637138370755109739735463055167861008951417801223338], [552151993370760532950255047341317070451747784814178981454049904, 20667892264133144330802573573563152461803444623275885000, 267905725180589155693842068156046397936419877148412], [-311392394675246091166552261128940303108950134656421583030166858, 17853068811660746506605590199751864300257065504148826536, -1837460967987415769834104136540557188270141555189876], [349100097718170394763528253419799795591715140027866161870569020, 16761228466595466305887614539354793491636965165614408498, -1664289212769363501779965836515865244276706969505441], [-787357365007740322098089801763613079210391844535642701880563328, 40687747869268575433131567720998234224780480157322561344, 332411747152695176533288664183383656865198560237408], [-2463352296791872568550552846749299694544421649999793321885599290, -40615445866722778278038808006663246843881746102041815576, -753939024709903945623040102079749256821474670524308], [3061786885123984703240571165413608271532925851810986047717143374, 6026699991355610140767395771647997643772921563719862888, -4422197689492124000182062951945665247855731807679444], [826544441721954839688760050733964542982511026326395896205434002, 236453589809254884971357375564645961612733130458048273520, 8766912129118746042665246136088374794108215190282760], [-3733582803219966229819451057377953075139632683478488948495195110, -77401191134785848413008907801918265937320060891045018144, 10292008375023655710041195895317832331921633090562448], [651817199663589233458899692970489285898563549305961952242986980, -938529210310160826754067902619512905070759992682448166658, 14443736607409664249366311559011515165620639729583561], [7681079611009809575833687920126187652243186904651788242733406182, 569826777542921211948296872177593797134190622880943527560, -20784663927288770671316041201035539810636876174405220], [-23089205314468677868798025915339729769889860873225700348940194128, 11613162909585518808168590070732095297231561772822644520, -40513730542659540119375014666009448653141869524626740], [-8958072175223173264567981304381268512484259515969850967432224078, -1526203441327245156804409598865100818321643038695114049936, 28262912862638905746570534773947110703181225574780168], [-44695916447706575781356291059938283448063809764867057023011332040, 14053970613144121386998797766237402757995951259826804644, -37058358443521222754743154572944406823510106410128098], [-41420901968358385486334612584883120542190681013290723256919004548, 980475644585953345232058278581963156570937839746309319762, -79531997978616126995043150898994198247951817080773553], [-70449382874917515653792767264252923370018300912744112284055884350, -715189201243510503586436775515776108125446022664689128400, -104009264605765641254293623855503971221097530634435800], [60702224534651145731359259457806526235261897608306890917917277514, 6033282277736913862268770510314090157657835826084860811744, -246540909170785918616324038822766388815627077413269616], [-27431416869534833053369373824822077053256393910735588701606867058, -6168377360361004243662780810508259280196649140197382675160, 215118055266759761158136372148789968662938210684009420], [48124883529496591859816324549122605420528253677386752871526575312, 6768633924052816618287861105190345636875339079661924434968, 200821339742621781330447945877093978286192048199783060], [234722327695857707902429566589670784269835165892773696727217891604, 1917782916196573657450232560231767150596356694378733056550, -28523403278556912349790469732679404467467961584915563], [-32809428420500836276471956408340931969198833483632244442116226080, -7392867801298917787854693332755288845189574868738769748592, 33463055920498325926980828201044739074374827009673464], [169007938615161368904920632937565840377798452327182854269478964584, 16253390436106583516390069922763861920049136738499980507532, 606489111633282891953829280040124741196000702061571978], [665761879773528387618566709534209500868372271171492340532649143212, -4823752953729258504044846530859781673116289915598902339270, -819884196367946110871066485142456181407113051709106885], [-41613721790483174106643181694416208303091769130307619206360170700, -3483681639423242789971397651919264432806751107697546836010, 378991540559239701109086037924218936334075488562357245], [400488039605699033521444070343765996019953710823031083735502912632, 17630534561893948832066817107677696270591973334697088135940, -1524467431108918396415071006870408653099676915856226834], [1258081073311794622699679887077633583125134851147353551499158553790, -54505848295249701263434656710491165064990096947219645238584, 1383649600956701339915236947413632014906608626940578428], [-3020709275607466748200382126646488685529139361383489770250126988918, 96435966806086886300035745994278788064575760937306100452960, 539837590519403029941565298997059971374455307865158480], [-976942828143842687838659583651357715172037802118706869771014688308, -685580476677464307042577461794128426091685248799868193814, 2253486982301957701755700069228708772177927057371780899], [7154340980989025727186589214835120950630202282993239720528489546462, -367107404396400714196770522634121315610491755377838042825080, 5357532860630703040204170473633610073587174751357058460], [-4626555975038609717063733341538770439439042684688278211455720011676, -582885169638439368603555054832754987429414874534670429637442, -21939275686707002593083626828832250649567251885516270359], [4445091798463677051622222136810459499505771900439858104922369874414, 76828827986718734784351453571109368497981075967133942860104, -37920326384882757098451612715483998910215868973877578436], [3939760934007141532180220526397283493470467427722702002927865777012, 136120206817349028047084260839515706475386879418089559427318, 1429986230339255120901267535899280292931492854883138285], [1380591244784056595363271885038565432275857537767427944789554246330, 499296648845598023891679981304241161298758197334693931009632, 25665316065297238336221685243545640688346021920963090256], [-11898532244854451821224302691213965055372275304130467445815667064068, 63142961038168324734899116347051365068385325052802527341330, -6907971559660699746041906890719108054769358810296749585], [-23099469098969430109212278408436096470138368627326681535654524662206, 236797877397046704892195902290885115008215792326999484883136, -18547590231166086886384551483581823226568550347532897120], [-46483103021493709433502642393207329355508263889870610044744506147316, 2473983197888371725412469696705474533882245838380226798416202, -13346903380712716294123699274089282671254542705663879437], [-86583569847708097616483313502431689133723574438384608020991097665198, -575972398644519657305419823095329040199626767513546077624448, 102575647274136065074293254197216903136034452070703881792], [-26560945170491464949293179022272857091229518780603114260181785647400, 713521679275690074094206264029994291555690603322535642126420, 77106644565061175325471077750002203839548841087387771910], [15162829899844319912580157340763922350646864056715474946819360477402, 532538838539216453936168094545665158044264068377200171070000, 41910759722938198709116939834098051458169468748652841000], [172530606845768804481513942462282502389034884249463807767120156474464, 135428263436539347941328170945776324204999519181261411046864, 44526513356503230820475377955058700979756723412271657944], [20811323138302001444762814524299197783817126056030598227417972714662, -789026205725727449421297999527858954163082741699551173071992, 293533795602438864948349295321765026653891259352680362780], [-173191023602055801863004141674973706078236252821196591423589627546646, -4569553908905988986638476943418521379217929879151652742260240, -248287344730163482511821866618754736541132645492581057208], [71409239277979395706061097558514476963871769714831175045279683060780, 1196260926617064819714081920526528054179882042158616558117562, -503445533111927927683615522565757563651784104504904279429], [-3993119159827806913077785458154407478519776918473946867607213361928, 16172830707637224168554523904414001969020657945919307436857540, -81679247576570874788566737205187155934029200985643039730], [-319417381949871276824410646055993889781255234147624152424467872378238, 16051940260787396667005677911778005927566659237206587428369840, -593677811377038419310246635176860169030681273122690013080], [-249276242372733676331803799987825576693682456551427291106736395564348, -16578545947885000213485778574639089413141831978830217187085298, 361527801896802955259319338601075919733384656604546326017], [366441172885649542579944636904551696119547510380304914538944321238024, -31851987452955914755161018167770272578901853585332679662951492, 24914517154811469601533397240840842541463200219567954866], [153749208369588546058327850147055617032148979978154728887593442427982, 17580620021253703477624599254685059881317720758219183159818280, 957836951193122012147136517923177622522468379380616169036], [-719578395100447434368983706046780004826772502126268977329955613897260, 54971831560102238478576753119948267480567138422687888374158086, -323957289847450703426582404052967698965396221159185540187], [1068250345307191730164835444602151313849029898455102052486940686109142, -26604700143151549742880028110517524827856608768017825567446840, -282552388460937550879460514829841176186429648400865036420], [-765974441196604267493394508334241986031863010316850870897771391108958, 50519361447655183429404205985912834266186884780554960580188976, 2350681794234351545166719351712398712050429016585315192744], [-659059854964601824131681388928040836401402753761904329842948215719706, 111807475043900295504480385131710917493888416535765209822796776, -769506304152980788480996011441082238224879838185235313300], [-406490477846533801709081661498957693242202956116610338753019902734228, -105400906204320521188124200271391526777780141370628752385184806, -71203534077167568419740946780632389273889239617195258517], [-1133968394630771104300137306828936411337114247179464641676641055947788, -50770849692413740907227115024235696790488196415202016763283210, -2316643683514839832795357214472329246903455505435391278355], [-1490564808072502926720695733051366020022732642575286832811708667258498, -192986326614020663236054034322708083909418087930632557837384440, -7701946791365730935690549593803497026729448996387805581220], [5708917691323769464625618778046351495092451279708862938735533925385990, -104815653620973118024541466224865989986186550806859173239371544, 4737112528284429151331013536527348796135832580726611354348], [2872211696798780841659383807461607652920266653593166876892354378505680, -412082841341722753807446142085227986887356375100083316323565928, 9470914887721299797019583039424140432933381844135043816276], [-6121112980985457272343092434555284099593284717199356822047831888191656, 66838275370965173065405677539120202887317320228096205467721236, -4807623452527756986528602931378310028891451622891105668570], [-12113319004490859258951811925192628418113409235317792850752418918266978, 206369292448908849161289954452099537214097562438433321723722664, -10717430653801340715626050322935376060558202026167435254132], [10555900713325750520771841179344281622022578734520714032872049187745060, 330586402637968801484240618275509544357111237488600388956824094, 29882360351356352174420524699932258448680507014547089185977], [17815553637051346309921401175443643481751609676099430209156480483163752, -464804064517933055668837216521164756635834674571860882633859828, -19517231394579199929189070388131051614922691492789415174198], [-5007834169349416710274894820747885365895981748870767058619362296620048, 747816561191997607472630730762792193811829478254624603226317960, -52041298837851463960282155797584920993946070744236088434020], [-34617532290172595482099649220836071131927882612016387085704868979542986, -458912958961299155710991496060298452513366564595844232342825336, -13548988323575459415341665020205313423616470403851497197156], [90197801569084542045091769773650054730196314029342855533484444235642, -479779992678871019020752820702622251151673803246713156991481760, 32210194805955015855939903548828445598465743073095738519120], [30597355708447840466101945296655100729755795323235406544767344445123330, -400767262355504452732458796430775919674559054639612028628731088, -70696527195399717418958496980669839354444683115967056879704], [30786976618354937677500832632857618804039187565164273479477062433891142, 677486926668558756459175931226542393780510138532889720290721896, 20996935835524095120370772894340752927209217887536096713004], [-25657397446074231173894026716608146343107551596301485401044321018534316, 2360443948682638206779481800977463742579969450305293646923181382, 1144641007651404304225240469495264391769699683350544907653], [-5201947157946425311159170532076259401471310044765260301388279120981026, -196563977975074563462595340457133555753471222597174795841436472, 242630352854327273034644071214351433801008044488959446890876], [83809811484451133739606899897040394286232112605898026924430840409682090, -1779499852631590418693945719811078095478044731115898179794539424, 63965777833243164317864362160135351992948682666822689942608], [-137362518344156733540324864971051276610059965842242717083433338210105108, -1530428635923180778308406934921004122385581557403982478719644070, 28478063153049022602849062916444986654996478784251489116715], [287088807875645978375707654235661791793948602717405460662490103541899382, 3522579246568825102512862805814368624189889417181502277626275240, 240697881402051799774358329975144883531783416240123011508620], [128646802500038011136151886446250278026637090742153594911021667555019192, -4628123381612575588173883395046368896223248623332938706597238044, -375871582387542539654195657200559684927151810271463606088066], [165361718307558403729672149180791153859103049214929476919342611422082044, 11144557758114283638429758311540732877629467932746899140531021586, -317175281762447298756060101245977934638103799065765243952145], [23411042055296968485692577831571959120628616965417655114417650531267070, -5977904117556459092978396663637076665685494641834440606685695032, 469544572388101928937250417279961471461576833907709087016444], [-18190484456804074804695536513529621357985806030199252091470680941475640, -17349957183930155174594680515918331659267060145409338813991267876, 678766685248858798894584347109044366844132324059485212305442], [-324933637554011753108164303222086669062493258679160528028617353174471018, 211811618373495689141183840506222447112630079946477520914704360, -360845100828126043058954723554479441588135728109823716018324], [626576363799855776986933946256826962618728962256433500989638561206589914, -29923095587538766169957707661086237331717851504463958890372809376, -358660113554550222642142767337168113954542054314446345904176], [-461866935771108674648168759056315853810938971970771767829488377163212260, -21788291711656657473376981135553982657179174291738006084277878334, -703104405041064975511948917007182779564676620350829494483497], [-94419509129366915688811631213099943078512883972912863261435070324413088, 13221914206784377681110926084532370389631252376723601062377798608, -1124451775878014103252418914333937690697020820986410389722920], [570654823819552605379142241472198333995863715977777656780426519693358894, 25711208381876297527366892619271555434518888547280570799556394536, 1864846240835509722478098677483576393541773404302976059509580], [-867840115742889365482193558904906789883470015833733531903685113867067278, 5527688807190938501969091619058169385716586198924697706392487360, 2134187444205433409467946475039324849185381531022414003547680], [901811174661600359214336296103904029553780775514553530613127987003451572, 15544849919583256790759644580517213648016065622363817207436089814, -1346976876517747284047208603113495322749673398685794264911107], [-824527106842344383576750777873735757144763529668413109908723230965406216, -11003560984794817682875210845754079749478675059173495725861221948, -1729166843330385568352002916693258216295891952990109419419762], [1793838417862882854776092017397098390439814677418310894912464934567762764, 30775106837213262614463754167075022983363088597029544196065866474, -1090292756264608401552263915099430218480343091060235521041501], [-798142267267507096980627512223353879699391230545489942038898307637079408, -109346128168077159729341156390342504179534309930110234280031153480, 1703837480953149180639248684577218659707976736266021207768260], [-334609764877157584150940024424126276775845045393813272413476995433401320, -1854651802242686801398525245885778948865909510758767047671263948, -1599050503317838061758147000222430679732941251888234171065834], [1121263264408423351200533984010376951337229196689392355432379396675889570, -284502518348207485774882862234735942402688616644601799449112099792, 2475586991438268894688998438289475088516083872405949810964264], [-3374966096823797991408300054764061087345131530031159197095880163155594966, 339962051635799752019322451942490996133431216182288778975065540272, -1293445968075695454993351246531126172465935375257353129264152], [3411157428723200365884689726508271861668442320878958961505918830968542062, 137481373765976193828677016972751628209449526955087315733956735720, 10194248053825574066127830825965918551138741006935597485114860], [2434866173597623171166261794309300873776519785320709013951861656340321524, -374987340407243709983875813606166707539609527433168190904441912522, 4584874528524256791175897394188322768666123086014798863953101], [-1503810692340745709116928889174338270177074384913064984912792439850238918, 230058966148857208987659082395387938600831308475979080951808096480, 18104069177578506693186022845355371903135426116668618883179536], [-1344773512553370905744834405537964051526508092110296939287117070547943096, -713711112968259664642280932634470931415503381344289590691594754660, 4123552347146844403933756106090140833660741706135341252278082], [748675637349592586925805952937211055516516275195529742366567271146088332, 351494402434082103678769136550114093458229532667472817898457479370, -30104259082492715031181127383367222104127307969065834647247565], [-7987519539273499031227371982595619180460592542192319321582529458251183406, -308880874752845098430186184512630392141737133541651899677039618064, -11300698580709689707615713523806556259221529329918510122465720], [-23906463548020740531288026603783921870699886788888160496926584738429628328, 234135980841432737772029527689514371366795220869710417817967950484, 8178825795779277716137500421157764215873703095442591227298278], [-5847013933451864380136797339808221750241786485148945856120742235471469088, -732380636393391577898744625868144501014528654003094185211772901360, -34531376516987462440436887576425231093304827277932643517572680], [-7222035918244701439682014266784134648449554745904616279235522695820081626, 54273067502699077899535729152943402636317037660332371098835857128, -11853183531918387073710465407378361549062102416802325664098324]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_1_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_1_50_a_a();".
// 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_1_50_a_a(:prec:=3)
    chi := MakeCharacter_1_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 50));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(997) - 1;
    while true do
        trunc_vec := Vector(Kf, [0] cat [f_vec[i]: i in [1..prec]]);
        B := Basis(S, prec + 1);
        S_basismat := Matrix([AbsEltseq(g): g in B]);
        if Rank(S_basismat) eq Min(NumberOfRows(S_basismat), NumberOfColumns(S_basismat)) then
            S_basismat := ChangeRing(S_basismat,Kf);
            f_lincom := Solution(S_basismat,trunc_vec);
            f := &+[f_lincom[i]*Basis(S)[i] : i in [1..#Basis(S)]];
            return f;
        end if;
        error if prec eq maxprec, "Unable to distinguish newform within newspace";
        prec := Min(Ceiling(1.25 * prec), maxprec);
    end while;
end function;


// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_1_50_a_a();".
// 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_1_50_a_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_1_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,50,sign)));
    Vf := Kernel([],Snew);
    return Vf;
end function;