
// Make newform 966.2.q.d in Magma, downloaded from the LMFDB on 19 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_966_q();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_966_q_Hecke();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_966_2_q_d();".
// 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_966_2_q_d();".
// 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 := [1849, -172, 2895, 12217, 25949, 33023, 45709, 41912, 36461, 24365, 13883, 6105, 690, -793, -226, 12, 77, -14, 10, -6, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [416070814939449151466948354550664142735487913266, 377789921268131390848667084273767026720038132736, 26247202763313339003899850609289639026787492446, 84861507270611906980441385618255521705218089037, -1084025652617994019912825629635526814855943980454, -758757924678608950486573772821723392932741850530, -944746437483006567136087813532671606985652969047, -713887981491874201426243034637360084165848761710, -475903234347916723384213635364324151749206136001, -279908919854145844437500414270374355553367288921, -37384403518785358888172499196054662306160470234, 45831889522981015175875523498165236358113627894, 10505886441381003636364783759240888029562541615, 1049894126085431149638464017173885964191321877, -5647347838283392620844683920068100035041524821, 1918215033479910400833616596938028094571447482, -1030132377480296264273027275822563582104695618, 509722253643469831073831115647239261697194032, -107103016120047993127382221315998813962800782, 6866959546628666536249773363755896506003147], [113883926618349974920243114344435758924213943387, 997100679183996220151428347258948959079699341855, 389811457555516190064096609216735351076607740356, 228295720260906878652720870647046970314972004804, -216270101228002592179001942147053476146509052041, -843118540792227453173018547689887892920537850612, -1087114928051337981476481727707899381153378042174, -1116327790224551195159326300228236361273607827864, -771784582671714336972278490102342631897521458031, -395402742199494114838718867489889631066946777890, -152231060866985286607705362686061486336807172385, -970298680511700342134512094930852476918281340, 18381141932634622316314243404831446258994148471, 6623446821701555324896926004987601887019659447, -1893424537035459386416596102129544315840403594, -1409127197158200870430180889259857678620092514, 163359216837207285010001111361846994387785068, -156592077328031530513699345244397432962709601, 127681305185456081366223231523064535523674411, -23270010688329368232638981992965018601854905], [-5075061521964656068703742305949521884368123727, 5065003060511005786271051804735332145439733775, 339058615181163029501498336034933883269727600, 17762542725729162796077257590011017691624767386, 20415669311887395003252536489971363580500152238, 33329698336029845960827220399017883666393044473, 27838850979526406900015551365869598701235780639, 20701188469749713573438341723305958459084733717, 16923191914162779764660132385156405559456791208, 10472688288045617388995225864317035805761123698, 3920705157266026438639709117996871513443204230, 250703161441259865524294478363740633205241282, -628059284987210036098172486733024090342317174, -69404602537140074352767709804360885651001411, -15765892515000426464211403425849453999484699, 62731623309973115657365307846350921881642037, -12502327968012657538844419302842624054306537, 5987944204499979461958350701259189455952796, -3539533841770208533476291172455649448708831, 607177583372583858999304815977402462648014], [-315372212725901425787732402541344360038768563272, -739645939341744224420105811692109395859123260993, -123910882853877457405751068313625713984636299143, -598583129883602371252092741371265669247465026175, 222982735922364544722075572595352862570644004564, 553203913329160587435416565221076045473850211574, 930822938241661759964951962442755187454529650460, 856560923862011896757299573799017154071118006517, 535345668666975726584973380206022409624422379524, 467394275642319710551926567148564736828795591930, 262401238737251560607595762327334129084226192331, 22949291962280067000177991844016289147174558540, -27995093751128813928411456244252619729329932625, -13948984719426566886211000293369600610254153845, 4348708911172130979884057608854377991958615196, 521683112288717079973655616527876325832293688, 558831515232445439447956026609173552749797628, 5422355205536980109940713113218603594879114, -143828585120242975140553747230292231704081077, 29120635992975299678789179238297361880052075], [-322134236057258248370557964968745384151085736111, -533801661556594506756837396280460246613943600592, -4504851638021760768830819261908038774544654125695, -3889367172632851007031573296178832710772319355175, -5937217103935395000571767067491960604144704446932, -5496937743703975664619413478469724970408321177832, -4760533421106130086494683324298902259494589590144, -3257373674692825443304344369909971837842519344852, -1617357432484050542967028426729707987262623297678, -806131990860141332673368816175799771794317665568, -313937818821847877962117545769644326540131837635, 37167191811828609430041606446231456280049670752, 30008010090961780424314862612858980316758198009, 20105879277174653814000785001115500617860931472, -13162540032262460984154025752736166491107234341, 1915091065621551325059945190828801338459188187, -1659056129112431329086903007893295715529085149, 461634713157414753476155443610573551081462506, 78146290473254176552017981479080064364121501, -30672476445170350685868194423389586346270748], [177800972854179499562460840884819515725112447249, 740914704144689097482564215914222415249286594921, 1782028531665750934875909208557746097545002245908, 1837099009295432954179401782982075731356761369645, 3452393599381277123083679297650963064121323281544, 2830168946706323776275299440853280335385778786502, 2751017272275889675334979519064513948305480417117, 1655422908302700077367244120149785553876932815483, 956355535197415681432821577473584329892997291906, 407887706284467078122494741256735765360911380187, -74062806257272305094166911728453907352088152497, -132983684034079579343645261341345670090763340370, -7987890999606713675505458270753584433693011737, 7341543554270320242600759345445845102951764752, 10999921021966675291063668671579785643866348570, -4864733836409602500885427191381684048402690602, 2120723618545350801389894566492482404386260826, -1258206328935283700869404743168540503678912700, 354086146203010757767994585823986052898855410, -34609908898418947787768338797071691840866390], [3302018925778921276310787940664777261161035522, 8599667693684917302552639656342987297845703197, -2071840776143079035847548557102081216252685568, 11359995908209744246499556130452073542216527027, -1301268117919854390627881382129166745367806154, -6537100351948778922225656022249406520648370005, -17713198261643475920617281721386386727520576160, -18963309977572859448815570163333416191916722790, -15349153700609115040292696385645366120368247921, -13617246933915049518289884261117869440608019567, -7568976232555134270284299691392921115751427219, -632141334361128657562858124433637330134743337, 831589696969898726473308087786060251152037532, 373620502107419372338814635800320583277754692, -104177681385721378250334556498979032318276365, -25475089675418145744063716563676688005807124, -11940793423615011752990381994607248068005975, -1238190031224460553261272999872563195150372, 4272381568356520244507446912126263273317931, -839911827563359583081110097912896632897151], [124691292528986905785431731429853625958414493209, 487675119718401035167251448275177557787874218636, 2158849375771111537485730648328894510667317935078, 2325322619439647474811496864428279222790628739331, 3268590694981169459810921502276980201393024714293, 3483526326210374408006324674665657978137178972734, 3135717379461957432773260712540772597606158760721, 2413800640684121373915337071323890084685909392215, 1474656046350754941243138462637753916109825718190, 770532152709077573572715552485979898188905580769, 267562191130307955576929749033136311524832995921, -9044319751379020207535935379818167530437070375, -37488075206933221845120509927861550165176784611, -10101150563466376669746455830026667453665242206, 4903195323680425800255225722839246418331552846, 1738309017162246480029209578002109861951150225, 124195354972255511149006780522526138401807045, 59420291331701374610655624592638729980366664, -173408774275788234018920837709148838319833839, 36919687389890720540266985548230281754048904], [7964616472198163879417216447881901032872873884, -1422393846977043515451101386902609508113768549, 4115472754045726288066393553953239979596249363, 12061611475777203278615051284679282743289089863, 18848371842505952974670787577010214844550529890, 30668426944059941163565230480097603563685745625, 32816663923891903489330264225499524698373237633, 32777970200451868945185642937971856420685364999, 26135727790717065496142343127288278625292957528, 17320526802252310000931007481039745688895724160, 7833734952373646782243854355795020372236079992, 509209400092912621961343331893324354424161017, -975471374900021470663256444831812130711866485, -306909779632650017647636773559836600139793744, 56489846798245931353258544923919909013598997, 70096078613037336745475283384202036060816560, -5561093146526481876313326267179614833085943, 6986847470274731265939293456821189371525246, -5918286205565730911239035785875946080171387, 1062919937457321116443205021249498013476703], [158146875471577581450188417912690991988821703, -72415805123059999951036209740907982212482582, -1308222405096286668083744791360384876552722082, -1717896282766283413172220872947048109439862803, -2808374816678711151593630848629575049826658963, -3103291405371349308024234116143010117503805193, -3372601716714131762386412714705230260289375611, -2723400331757744701679596005115718674059750347, -1954390407447288436663580532094195634241483988, -1349674528368333786304068104062977047221046958, -526116910539182860286266417660780629652905341, 15440019218992636112017311896553981996309276, 73946728156962965460551932611212095237823109, 19589499786319021419743359574566137569980605, -10202285208543068347748144205099971120119392, -1573636654993215406499670627405228485474906, -1142116344313940848433113550432265290945761, 275234852740871822495475448688641373832729, 210015151953812117925059018039775928318657, -53923486158919846676428191699692080730845], [4670508406667771230355522653942398143492645154, 1806252706266061201627190451095424786662165110, 27350245399363270748167846258654908389668192526, 54469640748143555197307800989872281028454384640, 80818101022240956085275761368756149559530305134, 99595993311441877019534452759339973767424335053, 89679810389250472999365324777729643312928112950, 76335298209593140227711567525372775290038171449, 49183012427682477686371030201891987048976461273, 23723897377260543519883844492433211540438440639, 8588754842398502380534057854382004380980851404, 423451383477417094984904698790800960572222864, -1180288644783071321862810229779006749168872567, -305152090087011569909255334290158838774019846, 50852431530678715757924932051235607104729051, 115472390228020552866629242273132353685292877, -23149031255649317050314571829163010960992382, 14307835487664993684924769222811026684806198, -8808517438412226522951230703665968090175910, 1517825158525749897536541394229202963596675], [-295279260505032661058740254641503549758135321, 9703533301894634467701937571377445510105126850, 8323490078619567470377302101992876891515326097, -1340614930647653024871247222691073222954719871, -2170447116391985138807069381345261319280408662, -30483564133170057556730276637833436864504323345, -24945111130126945795163131709433527123852085971, -28664056883751331139613681738474621891750159677, -22424748686546558418708047005889856434214639639, -14958527993058701942789287520284571398092390992, -8726579517209107487447814369288313180144394854, -1844353291882636467255287571669404894774643783, 955667149669935703857283252957527157417940848, 370962450275756655804903582248821254856349702, 60507604270314181089090995287970199408093793, -133250031461463642308829795358910948677059595, 32313003450918676221915908091368001479283841, -21720812647151044948035591830929791419084920, 10257038562260073621193799581620472014817734, -1532587414890139393253106537987521742483300], [-412603825290881508176726027320056004290985367, -4606152425086652554198852772015998458888859767, -29743537688769737028453435102170971459147159041, -40966432634635420684171913124135316883512567791, -39236440990478357573507289149665872219493648760, -53627686037023530939908844969227934201052446916, -53767422460896126480377338619442707383563438166, -43590629947655881265387326567398631075364030171, -33066388035548000612188262101106507958660650722, -26199515144555985748131414319161932228972067077, -13416591510678571134182870512794267007583441238, -1447062350193674218331827377207527122141098003, 1654012963102478937592468520715539346146531364, 525909732487568516597273944788502265550584914, -70940256077921810845460433848413196850418843, -112036803953809878085334121480618535890306137, 4859693975138193532328297738065994422307964, -11219724032239640981313868843730617760236872, 9834106148892292118687293894267732917244931, -1747311316436735289577836151680648462281999], [382993786531567129115006656985407562852009379559, -311399497330663493772136008611773914881684033754, -449677506557238700486307371765016274884790988357, -2048607764071419510866502068555049638652390333468, -2816969058994200221739683445342141677953481678657, -4271713643353662781304910694946272857897565534766, -4033892496878566643106924032584782118805473052018, -3459895284773290752676019412131086643622172245897, -2456557690870054498991403352862889268927275783091, -1391557344199609473134379979293828229295884769299, -495991973700326541388629884879913037274587495161, -17227528118374719428030163366099323391185979384, 76961053873007046315556351128882816897238827778, 12875156845205520466543476270316916982927930909, -2016922509748725739453564353818965657131855780, -6426371728493978953656043900912015134584715883, 1021833757980717914078393892849825867637708360, -584198970648790856535200234095960739982453507, 424630618267648274156924536580179481226497231, -76791137808812122704902045131739006073512454], [142645250856568383405100096320177734604211234527, -287527228197363595233010020792489610492851410375, -1088108625464502266083863379320162622485773836138, -3534338566210450777912949489359151170725438115975, -3873456660846592842331519357630461088681798095985, -5328634756700550206411453010796037905628983899909, -4766553839316901881287367071843686003224443718454, -3945139573600111335361859492380857917420453731158, -2503081759273096743845636913888173144091295550631, -1250995249249358730362456403215609386250180037231, -497509392788562656770135117546929737328161169867, -62977325898371255388930544366773492155102638731, 71449099005233660018213874946232764133079165579, 14246322642822461624525360280463487499506161913, 2131028394187255869981362376145538028348328033, -8590813184703052446057712434975279740872253785, 2073254180791685453747657275553652265677600605, -1157017849151947418692195766126580824667841780, 586917820814747314418774771439916437435397164, -94185627003189904221652549751440670233346152], [5890175943142385093545744544936175176464899309, 8107574810426992043619420040005697560743005407, 13827571675067207986983606675817262872634910950, -12679547738161895820547928373300860763426109256, -13746952391106075613665998639216501711421499056, -41356086318742036141812857843438738471497725394, -54351197274323471815002964326387546892397544015, -58501953737082976974390163853149568523146870699, -46408499032671671140891275200357100996714955831, -31754889616394975454651815740161428855392923519, -15250867313686348130218738589101180985863980203, -1849237735053212383749932075135974288014915764, 1985192318942902938536250899142154955782093747, 562894608236240622676496521207881588904248007, -31579411165019240297622157180278300684540532, -166738891623726148567248605272384760794205048, 22644567918303580922692618782371137672304503, -19924048431925145877905208226324036427631193, 13246442315390659374849416809217352589968206, -2236379478913969286622778377330534500150979], [-96350899996111716591391280012872858400443680346, -861615858281848602360072317420690302025239075808, -1015227082303657498571365203885106267501453752394, -656689445244221677794870358690205374653043839340, -695785872545726076025320431415809246590929641685, 1108518589550070478895211615698394564076772941852, 1269915859319114221526092491107430918111236388029, 1845395745040202455532387828885941736193671117819, 1626312815765244210682490255739477270416921451993, 1138606058283112490451587163533255519201739498302, 644895167782720910527752953819863946277315316038, 125697779181503744722549924327479958098213268201, -73011324463178097509528287243577163602244300276, -26733977809468401011552356259388758557348414421, -3661915084920854592700725514318905680051041575, 9358876886165441208451322968969466611995548632, -2135867570000962105776818963910957263932644006, 1464930995588416724290512839779124568224690910, -716965329258621835876237231664748491642933093, 108616474573669098380360991952148794034712678], [-197494885514114624534840258379821194716436057417, -356260988036224413033618706954708339660731267955, -2205696932877102911658150442691062338910222383011, -3940496371886991946228077885280027782274726141395, -5330706252631581919497051457840816932247657885286, -6591860989968064897732746779956734507236454089278, -5836801767189532222065087008682536707174057541599, -5030995348875355923392179837148365379194924794273, -3325997084355004457353926835060053486453061681999, -1807127045237679141554857595178451808117189449377, -731320947374398018390482959728288082206136894971, -54430484470099100713024680538042059469094439928, 96577974349049866510705468466191491438898226150, 27351512540098792094404015025092734565401003971, -4113756041016654969184031671611560864455200259, -8550300762288909616299182006212957516742621862, 1394864011008947045039334926434071280862721218, -1028046910377056862991622341433133093326014157, 682039483258884392021691610022207305878431732, -118024686557317582993110286184872601962049389]];
    Rf_basisdens := [1, 1, 579880260818871732383115220995614991234021217453, 579880260818871732383115220995614991234021217453, 13485587460903993776351516767339883517070260871, 579880260818871732383115220995614991234021217453, 579880260818871732383115220995614991234021217453, 579880260818871732383115220995614991234021217453, 13485587460903993776351516767339883517070260871, 579880260818871732383115220995614991234021217453, 13485587460903993776351516767339883517070260871, 586329889604521468537022468145212326829141777, 13485587460903993776351516767339883517070260871, 13485587460903993776351516767339883517070260871, 13485587460903993776351516767339883517070260871, 579880260818871732383115220995614991234021217453, 579880260818871732383115220995614991234021217453, 13485587460903993776351516767339883517070260871, 579880260818871732383115220995614991234021217453, 579880260818871732383115220995614991234021217453];
    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_966_q();"
function MakeCharacter_966_q()
    N := 966;
    order := 11;
    char_gens := [323, 829, 925];
    v := [11, 11, 4];
    // 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;

// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_966_q_Hecke();"
function MakeCharacter_966_q_Hecke(Kf)
    N := 966;
    order := 11;
    char_gens := [323, 829, 925];
    char_values := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    values := ConvertToHeckeField(char_values : pass_field := true, Kf := Kf); // the value of chi on the gens as elements in the Hecke field
    F := Universe(values);// the Hecke field
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),values);
    return chi;
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 := 2;
    raw_aps := [[0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1], [0, 1, 1, 0, -1, 1, 1, 0, 0, 0, -1, 0, 1, -1, -1, 1, 0, 0, 0, -1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [-1, 1, 1, 1, 0, 0, 0, 1, 1, 0, -1, 0, 1, 0, -1, 0, -1, 0, 0, -1], [-2, 1, 2, 1, -1, 3, 1, 1, 0, -1, 0, 0, 0, 0, -1, 1, -1, 0, 1, -1], [0, 1, 3, 2, -1, 0, 0, 0, 0, -1, 0, 2, 0, 0, -2, 2, -1, 0, 1, -1], [-3, 2, 2, 1, -1, 3, 2, 2, 0, -1, -1, -1, 1, -1, 0, 3, -1, 0, 0, -3], [0, -1, -1, -1, 1, 0, -1, 0, -2, 0, -1, 1, -1, 0, 1, 0, 1, 0, 1, 2], [0, 1, 2, 0, -1, 0, 0, 0, 1, -2, 0, 1, 1, -1, -1, 0, -1, -1, 1, -2], [0, 1, 1, 1, -1, -1, 0, 1, 1, 1, 0, 0, 1, 1, -1, 2, -2, 0, 0, -1], [-3, 3, 4, 1, -1, 3, 3, 4, 0, 0, -1, 0, 1, 0, -2, 4, 0, 2, 0, -4], [-1, 2, 2, 0, -2, 2, 2, 1, -1, 1, -1, 0, 1, -1, -1, 1, 0, 0, 0, -2], [-4, 1, 4, 4, 0, 4, 0, 3, 0, 0, -1, 0, 1, 0, -1, 4, -3, 0, 4, -2], [0, 0, 0, 0, 1, 0, -1, -3, 0, 2, -2, 0, 2, -2, 1, 0, -1, 0, -2, 3], [5, -2, -1, -3, 0, -2, -1, -2, -1, 0, 1, 1, -1, 2, 2, -1, 4, 1, -3, 5], [1, -1, -4, -2, 2, 0, -2, 0, 0, -2, 2, 1, 0, 2, 1, 0, -2, 1, 1, 2], [1, 0, -1, 1, 0, -3, -1, 0, 1, 2, 0, -1, -1, 1, 1, -3, 2, 0, -4, 1], [-1, 4, 1, 3, -1, 2, 2, 7, 0, 0, -1, -3, 4, 1, 0, 1, 1, 3, 0, -5], [2, 0, -4, -2, 0, 0, 0, -2, -1, 2, 0, 1, 0, -1, 1, -2, 4, -1, -2, 2], [2, 0, 2, 1, 2, 0, 2, 4, -1, -1, 2, 0, -1, 0, 0, 4, 4, 2, 2, 0], [-1, 2, 4, 3, -1, -1, 1, 1, -1, -1, 0, 1, 0, 0, -2, 1, -1, 1, 0, -1], [-3, 3, 3, 3, -2, 2, 3, 3, 0, 0, 0, 0, 2, 0, -3, 7, 0, 3, -1, -7], [-2, 2, 2, 2, -2, 2, 0, 2, -2, 0, -2, 2, 2, -2, -1, 1, -2, 0, 1, -2], [2, 0, 0, -3, 0, -3, 0, -2, 0, 6, 0, 0, 0, 0, 0, -6, 5, 0, 0, 5], [0, 1, 0, 2, -1, 0, 1, 0, 0, 1, 1, 0, 1, 0, -2, -1, 0, 2, -1, 1], [0, 0, 0, 1, 3, -3, -1, -1, 3, -7, 2, -3, 1, 0, 2, -3, -1, 1, 0, 1], [1, -4, -2, -1, 3, 3, -1, -2, -3, -4, 0, 1, -3, -2, 3, -1, 0, -1, 0, 2], [-4, 0, 0, 4, 0, 4, 1, 1, -1, -6, -1, -1, 1, 0, 1, 5, -3, 0, 3, -7], [6, -1, -5, -4, -2, -1, -1, -8, 0, 5, -2, 2, -1, -1, 0, -6, 4, -2, -5, 5], [6, 2, -6, -2, 1, -2, 0, 0, 3, 1, -2, 0, 2, 0, -2, -2, 2, 0, 0, 0], [-1, 2, -3, 1, 0, 6, 2, 6, -2, 5, -5, -5, 5, -2, 0, 2, 1, 2, 1, -1], [-3, 0, -4, 0, 2, 4, 2, 3, 0, -1, -4, -3, 2, -2, 2, -4, -2, 1, 1, -3], [-1, 0, -1, 0, 1, -4, -4, -5, 0, 1, 2, -1, -2, 2, 1, -1, 0, -4, -4, 8], [0, -1, 0, -3, -4, 0, 3, -2, -5, 5, -1, 4, -3, 0, -1, 0, 3, -2, 0, 2], [7, -7, -11, -7, 4, -2, -4, -6, -2, -1, 1, -3, 0, 1, 7, -6, -1, -3, -3, 4], [-9, 3, 1, -2, -5, 5, 1, 6, -2, 2, -3, -1, 5, -1, 0, 10, -8, -2, 5, -5], [5, -1, 1, -4, -1, -1, -1, -3, 1, 0, -1, 2, -1, -1, -1, -5, -2, -2, 0, 5], [3, 4, 1, -1, -4, -3, 0, 0, -2, 5, -4, 5, 2, -2, -5, -1, 5, -2, -5, 5], [1, -3, -1, -5, -1, 4, 5, 5, -4, 4, 1, -3, 2, 0, 1, 4, 5, 5, 0, -5], [-2, -3, -4, -3, 1, -2, 1, 2, 2, 7, -1, -5, -1, 4, 4, -6, 1, 2, -5, 0], [-1, -5, 0, 1, 4, 0, 0, 4, -2, 0, 5, 2, -4, 4, -2, 3, -4, 0, 3, -2], [11, -7, -8, -9, 0, -8, -3, -8, -1, 5, 5, -2, -5, 7, 4, -3, 9, 1, -9, 11], [-4, 2, 0, 4, 0, 2, 2, 0, -2, -2, -5, 0, 0, -2, 3, -3, 0, -3, 0, 3], [-1, 2, -2, -3, -1, 6, 1, 3, -4, 0, 0, 1, 0, 0, -2, 3, 0, -2, 0, -1], [1, 0, 4, 10, -2, 1, -1, 9, 1, -2, 0, 2, 2, 1, -2, 4, -5, -2, 5, -4], [2, 2, -2, 2, -1, 0, -2, 6, 0, -2, -5, -1, 5, -1, 0, 1, 0, -4, 8, 0], [1, -5, -10, 0, 0, -7, -3, -7, 1, 7, 2, -2, -2, 5, 2, -3, -3, -1, 0, 1], [0, -5, 0, 0, -1, 0, 0, -1, -1, 0, 5, 1, 0, -1, 3, 11, 1, 0, 11, -3], [-10, 0, 3, 0, 1, 0, -4, 4, 0, -8, 0, 3, -4, 4, 1, 3, -4, 0, 3, 1], [3, -3, -8, -3, 2, -8, 0, -5, 1, 0, 3, -1, -5, 2, 0, -10, 5, 0, -10, -1], [3, 0, -2, -3, 0, -4, -3, -2, -2, 0, 2, 0, 0, -2, 1, -3, 0, -1, -1, 3], [3, 6, -3, -5, -8, 2, 3, -5, -2, 0, -3, 1, 2, 0, -3, 2, 5, -4, 0, 5], [4, 0, 5, 4, -1, -1, -1, 6, 5, -5, -1, 4, 0, -3, -5, -4, -6, -4, 5, -3], [5, 4, 4, 0, -3, 11, 4, 2, -2, 0, -4, -4, 6, -4, 0, 7, 9, 0, -2, -11], [7, -5, -1, 0, 1, -4, -1, -7, 1, -2, -2, -4, 0, -2, 5, -7, -2, -1, -6, 1], [2, -3, 1, -4, 0, -7, -1, -7, 0, -2, 7, 0, -7, 3, 1, -1, 3, 0, -4, 2], [18, -8, -16, -15, 4, -19, -4, -18, 5, 9, 3, -1, -3, 4, 4, -13, 17, 0, -12, 21], [0, 0, 0, 0, 0, 3, 2, 3, 0, -1, -4, -2, 3, -3, 0, 0, -1, 0, -7, 5], [-3, 2, 12, 4, -1, 1, -3, 3, 2, -1, 0, 0, 4, 0, 0, -2, -8, -4, 15, -5], [1, 0, -5, -4, 0, -4, -8, -4, 5, -3, 0, -3, 0, 0, 3, -8, -7, -5, -4, 1], [-6, -1, 2, 2, 1, 6, -3, -3, -2, -6, -1, 3, -4, 1, -3, -1, -6, 1, 6, -3], [4, 1, 0, 2, -4, -6, -4, -2, 5, 2, 0, 3, 4, -3, -4, 0, -4, -3, 4, 0], [4, -3, -4, -3, -1, 2, -1, 3, -4, -2, 1, 3, -4, 0, 1, 2, 3, -1, 0, -3], [-2, -4, -1, 5, 6, -2, -8, -1, 7, -10, 5, 0, -6, 7, 3, -3, 0, -3, 6, 3], [11, -2, -10, -10, 3, -9, 1, -11, 0, 7, -2, -2, -2, 0, 0, -6, 12, 4, -11, 11], [-2, -2, -9, 1, -2, -8, -3, -9, 1, -5, 0, 0, 2, 1, 3, -2, 0, -3, -5, 2], [-4, 4, 11, 7, -1, 9, 4, 11, 0, -5, 0, -3, 1, -1, -1, 10, -6, 3, -4, -11], [-4, 6, 12, 11, -4, 7, 7, 4, 0, 1, -4, -2, 6, -5, 0, 4, -5, 2, -1, -18], [11, -6, -3, -6, 2, -8, -3, -7, 2, 6, 6, 3, -8, 3, 0, -4, 8, 3, -4, 8], [0, -4, -3, 6, 8, -3, 0, 6, -4, 3, 0, 0, -4, 0, 4, 1, -1, 4, 11, 3], [-7, -5, 3, 4, 8, 4, -5, 3, 0, -12, 1, 0, -8, 0, 4, -9, 0, -4, 9, 9], [-2, 0, -3, 0, -4, 6, -5, 3, 0, -8, 2, 5, 2, -2, -4, -3, -11, -4, 9, -4], [-21, 7, 11, 3, -1, 9, 6, 21, -4, -1, -8, -6, 3, -2, -2, 7, -2, 5, 5, -8], [4, -4, -4, -5, 7, -13, -10, -16, 3, 1, 3, 4, -7, 0, 3, -13, 5, -3, 0, 16], [-10, 11, 12, 12, -1, 15, 10, 22, 1, -5, 0, -4, 7, 2, -7, 14, -4, 10, -6, -12], [-4, -6, 4, -2, 1, 5, 5, -2, -4, -9, 1, -1, -6, -4, 4, 4, 1, 1, 9, -3], [-11, 3, 18, -3, -3, 11, 2, 2, 0, -6, 2, 2, 0, 2, -2, -1, -3, 2, 3, -8], [5, -4, 6, 12, 6, -12, -6, -3, 5, -5, 2, 2, 0, 2, 4, -3, -5, -5, 1, 6], [-4, 8, -1, -7, -5, 1, 8, 4, -7, 6, -4, -3, 1, -1, -1, 2, 13, 3, -9, 5], [8, -5, -2, -9, 6, -15, -6, -8, 2, -5, 3, 5, -3, -2, -2, -1, 8, 0, 4, 14], [-3, 1, 15, 3, 0, 2, 8, 2, -6, -7, 7, 6, -7, -1, -2, 8, 4, 6, 3, -3], [-8, -1, 2, 1, 1, 8, 2, 2, 0, -13, 3, -6, -1, 3, 6, 3, -2, 3, 2, -15], [5, -10, -6, 4, 11, -16, -6, -7, 2, -4, 12, 8, -14, 8, 0, 2, -1, 4, -1, 16], [6, -5, 1, -5, 2, 3, 3, 5, -1, -2, 2, -5, -5, 2, 1, -6, 2, 5, 2, 2], [12, -11, -11, -10, 11, -12, -4, -4, 3, 5, 13, -10, -14, 10, 10, -14, 16, 10, -16, 9], [-5, 2, 5, -6, -4, 3, 6, 1, -2, -8, 0, 3, -3, 0, 0, 3, 6, -5, 0, -1], [-1, 7, 7, 1, 0, 7, 0, -7, 0, 0, -7, 0, 4, 0, 2, -2, 7, 0, -2, 13], [-10, 0, 11, 0, 0, 8, 0, -1, 0, 1, 5, -1, -5, 5, 0, 11, -8, -1, -1, 1], [4, -4, -10, -4, 6, -10, 0, -9, 2, 0, 4, -2, -4, 6, 9, -8, 9, 0, -8, 8], [-11, 12, 19, 11, 0, 15, 12, 15, -3, -7, -11, 0, 11, -12, -9, 12, -11, 3, 11, -11], [7, -4, -3, 10, 7, -10, -3, -1, 8, -10, 3, 2, -11, 2, 0, -7, 4, 1, 2, 10], [8, 1, -3, -4, -5, 1, -3, -8, 0, 4, 1, 5, -1, 5, 0, 3, 5, -4, -5, -1], [-9, 6, 22, 19, -5, 13, 9, 28, -3, -4, 0, -2, 4, -7, -4, 25, -16, 1, 13, -22], [-12, 3, -2, 3, 0, 10, 4, 10, -9, 6, -2, -9, 2, -3, 5, 4, 4, 9, 3, -12], [-4, 1, 5, 4, -4, 5, 0, 8, 1, 0, -1, -1, -1, -4, 0, 3, -8, 0, 3, -13], [-13, 13, 8, 13, -8, 8, 0, 2, 2, 0, -13, -2, 6, -8, -6, 4, -2, 0, 4, -16], [2, -4, -2, 5, 0, 3, -2, 3, -2, -5, 0, 2, -2, 7, 2, 4, -6, -4, 4, 2], [6, -5, -4, 8, 5, -6, 0, 0, -2, -5, 3, -4, -5, 5, 4, 8, 6, 5, -6, -5], [4, 1, -4, 4, 3, -4, -2, 5, 4, -6, -7, 3, 4, 0, -7, -4, -4, 3, 0, -5], [0, 0, 4, -7, -3, -7, 0, 0, -3, -9, 6, 8, -3, -2, -2, 9, -1, -3, 4, -1], [-2, 1, 19, 2, 2, 3, 1, 2, -2, -15, -2, 3, -1, -5, -5, 16, -2, 3, 18, -3], [0, 4, 0, -11, 1, -1, 0, -7, 5, 4, -3, 1, 2, 0, -3, -1, 11, -2, 0, 7], [12, -4, -11, -8, 4, -12, -8, -8, 8, -9, 3, 1, -3, -5, -1, -16, -3, -5, 3, -1], [0, 6, 7, -1, -4, 4, 7, 19, -8, 1, -2, -3, 10, -3, 0, 11, 7, 1, 12, -4], [0, 13, 9, 0, -4, 2, 2, 2, 4, -7, -4, 2, 13, -4, -4, 0, -7, -2, 7, -2], [-20, 8, 20, 13, 0, 14, 0, 16, 8, -13, -3, -7, 10, 0, -3, 14, -13, 2, 0, -16], [11, 10, 0, -7, -14, 0, 7, -11, 2, 6, -5, -2, 12, -3, -3, 1, 1, -7, -7, -6], [-17, 0, 9, 0, 5, 13, -1, 14, 0, -15, 2, -4, -1, 1, 5, 9, -14, 0, 3, -2], [-11, 3, 1, 11, -2, 1, 0, 2, -2, 0, -3, 2, 2, -2, -2, -2, -2, 0, -2, -18], [-6, 7, 14, 6, -2, -2, 12, 14, -3, 6, -4, 0, 2, -3, -8, 0, 0, 8, -14, 0], [2, -2, 2, -7, 6, -5, -2, -9, 0, 3, 0, 4, 2, -2, -2, -7, 5, 4, -6, -2], [-6, 5, 5, 5, -1, 8, 5, 19, -6, -5, -1, -1, 7, -1, 0, 5, -1, 0, 14, -8], [12, -7, -12, -8, 5, -8, -8, -1, -9, 1, 5, 0, -7, 8, 9, -12, 4, 0, -1, 16], [8, -6, -4, -1, 3, -4, -3, -18, 7, 2, 4, -3, 0, 4, 6, -18, 2, 4, -5, 3], [5, -4, -11, -5, 4, -11, 0, -3, 2, 0, 4, -2, -8, 4, 3, 2, 3, 0, 2, 13], [-10, 0, 3, 0, -5, 5, -6, 8, 0, -14, -9, 1, 6, -6, -5, 3, -11, -10, 4, 2], [-3, 2, 12, 3, -8, 12, 0, -16, -3, 0, -2, 3, -2, -8, -2, 10, 16, 0, 10, -7], [-2, -15, 0, 12, 7, -4, -5, 0, 2, -7, 3, 0, -7, 2, 2, -7, 0, -2, 1, 7], [0, -2, 8, 11, -1, 27, 0, 11, -2, -27, 0, -2, -4, -9, 4, 9, -9, -3, 11, -8], [-10, -2, 1, 4, 2, 10, -1, -1, -3, -7, 2, -7, -6, 5, 7, 3, 0, 5, 0, -6], [0, 0, 9, -6, 0, 0, 4, 4, 7, 0, 9, 1, 2, 2, -1, -2, -5, 2, 5, -4], [2, -2, 4, 8, 4, 7, -4, -4, -5, 2, -6, 2, 0, -6, 2, -4, 2, -3, 2, 4], [-6, -4, 13, 13, 0, 6, 1, 6, 4, -12, 9, 3, -9, 4, -5, 1, -8, -4, 13, -6], [-1, 0, -18, 0, 1, 1, -4, -6, 0, 2, -9, -4, 3, -3, 1, -18, -5, -7, -14, 18], [5, 3, -5, -9, -2, 5, 4, 13, 1, 14, 2, -6, 4, 0, 2, 5, 9, 1, 0, -13], [7, -6, -9, 4, 5, -17, -9, -3, 4, -4, -1, 2, -3, 2, 0, -3, -2, -3, 6, 17], [-1, -1, 2, -7, 1, 1, 2, 2, -1, 13, -3, -1, 4, -2, 1, -5, 8, -2, -8, 11], [0, -5, -3, 4, -5, 10, -2, -3, -1, -2, -3, 0, 5, -1, 5, 15, 0, -5, 12, -15], [-2, -2, -3, 2, 2, -3, 0, -13, 5, 0, 2, -5, -6, 2, 1, -4, 13, 0, -4, 3], [-12, -10, 1, 12, 9, 1, 0, 8, 4, 0, 10, -4, -4, 9, 2, 2, -8, 0, 2, -13], [-2, 5, 4, -5, 0, 4, 7, 4, -1, 3, -14, -2, 14, -5, -6, 7, -8, 1, -5, -2], [10, -5, -23, -2, 0, -16, -10, -12, 5, 6, 0, 4, -1, 10, 1, -13, 3, -5, -13, 23], [10, 9, 2, 15, -2, -1, -1, 1, 8, -2, -2, 6, 9, -5, -8, -10, -3, -6, 2, -14], [9, 3, 1, -6, 2, -3, -3, 1, 0, 12, 2, 2, 3, 1, 0, -9, -4, -2, -12, 9], [-15, 2, 19, 16, -3, 15, 3, 17, -3, -7, 6, -1, 0, 6, -2, 17, -7, 1, 12, -3], [10, -7, -10, -6, 8, -17, -3, -10, 7, 7, 4, 0, -8, 7, -1, -15, 0, 1, -14, 15], [-14, 14, 8, 2, -15, 13, 11, 14, -8, 1, -2, 0, 6, -2, -2, 10, 9, -4, -3, -2], [-14, 10, 0, 9, 0, 20, 14, 23, -4, -6, 0, -3, 7, -7, -7, 13, 1, 10, -1, 0], [11, -14, -12, -7, 8, -12, -12, -15, 7, 7, 7, 5, -14, 5, 0, -3, -1, 2, -3, 12], [2, -9, -11, -9, 9, -2, 2, 2, -4, 10, -2, -3, 0, 2, 3, -7, 0, 2, 0, 8], [-2, -5, -17, -10, 0, -6, -9, -6, 3, 8, 8, -1, -8, 5, 6, -9, 7, -3, -10, -2], [12, -2, -12, -17, 2, -21, -4, -12, -3, 15, 7, 9, -5, -2, -2, -19, 14, -2, -8, 18], [23, 0, -3, 0, -2, -9, -2, -21, 0, 19, 0, 4, 7, -7, -2, -3, 7, 0, -7, 9], [-6, 0, 0, 0, -8, -4, 15, 3, 0, 12, 6, 2, -4, 4, -8, 0, 19, 9, -21, 6], [21, -8, -21, -24, 0, -18, -7, -14, -8, 5, 6, 4, -10, 0, 6, -18, 24, -2, 0, 14], [11, 5, -3, -14, 2, 6, 6, 14, -3, 13, 2, -13, 5, 7, 3, -11, 9, 13, -13, 8], [12, -3, 2, -7, 3, -12, 3, 3, 3, 13, 3, 3, 3, 0, -3, -4, -3, 0, 3, 10], [-3, -5, -13, -12, 2, -1, 3, -9, -8, 4, 0, -8, -13, 3, 13, -13, 16, -3, -11, 13], [-6, 5, 6, 0, -4, -9, -8, -8, 1, -7, -1, 0, 1, 0, -1, -9, 0, -4, 0, 8], [-1, 16, 21, 1, -14, 21, 0, 9, 3, 0, -16, -3, 22, -14, -12, 4, -9, 0, 4, -19], [6, -2, 12, -3, 0, -3, 6, -3, -3, -6, 5, 4, -5, 2, -3, 6, -15, 3, -3, 6], [14, -9, -27, -5, 6, -18, -7, -27, 9, 7, 6, 0, -6, 9, 1, -14, 0, -1, -11, 14], [5, 6, -17, -21, -4, 1, 4, -18, -5, 22, -1, 2, 0, -1, -6, -18, 22, 6, -9, -4], [-17, 4, 20, 15, -5, 15, 5, 8, 2, -14, 8, -1, 0, 8, -4, 8, -14, -1, 12, -5], [10, 4, -25, -16, 1, -30, -6, -25, -1, 4, -2, 0, -1, -1, 8, -24, 0, -8, -24, 24], [1, 0, 2, 0, 2, 2, -2, 6, 0, -8, 14, 0, -3, 3, 2, 2, -4, 0, 3, -1], [-6, -6, 0, -17, -4, 2, -2, 0, -10, -8, -2, 0, 4, -10, 4, 3, 0, -4, 4, -3], [1, -3, 11, 9, 3, -1, 8, 8, 3, -8, 12, -6, -1, 9, 6, 17, -7, 9, 7, -16], [23, 1, -10, -8, 1, -8, -8, -5, 5, -1, 1, 2, 1, 6, -5, -23, 2, -2, 1, 16], [6, -12, -2, -3, 17, -1, -2, -8, 0, 3, 15, 5, -15, 5, 0, -1, 4, 10, -6, 1], [-17, -3, 5, 11, 6, 9, -6, -3, -6, -7, 4, 3, 0, 4, 3, -3, -7, 4, 23, 6], [13, 0, -2, 0, -3, -15, -14, -17, 0, 3, -1, 9, 3, -3, -3, -2, 1, -8, -13, 27], [-3, 12, 30, 9, -13, 17, 8, 3, -10, -15, 3, 3, 2, 0, 0, 23, 0, -5, 22, -8], [7, -8, -7, -13, -1, 13, 3, -3, -9, 9, 10, 3, -13, 0, 10, 13, 13, -5, 0, 3], [-6, 4, 6, -3, -4, 6, 0, 0, -1, -19, -10, -4, 9, -9, 4, -3, -9, -9, 9, -19], [17, -2, -2, 6, 5, 0, 0, 4, 4, 1, 5, -1, -2, 1, -4, -17, 2, 1, -1, -6], [-9, 2, 6, 8, 10, 1, 9, 17, -7, 8, 0, -5, -3, 3, 3, 5, 4, 12, 3, -6]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_966_q_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_966_2_q_d();".
// 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_966_2_q_d(:prec:=20)
    chi := MakeCharacter_966_q();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 2));
    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_966_2_q_d();".
// 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_966_2_q_d( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_966_q();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<5,R![7921, 12282, 74710, -58419, 151272, -86030, 123272, 50829, -46066, -2937, 30119, -14652, -1380, 4623, -1695, -186, 462, -236, 69, -12, 1]>],Snew);
    return Vf;
end function;