
// Make newform 16.32.a.b in Magma, downloaded from the LMFDB on 19 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_16_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_16_32_a_b();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose lines below.
// The precision argument determines an initial guess on how many Fourier coefficients to use.
// This guess is increased enough to uniquely determine the newform.
// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_16_32_a_b();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose line below.
// The default sign is -1.  You can change this with the optional parameter "sign".
function ConvertToHeckeField(input: pass_field := false, Kf := [])
    if not pass_field then
        poly := [-4573872, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0], [-192, 384]];
    Rf_basisdens := [1, 1];
    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_16_a();"
function MakeCharacter_16_a()
    N := 16;
    order := 1;
    char_gens := [15, 5];
    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_16_a_Hecke(Kf)
    return MakeCharacter_16_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 := 32;
    raw_aps := [[0, 0], [-8681580, -27], [-9695609010, -88660], [-15128763788600, 4495554], [3891176872559388, -1812556825], [37354476525130310, -291313526868], [8612303914493544690, 2817834255816], [6185281664011082020, 9862862047785], [-948672420994955609640, 1159851136203238], [64288072108608527903670, 14637022336528060], [-62866763758980919396832, -150788823188772600], [-416907603527008455512530, 2014015257098656956], [4362462167831462920335642, 11515965821552939600], [9198552646889719354186300, 21416940670024423503], [-47725481982428095396574160, -32105786139859115476], [97411254236860549491830430, -75254035496850878148], [99361631773882756995373260, 2754178952192610047155], [-6028109100556502180578828138, 705870251756388391500], [4844070401436128497016123860, 5560756550784097562709], [-27892288312517328756439143672, 59616878097141481919250], [31117047966043049375276477690, 9931258493259933601512], [59582095546649852482106355280, -291547170975916221114060], [132431686840784572812678798180, 391962266783399426147033], [-1077207307123335145801360947990, 1629255149489553536824680], [-4530383997437016307764978602590, -1035360974912594764483224], [-8791393879771179938036512865298, -4986191061008940352984100], [-12308620796461795648593023550680, -8294908790883110609140902], [-18422235677352642357910628276100, -15964951313008847440977921], [-43512657752217620754893648778010, 9022616008338155853949020], [36415351217255374548675172478610, -25766226046213075462005568], [98907056805331031759920767137920, 572487145951859049090471264], [312899292131453333878936733467668, -402968925615781147207322075], [-361697228694303195730989348911430, 253708536968057109768829456], [-1616779348284388381173808462428260, -320930441510182607850726105], [6036308068014339754011629014943550, 743649772055141485088245100], [4489507560592339327380664577948248, 2556313772920098535220473350], [-1923733500470541321719671991835850, 21863881942578195606585554796], [4251303103686457370816199498156340, 14730114796087857842875959693], [17355053993263333253288230557197160, -41597222606440602729525540566], [33626466647285596365590015300801190, -20521301248880899047978598388], [10175578138307984928138801611830980, -19304979518430914036535630735], [13415168840223021821403718095959582, 163385599650262894698697039500], [-91875140034966412817958740270428992, 165231176496549852190503311600], [42814502684358742316070579793712450, 268909824346530842656765231272], [-262875268504325896172184579762245490, -11938640472160326853628276724], [-384718072979787298802471253636961400, 81588802533831337685008734450], [1019232550488266823864073649428668388, 1317252045937846701099693879225], [1255434815347815229765111484054299360, 1667547590795535916174331583288], [-149182169543548930252784358141629580, 40297153429100678343858797789], [1710514187365924125449426819383714670, -378344427104326345409569354740], [3772075924838189545954134111583188570, 4114635073268062353363125725992], [5475237703867049486612952419587891440, -10278060490309670814363485111780], [-4384432781662453455004212471728536558, -3434938570599650279898886467000], [-8586556034248353533810317673018715252, -1085988286107865483888680148125], [36766447067591276747726831615462088450, -6351327317516098215547154811904], [-21800874652021320911198857104993147960, 41855851967512848366380838110018], [1363587301153268843713289856148194630, 39011665035909409204291748618940], [2315911964917059478596651510155219728, 2057059206491487158618365140900], [-60035188499087695242224043215159759170, -23676727374309607303818093431364], [-49090752809893317317919445625508648918, -146391673488839025945793864441400], [-56607018049179099946255659788128123220, -75650509154299457699204601830517], [43687490328410746653806357367261442350, 60312762204751538648805546032972], [390847731576564708910474052261716312900, -219202403563352370186131687633871], [-75882224890507201982155606482947125512, -424820950211477014346017912336850], [244336116672981045174210881951704192010, -672116911840260757537392862878768], [-320782728170113651523385035156286792810, -798468410359902166338456859506884], [-21703993391307585489337661058624932, -1011334330333199588647294377484425], [1493214789785427400162886897882979957170, 428298639205615337993122459681056], [3673991622256517672325194940435052616940, -91898977930844076311164170362501], [588650721339814912624825319623987397750, -218358583659471414071573797140900], [-3903941371320995887992713874376678635870, -1730495754368748038704046242142048], [1020427484587799575192174355970586680360, -6244982282844966304897518244992870], [-7584461423580261353029869758289413060240, -2334174211316562478267418103178116], [-1373939844335637939378475696188194741410, 8140063478126127072178644818984412], [1339034517967455785166052019888690618380, -9623627770083035498308126852385085], [-7027573975677510686359448374961413269120, 2583097122717518480149724571949408], [-3564450981669621416338551725124571517490, 22335628460249997805123866289913980], [15289004572695379967258144600956631539910, -6686997556812406590597277753605924], [-7335736029905081906228053601187821766798, 22567059067604139761298972437784200], [8574778412271028949693834441923593688490, -39045801379040550388813360703197680], [11763978280045728402165665076416288557620, -68215614492048408765099518599501715], [-3823346672220559235307533805563075402578, -51170222113724383322136914996010900], [-52626466125885634116290549680121571031632, 84038005879791086273380473502932300], [5203582992929115458902238583580930540370, 2453371487553632338631358186592392], [-45564112048424445576596712519240893108360, 34532996251051484729443132737941070], [-6790603861598141599948240217277219314100, 19502409781772927179080946644014003], [121445887075069445312091830066733699830850, 71477756832558290979689241354882600], [33988398603654421546729649973589995856250, 44279494965120017174272791640244496], [-44708932272502516678865491309574607222138, 28258992312165705303277653025147900], [-114233941148683324367285537226416549414960, -309973221090647284179293730833773932], [315380230516930898437483250820944958738660, 24164382317094861741139801176690009], [-90811468215578308157470085505505735871520, 327633078055797228450687076085918840], [-284259137854526847796203310129577374450520, 706699391865198469124256811895510394], [268919044907512857024071171655933368346108, -677130478822878430991875413551223425], [831077814024120800285290405402673145924100, 438997836265594283066298071554001025], [-147544806015601651597219162202500712644680, -54568227087019246257940246492568802], [-543843724185354752742324407848340625101610, 165145099363548449159260588832319020], [673359581897480944653298029873334767582522, 246784422462278819763729480581499600], [1504923998436299913869373160321733509784860, 18976942022207485937389995938653863], [2275590115764803489200039208266872514479542, -120257163122884185544206425720421300], [-3162985139756478410499990474576034450403660, 721980042557243723220554009431339149], [-4137991222087245651221954742632854909061850, 1519948586697775476320944684882817196], [1320031668231021439372150349675529013046340, 5182967278366828561448276941810407793], [-889105501830989827546967705166240042753270, -2574017199457585523010370253238413360], [-1037496300345925790405764140244985844440372, -11012223710727359174433030541007978925], [-6349116293470666090181058130643362616734270, -817824185455005801978793336124698464], [-8010439380638820001416362281451501500589220, -9317823684855941971041540581395055881], [8481010286443387293081131215187129189814450, -12173526404139739645274017306571771328], [5828006953226995227325435033724269514751000, 3338309812920739447056989950152868150], [8901581807280196418699193717404407315194602, -14146685191881980556641830577678031000], [7658835359016092846244775289914837063036000, -15898127746928827258800779898846217896], [212287640200782366625522338674449665187310, 7990939112036542113252756799537962732], [9214230944099493145050053482303076243203290, -12241627182036869459129129240252136184], [-10453389758897293542865248411971749585442180, -3694599394739460997454860899637148865], [10574663667513656593266273427120324561805368, -7211034464933602976834131396474579650], [26371713216347462760827176811923515262061442, 19635352773753265393576496316998487400], [20028983393403711743938189572685910471943700, 40535497842182974672831498145279921253], [-17906267988481959122100854398332052493912760, 34040349123087293377227574256840090274], [-49742340302266926382801525648957980228902970, -36632101954087951149002514794318166148], [-60731424479942747670795083268866841916008540, -17863454935781151425888113995037311895], [-31677781254911668006959783135442851148051138, 34914863879987455296387146380605353100], [-18223896499718217336099760062530711692516510, 47241546871863410672338033425686118312], [-59864187700452775164732480194504276705957970, -53367301627424578256383780055637852164], [-20479225441570086753289972425443877474449220, -99043651660440039935594270231626686417], [-127819977863151162916874347600028045644658492, 18501672663359289662050225710924426225], [-10710508379718413689238509937155803429137898, 50327863284444764921670449755088297100], [66292435694342326965507722039486238503285390, -193286461198903352354826262711525899780], [157698898663285026939225082814595899906803920, -78821581625467669254057973397461280940], [145939973181348471850403726388713344483540120, -341792230972080350569813497284722287786], [-20862921390337892816872598063427205319051530, 265003673386349122639183795272919972092], [-4848420871648597591484350079038059403461260, 421204155724945686389737640887085886045], [170103844394784948470203148958510226319154600, 115332526270767955946593821833130280378], [-506958734959465339704520568286868227143163152, 144620775551651798981925810265096719900], [94957520256825095000056063739087444031005150, 141186996394047771495404481462387348396], [-1056924579470406917115899189812087694438838, 40757637874254150890979457504651336400], [31183303263816446189591310682743199668112130, -815734955728703093160870388630286665560], [-541203298193603433889379449371258146299711410, -350006850785204458763239114730601781188], [145224629229731392065235518602556227672710180, 806259000132164176366699633668459485769], [297730070777660637781951885854296589559395510, 636404385093372515188768117334719976876], [-660117930665393273935209997365565126722331110, 528764283509408838536279745739642618320], [795472324274305621267400288629961564508368188, 767114280128541409906893870110884894575], [533481608397980504406306379505258299813637022, -935581302574314490437997525282809208100], [-1089809433398681062494085140222887308493221640, -1429421576694805642956473212951502228562], [-1630006561927694163900099703735767908240380980, 622769703952561479657924916768785600339], [-1536081708819806968429585237779419275102708330, -804411969668267321610058908523106317140], [-2307862670155502702446296239203639864575738360, -1718019761884114465911622352689853102830], [-494840454972427891326246332761767283966659970, 3633767396244084007122737631298136453052], [-71081400651460206020758456217136891112828950, -970539467988846919575945256017263977904], [-1506195316538121374419402377889061003443441940, 3582444371704657412180517930246541554555], [613052513796995876507008189759776960697945440, 4024013788132356152446536201965586951768], [-1593095394549728882198721823036448439979410970, -1224972840155312547165539798441838440964], [-2288904622750851138456436623452526418528734318, 4055120454061291650829195881893090157600], [-1108711800214217209352298635135265851086545020, 2484875490419244077722248037087806962433], [-2497287027573362107732380549019000319944568520, 678636917548399968823863409430262434494], [3966192088710095017427940295596427338750943900, 5036284625546274618010084688160959994279], [-557456126387704583784213475403694586772902512, 14490066395430739503733742775056614415300], [-1571990947833189056579360627165432097808589480, -15088156494479425422393225702796617314490], [-6508164894596850065487917877002394126994185630, 4006785896148331011416975018092899966760], [12272781981422815555215781559360874495517878170, 2590300574434225341251432250468616639656], [-14373062137797821822756255172621505795634900058, 602683130360313692802821961873336220700], [-9569832952441272107133626267313006931128153660, 16020408991132864270652342796543467015249], [524388954470152173251888688692056387626101130, 9876454782601871902459143839445691857552], [22129432003852015935438053575385956943063821960, -13888118811585918839143063756742544137166], [2265059921150446572168921955586263844234897628, -23360546435269772475526492593427772586825], [1732363599903236438731844627844642225085646130, -22058454762183624214066908842533913969464], [1336598308870092292251598260048723846465641880, -17061368821077030406259743995900308574442], [21390089568564588696624497257697283972923082208, 15590685465846466080433805046979911180600], [33111091040065178952689699987845590298220313710, -1765955088525967885644313925729068949124], [-21000769319032735480988507751527754306922716910, -33253346015327285969732087024048652922680], [-10739732491733095930588182452012317617220288290, 21436132727564571097192895109333644030732], [-70103567717471919779899353959588539373883844980, -12473468161596506111890217191472852459965], [-33113667757097470280614584705909723037648097578, 35889372019937816906058173617241278412700], [-21574157840072699285190116454038840136018155832, 30903556287100240215961886967221335211650], [23656766581904615469058959523748043662898963770, 17408434704323354732621929601675087003592], [10427199445556017823746955030211237649198401040, -74440459342862036054142181398684219249180], [-7833926945468123437625299146784408852103400150, -117956503931903887488412029013597701551800], [-46487718942415154057124701056767733801456506452, 2434094731344047597539851677629896823275], [-69218731364480055550476871088367739822029213138, 79200549051691594830939992029209340057500], [-50706993637665133950157071837677806958255687960, 43504300355523165940899344728815310606218], [64238103470640601105327481463762516510941928230, 4661804342273579620607031060388713448140], [114055540375737478941998504496010660261227042880, 59865510470170737495199934649899057184144], [129765242320882026461289578211051922283233521108, 71788525720895867646685275325853687076725], [62131239868962503821991503855357143507060193550, -91664317716483993726082698804385548625428], [-59803440523233100948091602099144302752788541190, -8699063997677278306666181166840725325624], [-96098175470970078542766749520473942526707432880, 41974524149433002047762992217689029762548], [-100325795640614801247423812472492830595510817410, -209995702115805075483433609990771053970580], [64882698811811896923170382525030136760886076790, -116298311023870573659954560091791023041684], [166308254066470495014793083331511380026725423860, -161575976654934034752714787553889324057987], [71720871080696516255674733448643708817767422170, 222368366779013149194763185867257824982160], [-123209353136916872754813613824247697384633185152, -210322372537561693170207653912774269068000], [43004174637732338277191010781557565123018105730, -191936353857236183803290350280468605242848], [432213050987166483058608550352770980518575958940, 16877802426824803055762673019566988834343], [37859783818514036466257394544639378508510200228, 514072088758543870263703150210214002415625], [175322861041169653801190670499612440861439888182, -711448168652756267302743632730921375268100], [-242986261596552934467740174686693059918274147020, -466010678047128661197155919761240943794931], [-453167596205423481728963113555973469848016085350, -522772590106709712671047152857979684615928], [163988862444929310239306957449169169499147410002, 438099248824600072550923310664102264187200], [-194822593232311900148756323871576656822665869290, 152240758431978575210368223866859150413932], [-185599176378837257054804457040828613144969477310, 54406836836610947663573365190092634982016], [89139872623165270573131840530093367735086407560, -823303953491846773234121487029151927475662], [430894467024247318844845801036706998864548180870, -596345916546749610245567181558320216049940], [712371874240976010991932441064036553981407849168, 196501270112539691395944433783479036671700], [-415534245518808960565968533880088691997075292930, 48351896308049972023921135260757680038556], [1384917160916571720473109753324536548358919068450, -172727654638004401465701522888245275507200], [-1219071817047912222352003446143861269638839764740, 1191327648371255349060701365342682144503455], [1070334093445229907290150181698963416100267177430, -662510748334310199677781002302218079124964], [1898392419808230627893956919341992930403256423680, 577659079589705807497049273856617799915840], [354769679730804485707049693489593981386148447380, 360591528668701545105022210764741950556133], [-604778052202945931399658414853787131092113486790, 2171046112675938271966271160864218143352680], [-2181213195749765422491501485907035141374999019492, 273666844513047336893131681381301064462375], [47099469940009843665559466051048465544150836210, 168863062229402847097534849380170315983176], [805106933265239282782297065218838019235001677502, -1226127231267291536388628731016158628059700], [1448704165753058069895923021763050528708852821720, -2228861012847478918120176603723689072911002], [134644019425202349859105080667995204165399485100, 617985156051117674831093774965075513983179], [855495590700849415332312945475395784703099295720, 106739865902464930815562770462344997566410], [-867271313027088500410892657197273603521860527078, 3558509673599177772141340927271499310674000], [-2047769810037751468999607666718576706237267881680, 1356093465114863567486526607660004103877164], [2961425414333988320513877408680251906172874224562, -1966892317489972531345542253142606050273400], [4294664032507108902258815627582231606962268372760, 173319034831884398416688375601265764934134], [-4625885943618244015782273021013925912861567715210, -3408960198701043932345111539997435707046788], [-6872491238714592931770910976544606029122006201618, -2020913876860907400491738805056695717682100], [-4982801205310210250549290093708274193462694886600, -1027117777529929016183887379815897142002050], [1638282869523279019522423356598849698138470697090, 3408294086704934931745612873732796539199720], [-3858895557841285531699697950161664740454817456240, -9876066535926626337543062944189852863298812], [-433152273512141886840584257096853516314010821980, -6394229035983729260998524579055621609339511], [4241801404128777850724194102808897627543670763070, 3951509318704927911262510291355443787556060], [-347900846184222136760862141114993070057844767830, -17491049560494733611212353959792652464752408], [-5703462664167508672951750424147107091083461540960, 2647072146915564611181949591498804554778920], [-960222521032935796044298757092540559254061246360, -2614730047334182191884418043223718159955926], [4953635503288263356494443706207612011355442594748, -7352060196962602116308351099217639180847825], [-8220728203765224585357084162270528177121910126170, -4222436256919381285502009364206555006918148], [3459809653941287501350772501105718538104216325060, 13053074628435831907621982871685843023186705], [-3819681226795828164977515777216724161236493700672, -11673503042610906506671491272753199329168400], [16269522572594442729261781972416665185684565129082, 13335992949894368827845309107633934735417800], [-18300619866352919927285242490938344382848283338020, 3224354418397866580596494460056636984342583], [-13540053057108909764061118060482828264459945526320, 1941805735328479786743281850263832731255444], [-17100353103344387045219137334453086109367969066190, 12710145051689748755626821343471575097670280], [-9500368448730277383484719794463436559169433090050, 6547553311601709262405237570815540928930572], [13872963167457211996463369805023998021879819867500, 154585373964367721462949377284332762002875], [5910996511079013805626115269543752238840878162088, 31232612340283836654156931611975959050265850], [19832685762720816441201793769259865658219158048260, -2683257762193307943584300729805000344876287], [18314330247459245127079839097271426104020614371468, -29219550102551607623360418408265422863430525], [-14898149328108923338694725730188948035101273036600, 18679628112408148492547019217106676016043778], [9337325269223405594840139482920314448405882823750, -39945109266854227727769951065217024977987700], [45720619312703048130667551952768608916922977727730, 12503366066427463237976632962430605959579552], [5167667862355731674261279727122008214804691865560, -27410596252601264784656724499274315376599770], [-1934890568035750759051224280714763989487236867040, -49196894123725204063167085132987010965649016], [52540826804682082866867094662866549072535618228, 14438491828576994896717098152708319668027725], [-22950757831496608432537311814411107970891335802820, 5789979945779936725612272141809382199814415], [32712101772825663461427216044928881828839083704880, 31176235530527653202829820451617914728889708], [17502474770345210132984005572602247019960372713110, 48733196748227282204348750167283656320794076], [-23632755792591251730576720242361741486405166798398, -52606503212123123754244208472592356919692000], [21729165807951507540741492169693136661760225038600, -2227811477671231794469898088724270155563246], [-28836508794341155964635501745042828927018203035910, 28297927438369284142637289850130028778930920], [-30050665146007389428760942391430140122529573572090, 34474172982977003023370619522857217557335132], [-24982931491889382642593858378074644611734920052380, 15780221513786676301762340926736460353106585], [-53382718630992292228689564927248005121641270760578, -3873371489692711295273189152218603569855700], [3860260857557173130516351006723960302346711370220, 20163324819366084522409283264794295851785339], [-28566259261311320366780011545036490997851218381330, -56810743572686658736745084614771661509624644], [-27402785700343862229245585341153361990153175076150, 24753591871775582847978718391269533166398096], [18295565447935730135374201121723722726770908851840, 115602498413612699768375289756223024580849568], [-75499894523982794231086777063213961035469540072940, -9583650027887941733523157882109144391732091], [18183595094118498120707342184544314466482463770830, -6037005658129113657262371740730507976429860], [-10862993653559723893833363036225002196791225077450, -59274098585248503109679275075146540630297828], [110407692102105746016369996839918894665481661575010, -669632357871757265477273963122736842403224], [1451715107182992545164061596403116055467027093300, -232574785329832182183742593270996154146289875], [186906799518665660086128741395257403614686304999590, -15726370701088433305383554265728163317602980], [37612814213037710233429029434549427786382248720522, -212428292338815779334527059840103665656186200], [49358942004342817192535810316727716093867982474060, 119489951761153143660801337306981310472762963], [-163113580737152216018490023527689851984530332047730, 140437433243263667895047594825089530611755292], [178149230531549903575518280592108679309829665124742, -6937493361719981320009676654641088186649300], [-67269091611585231883219456497651540359037860127260, -67644120894258362401147165091570264369070951], [-112824844651291966388761418877675136224796865778070, -265806963442235657075660459490222024216923448], [120211591363796471174676204013344544038010018420960, -214567318398870463016290558573737750361002120], [12440920589688995335533237205705155415099315392530, -197935168362381205224677932123700135221940064], [-68590258046535454045454273750807358320516927560520, 146532959873652610041767485920934910781736158], [-246252706792205936007784712640828629263192841711220, 220682838317592181205000877199296775816244419], [137655942672821290325590018036503708181597075607510, -128656996250219005949182779607342813908673620], [44189013825028081957785572970796832860424525638202, -20325716328500352284156429102366636056757400], [-368733695104866709692487217843571761236054972827612, -257198750503313074173439828297048046704804375], [-295342879206911486972706439584894453891981633942240, 33591190014939494630708411191572924159145288], [164266759765922309500342142562847145085845978900968, 236590084005335816935737774902544810565015050], [-147325000540541996243685895862116441885147312913160, -546232675197828514691601190096127762761259026], [-674359358662889362411914023312776397755138780426738, 136429902350814357022788259511147815501305900], [447068019345136600696327772418727492139287097274460, -553689635093926188331351907981380184388918441], [-390838212073741758269736725427940809577147731421872, -254761159296567003784367231841259157989697100], [559099440132406930983039438467801981357028591354290, -2087645285247207622685705514054765953583288], [-583591828880428356893163140696875935419184422109570, 510425424200898641841595715340870125607536636], [-240292757773115980014975933918870375652819866930920, 846582352914802449767126871846204591714769590], [346505146898005441555049633697015105889899066728610, 613068962324336886050736767064666558907886880], [33762014531621126321460332933530131679622246409702, -706116154989935678921932069909227102070463300], [325711190813984196347560317924019933843761848832900, 488654662538071544406755620386034871650670529], [76259602388418621264933136682835882593860171121610, 298699622919852365690093699977001030128456232], [482680060593369744888059142153772760075412642995868, -404366157857289367722227841162790261196864825], [602968130205998385791309707062283019853264732611270, 541877129954609068226229881647860866906058492], [66065407401629403702108171950212194574775871568950, 1180443536207864002386495244643756654685783500], [-240462999994774673465216303857749544668472630585952, -1375158108945219007738016883764352901007007000], [-1169829600523033369983363997660118576855976929091810, -751669970523671865500139546867461027847725588], [-806557353478294030117232742154002447443774280119220, -1303343665933957854786103291291527039924803085], [82857654234997452281940280388246088025139517220180, 590742430041203053091878857704529150304974069], [-183780712738320859945581084236223045259101299618950, -1701938096806853192125817131227694171504020528], [341859553626393839156010910931941793270538018789510, 2921661070600131579944569876750090430271932076], [93298658562844619098875032942225618081727158414800, -286813625716232325093689842799233931417664300], [-2192503620732686690194465855182026185653935070417180, 307089455588783508686971858119523785895974073], [-2065447425986027135239855985573105562605132006693012, 710706118706189089433725910468230322992806075], [997092681807065007634721653052527844044432507373090, -2041456248845262561305641116191982000234202584], [677229392947251445924713029749343765636186476647420, -1510383856675968751176180792231717399475841761], [491938172438933774274122316094933410665926254196070, -1096164781923814370054169534989205378902732340], [1052490379604953451212042482496429313556776605619640, 750223124612832951909861984732492145923557470], [287229317942781613532890191026294517505150657962830, -942609061517031149419259339669605965669940548], [-1375504099196959363179765810773428540971328416011760, -134497312129364583639685634430615394163320732], [1327698013076067853099695299106913269047162926980030, 4153803020033576316217536459195649456587467340], [1774610967410405248372523368748173912082662953242082, 366987648238328459896723259616221337118383400], [112590507386396978462185573795410041192514216064180, 804886374051236964886666338227493818458771533], [2774482890034149577830178727767581158660291748674280, 3093340172519872501855498689285774768973625994], [952998563327800585486703760543968253328500487306010, -582815786887765700731225912505343350410687320], [995447913659328358786621051747879655152908560415300, 181703036535630948663973573261844796666974225], [3881340937590295412739243303752901481052988173057088, 1058198587168442621341052824305519337786666000], [-918352866416063328409544053280128594278268030742590, 1074655648545842353737444987841513622648773632], [767330660764986879430004685289144815240835812526770, 3474230442099389965489282564027074185453898560], [3223585706657723947302198697599861986247127988429668, -1387833536889930841102285339553402983781473575], [-80063409953176149972262445701972147351143625598230, 1817028542632424883830838530084426425202642256], [515521392753069277420953406403078029221489927943542, -4192296776782771739776565766792433653411665700], [-4533561942254792861274312556791439385191062194679200, 2404514530906302835175592595779360516274221528], [-2865819487353087451350477866729297165232965141592870, -6961049186032741020009441499089699170578995248], [3821293123435189280148190752906157770124244201327762, -1172953066796560071795477533297487732255511800], [-4543761498764890729377009902857258170322866680458220, -7300484901274124971894177657121162733721351035], [9964791230857922201563562746163326679150431401714220, 1854509542763601800058218557140241548134439723], [-7961234773593559321642094534371006525551669353167200, 1183830413637952434290921242590932126610945704], [1279067795581345006252328730169058535273713030344110, 11672524848225272247475589490509157843281219532], [1816058348737662341812369934628389733568560683885222, -143843979245674480661420635789381690517202900], [6407222184238469791642856534851544252037621615669270, 1321790504868993013427014561453001185010511356], [-1875657284172431214829527647480404715535365859556160, -14240867212088972779887876461902600174619593680], [-365412884001690460148021082052250066364488378909100, 10527839950162092179231147038745532779343710453], [-2676831331823793061664477793341102848950060819708452, -2063550759454768811795628500334396816706444425], [13309535562996800747340834948976080490531102596298860, -4205822366670651128617966837672244911101408741], [-3714452237433298573940839125752699555186229804936970, -5959145022179930869669028269876847007609227460], [3941467953324842559444943584248615913174279357222690, 13926683153857835229732766373132323221309655712], [6955741023119432497666285212811252761823124522849882, 5967417913544253707559106638080969447225281800], [2320418118268567627023255418070759203436199297341680, 24909913349248290655046792550410203940364439644], [447587026842028594899242211497331220881139335926750, -15779588729928912702862736386090456531548301428], [10013046989332200485591174823390047331355959028443210, 6665028511338644779077177773562206722560692176], [412224086342622898506787332129171188183736342170190, -3654699442302556746122990532603859606085918980], [4637701351123341867796367373508821087434098569759688, 13050779114904845830166791437467820187159008450], [3631869588437239737079446675299633542678101916108470, -20424865910705104384845678681153417956218920308], [-11147526730861068428258199909349191423501430170397260, -20580515506207132421960738175199047499215753555], [15327416839224967250233765290030575490675268434186542, 4618929110508360182248311848716400423443987500], [334950189303711663135426603585443663932816258958140, -32773462646255141920632952274336347229457309201], [-15960183146273431842066606102685479977367100360108752, 5329644540699042738986543529811178830372985900], [7679244323409805789484551371035576930780781789045150, -19960569376985207023900400460981014411468906004], [-16356210392045417670555442597090293919392848049616172, 8425382618672510227020872382115177775987822325], [21728723475995261147023308059171523574267032873652730, 15959332532237816804015091578311117863508128336], [-14694560922198530847658804429711013886280364647021818, -3039620129539812817513984548335875244967730900], [25604182560551653889182152426924624247814523594540880, 18893308129318175081331976225919186021890129908], [-15841323183964395413566397247277361523906328690671490, 9641630302652749594876071230392013764387999980], [12683579785154268416723039514584418359942151614927850, -23515888646244345215777371567041423428245871928], [-21222632025332028345760473949797277521693743594839200, -28652971935889112728734932680772949434891124200], [-899082956483712541216390998344573448812094136020612, 24890206904243796016561247314220465600752463775], [-2507626718330888157191013198192259772744936953676910, -1853912205369211819714641322261105322205696184], [9342284205970897142010981677270886697243162944296760, 12588494963838852273756086199159882733692773438], [20613324330123370117721000704920928081878384320888270, -40967069765253927762767596636081675524087129444], [-8312887030666571043991229325722619718713379535372358, 23744123091064030072251634553645302611278257000], [3687628470815949954653586194800225230954230861181840, -293489990086220704050838342410744701153634876], [-13928702217874683389794333060174154069285011379350740, -41128180313214642157988716794319884929560832245], [-6308714827580127910403921655342639280074044834452940, -22560560721637540573495428400230068643697419891], [14625439789411136290308147450915207333376404315924890, 37150733470401333441363407384178997765772984712], [474805171807400807127048240944850380483860491409830, 14399939220985069718812461520696004360323529836], [-9913361651167405239517193712855491392404705714133880, 51537974820762843441077330558500313569607846898], [20332260296633980398866694557922739281768047827292522, -32972401012117594685949655149483878772929828400], [-10558591030322220900345726454069369099514829055105932, 88618001815879666577732946525715591774924752125], [-4513902248762000542949540354586863736700769525971460, -33420365151042983538948880535666777263903966305], [-17798328521963242685810425926058774685774146210256400, 109606088181573562466915511782101221854589292828], [-6775452734139340185144053335788747936486051015362850, -1789406517530101712962132346406150232196560100], [-19127100310190286408900731639631790251505560674785352, -92541700461496814256308417573396002500897252450], [-59172403198342633808568959975741805685329045598244650, -2775534496790047860052134142613517648638984004], [-115067532730431853791914434701905549550818865805952220, 33421766137496964769889935445479711356887789065], [-72646118739251051181282754063754325626463753598951392, -84656725053339418549447788296770045362572705400], [216988689370373112034427278447695142176001601953250, -39156591221354355325433893265329575377433952128], [-174370031717559871768604624377717487089792908516779310, -2578401321225448670444098789061874481475314680], [-13621458317491863063121517950677274595766243497841910, -9677285843023694524214835652977734071339887984], [-171880440434449698480091037796244943362001466582378, 27552233806992828452403332289667219783487367100], [-80099417677107399916211806441245596590377822202285830, -48710565495564680197237558755591368255050116208], [-8336504059295978757580187142236628734212480884214760, 48957686805174607151489337703804130811468102774], [-32357203296491163997248771865656366959418802503481950, -118304329208525424233663314928683847295022431104], [48684514832567148312225425504588844403193312943907060, 216213298550276785151995121578486460871977443005], [-157981418323124364823584902664985752731171575650015960, -94335226218515725224750406289802352993079753382], [121030048971072913030495116662329786457662147829039728, 46309631243928111931210800509590136243502061500], [131587075515798035085332944756679172032270769261492830, -96365514690295562229632299453834595145480704964], [-40600925039730425645695708153967136180897890614284020, 9113098647541032621216004328213404248413522883], [-91216657018719869548586306529224286071271573358734720, -10959233896093524390173675091112377086030725856], [-182008426933752800454397625234930095527857278177329790, -79565912257873619937096873116633759147990701920], [148807114999266385738239823423777406211754664377683150, -85884164534140518201808406207827822534600815428], [15137520331837085244895299823233452633188707997350300, -257940654885300225894215241820186701361355261625], [180686527402677994294448440017451634368954527066120100, -47929203229900016009239167931535429593344600471], [-95513802915894764274857085491578428964969225767807912, 146651237589224943167314298041495688668097486150], [66655443015830590816432770488148026536429901340196010, -199419855721472519018953027483040418161475136368], [71878923332036623394536415043810212174902720251893920, 94911411045226866850350619273914494389291699560], [-94817765946511452735433098746501622138193276573110630, 262377282276050721724579646590751665198890380560], [-16868279939659125727138624819060750248068270337617732, -87586677874826864888400130132627051252096451025], [-80488031666889193566793321490010856155374245421119458, -47132449946190106137816704507864103815062464100], [107463021212694673393186573054791928514450287961302550, 218735222157238781124029509882746627350483732700], [-62259573845014669034530728905517074444324463080699070, 160274548710631474520106643529594290328341968552], [247053328881325542639783236649388452197561408593662160, -123118288612091120390378507634213191680311935916], [191182612786555334885025657227656746291910294598733930, -204339879499634303398716923633901652798106132464], [94015252646998528895636400519430903727397528043168110, -282265193538713166942130683793624216063264043220], [-390288418864113681795383725436011486429963790153787992, -11603132132630111629658781021172360296685023750], [42176712348710470640219556959646067506926712883716710, -171152570446792642907331717302989448597698338324], [60311947432922619967593417864614149053285095617104402, 111624368249755642591869873313873440905831067400], [45502290704619679433269670444755851964921198287772420, 93755821946498841392085798749189875892472452673], [-252272183932190639116740171218435052771723727446588780, 63466543840274711399871014305999351300730681285], [-239072078755676940485326152828782868029682210212335630, -291703233983284292135412294256567949189453690208], [331028246748287317492210753488034800654883228461870270, 237475050244072866237415541534589570913914644956], [225644130831049485430839381336534730388419846600521900, -163045011176219542630869116866214436333539693397], [-464627521403326433831956455858098298310169717120075852, -8505386252870133836668090564814281653443641875], [292234835739033446041482120595737782944047640046874650, -158017754044197482906210538807751177721441232504], [219382884524272429465360957675337323783798346151629862, -58365404234245706879144458684473906693675359700], [-242846600682750953092928670677156734087661146365309120, -304301149852720525823005297232106065422599126960], [567099691811555314285752281192072712653890793957545480, 151605027326561951899733553203748408452778710994], [442762236867056602505319878535968940738898769425509810, -227470216261962152883835894924517470924457512824], [290159300835546708002790097276545628603447462012912920, 105414865651701187304579937654616436715571534198], [-236678635317628205678643212755529351909787597435785610, 84241767817453730210870329461517818705476401420], [265901213916228146726326445980397807729796401303191790, 459245516295786141385596996769323252547930177116], [365553034489507732418592975045783870359293151510590320, -656365295292569769964787394613018955702041170436], [454569980962415215649711157724359917381297713509308940, 519139165440290728920809940162392315965377539395], [-769977008389183651470125255625494666219946370258560070, -374387317976633737144203046111858387386998323248], [769295004999681026775928301623361153652349624572529350, -239198102540053744070089670746827024887751231604], [132670862331975696391332816050306530098107916991307940, 381292292389780620613433154301787616195554926793], [-611721076536369269554237726799504213366811753021366870, 143666137177826838555479858631761416003018673640], [-307255872218950827488514412603497158311012160118121172, -919582109964784736989140537489863689848692637525], [-1127500386371682076886211182077150671870282670564427400, 400175897649269249573759067209958761852149043150]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_16_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_16_32_a_b();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose lines below.
// The precision argument determines an initial guess on how many Fourier coefficients to use.
// This guess is increased enough to uniquely determine the newform.
function MakeNewformModFrm_16_32_a_b(:prec:=2)
    chi := MakeCharacter_16_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 32));
    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_16_32_a_b();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose line below.
// The default sign is -1.  You can change this with the optional parameter "sign".
function MakeNewformModSym_16_32_a_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_16_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,32,sign)));
    Vf := Kernel([<3,R![-416300505539184, 17363160, 1]>],Snew);
    return Vf;
end function;