
// Make newform 9.24.a.b in Magma, downloaded from the LMFDB on 25 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_9_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_9_24_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_9_24_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 := [-36042, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0], [-12, 24]];
    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_9_a();"
function MakeCharacter_9_a()
    N := 9;
    order := 1;
    char_gens := [2];
    v := [1];
    // chi(gens[i]) = zeta^v[i]
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    F := CyclotomicField(order);
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),[F|F.1^e:e in v]);
    return MinimalBaseRingCharacter(chi);
end function;

function MakeCharacter_9_a_Hecke(Kf)
    return MakeCharacter_9_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 := 24;
    raw_aps := [[-540, -1], [0, 0], [-36534510, 15040], [-679592200, -985824], [-428400984132, -38671600], [2188054661030, 1268350272], [-127014073798770, 23522231424], [2130300489980, 137218594320], [4072356539504280, 106334043808], [-10409216800811670, -6804021206080], [68857008588500192, -14814525283200], [-448860632204483890, 173410338010176], [1147217738584157478, 559210547795200], [-875380384309927900, -240142500532368], [-7879872108828390480, -3634099566813376], [70143626700823398210, -1360721746009152], [-140436494985670385940, -31045701436426160], [-90226446258251111818, -82865402983800000], [877116581715778812620, -131620903771013424], [-1527516755097071664312, -167496041649300000], [-4031704126938803074630, -117939335115835008], [3122458407279819990320, -1561010165657737920], [-3437997041209249488060, -2448003171672996112], [-3197546543086535002410, 304549203196268160], [-15573644423127015250270, 21536924763862843776], [-92333101723466467151502, 9637026978392292800], [-9114293711217124345960, -5103740769235076448], [-510685166865416163300, 13121554247787675024], [115535273538875128625990, 37607319888789418560], [-151369422312248795526930, 43928537334986902528], [1844577166487603692499840, -104440182400324237824], [-1751774025245478818801292, -193345336260507419600], [-1610157495614499797548410, 620788030780280148224], [-2109730253202768078100540, -353901787344925439760], [-8205179085384012460806750, -1558087650188962068800], [-4380068370770203333421848, -1787198874643554544800], [7600575101844572374332950, -1625952167430568300224], [-24440418765769116832534420, 367962874544252104272], [-2971203118569319595877720, 3241545865633944445024], [-28261326142806479644548870, 16646621362508402518208], [-44233123454077397557309020, -11905867603694652366480], [-2035658280898116992670658, 10903744716265900296000], [-112357119847039559004439872, 43405096612114460268800], [-197490037079648553008809150, -15211027827035660055168], [245018462420068578226901970, -31812409487251638509376], [160643115850222939628243000, 62825200331128338362400], [-104350743631034237039561668, -152015617124783647426800], [409603468482931532450738720, -214778732537075429294208], [1985616566040633646421832660, -35986565974015231920976], [236722416776370160511033870, 192384846542342798671680], [-279673645746964137126966810, 419594187454109140994688], [-1842466766112930030834422160, -163075454466461882824640], [210660620076121336426546322, 363706539188460792624000], [1943621205522509883690872748, 475835650006873197426000], [4527156622478763698004945150, 126659577084161461633024], [-5984769366959102149896447480, -871215196940967366237472], [-3181576436641494176991333030, 557255604577701177938880], [8552546415403363119688921712, 740077022088858214900800], [3832999153917005177177562590, -2003379073215678654450624], [-11044850769346173898494158442, 300793056566018238723200], [-23873327622550379701063457740, -520211510094274563899088], [-9992161180757905622708057550, -4833450575506351813888832], [-29291729935651263072946737700, 3895889537438411086674576], [-17691010296798166743293372232, -4080168812241429671352800], [7129605931705965190781773130, 4056328906046304138646272], [-5437694058332308200640593270, 1833031096370403399257024], [101360778613659063449960658692, -13455303280288293955971600], [-16503729773993127204069315790, 32401953238984514755186176], [-129818479465632890039835528180, 3460482050833886065027024], [47531416537656996296208171350, 5557168287327401768116800], [171354382654794530272054486110, 43251939466139345798670848], [289979276562354602445300633960, -9695796288797369881587360], [-155180263719553092859856612080, -69758579929796441262748224], [-93350670389562241561771852930, -43212306203709238732713408], [467400209673770183965884350420, -42755570949626055038160720], [347567726324766950240087111040, 141374719247112744357657088], [113122708967079624349643398290, -209150317804530906326194240], [13347138663522603599200584230, -746004233270717550949824], [47179832445665070832061181198, 95317609285088202943926400], [-161010175868699367306197234710, -145186514892120777775223040], [-2214077843244995324455155939180, -111158451910213197934218320], [569058501391491213874068579662, 255967238734194496534804800], [-2114040030144094742308914282192, -42907550170516526149329600], [-1567001108815958952935983071790, 245275149980412910478397312], [-887615178550818534497756106040, -241154293859922540582704160], [1451680403116039187226161006700, 140256400779730350606501968], [688998591340107105595425148350, -675312864395710715723068800], [1845054114629794594488499912250, -64929621179611129270305024], [-4415216712662712095194655748582, 76502220130900540862244800], [-4156855910739182315837368893520, 772302369488708460156939072], [862598292484852746940690371780, -442512995262591466207535376], [-2346033042069085773833666476320, 982232305488378954029141120], [2850680006420374386612899764760, 437042451432277023039958176], [3747867830050829500576290032028, -746985916407657314760268400], [2518182555413400056108510294300, -3352047079014281059024345200], [-11672775949061036109112715516040, -1121781546585308824039702752], [16588051388836043740753628628810, 1010771807508071578854005440], [11926102377689199703847517100038, -2347909025373245313712300800], [-13472933288004955570254022414780, 4547171098291064930203902192], [3278983123215213035300881820822, 1323256548736118986368033600], [-18533172369460440715412251808020, -1802638558352473721958408624], [-18838642907713145811434882626950, -1143984320957527970370374976], [-26226385854824541578740305935580, 1027737125926018732675420528], [26103636872652636333462168556470, -9481594537466632121011966720], [-46581683175065983477982191511788, -8851836967940165399293611600], [-28654256871646989863213339710, 3499580763509281753463870976], [-69385790477119067217682413241860, 2694644660467171540422865424], [-10625796681543439547952491276850, -3564145622958992570103340032], [-80792806304991190743390732258600, 17434628074873640426012279200], [5484119038078698718467224917802, -17399886370344014172700176000], [-24355760893393258074572305372000, -1750635272568651047050333824], [31456578492914402515373356454030, 2655804560294698583266251072], [88282599591375047627024012867430, 30911657662487617560417437824], [69082734441861551810676270570980, 35836498207509067858145105520], [-222863661369579935972838609263608, -17577977281236462555712800], [68209372947717122797101358513278, 45389782020090746744272092800], [92376890304809496185391601013900, 12123032023983488869791713232], [97597865066151820788250028451720, -61442992770266761990118834976], [64697039618142288907934808520410, -4632466288786450068046962752], [-55399562514314741202294295318140, 20035239132723634941592659440], [240434708692185544831379934066782, 8420912175801108051684820800], [276852387817797873171762153564770, -56588984290723321794460295808], [138895431402493939023314884773810, 54636796342319113021084581824], [-177192257944383576739094694436260, -104137969871247766811618336112], [-390329104678006202733074722206628, 72099043057003668160504813200], [250918533606972395017966150873098, -170619308308365089675049172800], [-480449680015704270174696370182610, -50371024431979104748603899840], [-584061145364613889525367254664880, 27475059771175904488302962880], [858273553756407884670170635139240, 86596049796416927208833249376], [-774738436399739824946139246696490, 169666540704594560314379368512], [-597957105568452955118931985257940, 196325984614154198908006409040], [164188738696570953470111055277800, 62357608487592538077250531168], [538825462433747443554853511921552, -195176024225674775175511771200], [-562294914413131536237938984258050, 219426728555685305463660000576], [-952922536983440414772191362777482, 212501489114390271784095980800], [1950478006923734615332956869238530, 158970897593524957648806645120], [380016811131430760746047101670930, -101813398679807235731078601792], [-852069138478776692361597937998340, -487744608438621054486303447024], [-1944383599306447168298508170331030, -81153451674513495672108666176], [-618599666818711266065523606038490, -699687899171589362530150920960], [2751123174225482469355896113751332, 327766953698811508770960044400], [1617740150685146112228938324316738, 302791218781919429657800932800], [2652607721404520693977309574075720, -696155041322725717481532837408], [1564748410633912658113085719124460, -449159814836113169531203436976], [2061535770935793259571158342596470, -925699122945959094279586595520], [-256662718861852504301136722514360, 108646887023632976388746132960], [-4653886868381671688783297054861410, 978637133880134417092523660352], [-2149642224832989014177418743236650, 883291850067557891364010759424], [2303019012851366680931385071217140, 914058450400295731007706150960], [7813242376760823330007854347418720, 568833452887151766399225740928], [3925290318213556892870064329605190, 1009380153522976548874280179776], [-12884177257037969925188965456180242, 178558855338373717850600563200], [3049502725202585959374829827317660, 340974352726837823078118068112], [6849703812504206872243362657621240, 87935491911910873328479630624], [1692030273758107503185781516719300, -1038285596111309671631078436624], [15449844671666219685359972684721168, 122168559411123632534315518400], [-6169194568406402861131164984772120, -2035884984271691728328821176480], [-14631556807682464132744663020527970, 582262882035750914877702216320], [-9495643695845857555548045057498790, 1461517782976847273231031278976], [-18275825283141616146332791515734022, -2322708382625384477793472001600], [3217122449816727553891372296826020, -5753743593054100317868161682576], [2123827551453799021023271293901110, 4796179336372422037520759970048], [-13494272596401588620694869561684680, 1499513105006223261506369618976], [-264903549141686917278970542996612, 7414288897602840108063188432400], [-5679078286484938202676140479565490, -1327212382050266823951665941376], [-3453334116774316370556160639233960, -2565774528419843210604181359712], [14364724954765873839890725883754272, 2559335465959561499987096035200], [-12166614854581341133412885097264370, -1650376995415907267394144114624], [49876278520334023770657721132403090, 3110593058954774934143309400960], [8733729766924085309861054439424770, -8830310345176612072935983857472], [26089519883965795813562034595855020, 1883941608835562431459786233680], [21957807119768228831173010213614262, 10810946647514878023620865600], [7647823476070283747461376957420808, -10263285094890491119814922432800], [-10096862611818955337089014204611590, -5594841255050666899563667010688], [23040468887428870911286068674299760, 1948253274267814118928322635840], [69536231113539151289648511531033750, -317164931835436539205966025600], [-54649306882308345558150443437049548, 1382492008654237002248693290800], [77643526171125551205036782111680818, 359408510512752531220046232000], [49430295436253876115643371846059480, -7562249912844019478636363500128], [3929685272949009029731582274993030, 16111928540466712415938731174720], [10227222191663826821331060641754560, -21989310869885009802216551956224], [-150119877600990316667752557178572, -8399687965909634187769856213200], [-13120530944867252849678629564032850, -28816968654090044038763040063168], [96456893067500493832976340695360070, -2389687505198774657433447086976], [36919112350414935548159117115633360, -24038839471500735152887532409152], [70267478793040749788589169378323810, 20649564001929342000072003266240], [152508101320747187553904481602282070, 2390610963913024593130626298176], [-91826867077695698380788509307133780, 10044371672139896989103526982992], [-63101029046428318419146994378512230, 13361865163753751200231368410880], [-31463250569916940982127076123565952, 32469571453384821539527313088000], [115629545890179229293511294513442690, 355700130265215145719696932352], [18282333339373380501736420802780220, -72669743228474536202373990111472], [83663916668205352519338526766015612, 22108126572161257831399852074000], [-109488756578460815183785675323307542, 7258539128734216007567042340800], [-166447071296171253158450906912689260, -3303611838341717483990573917776], [213796711087774514587695854020976550, 21366532043194735897792456509568], [190834893101915197882648791110869202, -12592855115108055318312497894400], [-169584542814827283750413718905141770, 29538353410080010592239448523072], [130184530049230826749737819225367230, -39850828548320895936432078002176], [-129428239230984995126100862985688120, -23002632766202485333141937628192], [183708352103806488456995505774056730, 39802664787245081830072080905920], [-356198467390458582844777118224886608, -23476159235965060435156822929600], [14606063612963661144508987749946910, -97479852495988432621225949567424], [-150269400024282961326159022471568350, -21169129793925359158934488473600], [81079747037662239199431759790408860, -125241569897056648830995202587760], [-525026378972475762354724527648510390, -39839862955264577216576267290176], [724575249142489984232057232992510720, -65458372371459841554179486469120], [133261831701045869771750368122711540, 175567107460092700030283206819888], [-32630407619378123242189897570358010, 118142946133950343218193613164160], [-194840040709931948074690298834724028, 60352393032378021343625343990000], [436670629995044323787800039747126130, 112143375158546404493377905787776], [313757580818926214580614196805681698, 54005484545280767593730133265600], [9376142987007697135995756057332840, -14379118093075181647776271206048], [777705083893864802333398916381028300, 2875737478290550049835148643024], [47656778531329216912024156440462120, -129309970285897526512533639420320], [-304102601026038157271490620157094438, -5814668304984457227794821920000], [-311962670093146414569517050642397360, 56838416779315153133863261200576], [-153591216327595966208107050978840882, 145838031735792879794067592323200], [-351945854310135119965012445397946920, -128215539151212372257448802183776], [245325041410959151830013608472476330, -73951405991183734960636746416192], [-751139261831323825229247228186847858, 178739558150350704614212617403200], [497569629629819153841398067356174600, -275316588371154240332497688205600], [65551007327453558625783150236784510, 305429744197913289534298389427840], [451331446423681583630691604468609520, 650994054011922333308681788656192], [1939933225151106434440235351813987460, -255770235816792051454215274101776], [-410859463584087199251409023939348130, -195521835045652413064031890537920], [-1920144484839359113030399710914309610, -354256058413878891737473982691712], [-179939838186408748486090085390648160, 741589126263762280262236934424960], [-3129057717343400094713490024426026920, 133293267675700514586000194998176], [1666374389321819117516556706609075548, 246590480137815737797945162912400], [-528862684357908474635610142878870010, 199882153622940898178644214847552], [3289825473396992860629521179611963740, 76975734412916327019151996655760], [728972265627507329216022229807003712, -487889904746548288698862127212800], [-1550120971170139205799590818996803642, -517827432796617005944663862422400], [2405737955114309881410033353683286660, 320508980702366248812776750268912], [3676434798483133020565792111249269840, 236230216558830582027394700383424], [-1715977246662076016000138409143456590, -284532134580278097380133093855360], [-1581030333923136917988505210542424350, 480495760541732193215116757016768], [-2540251906407850798877730716660080500, -29905525000581659593229273726000], [1641562280996100744805667235933153768, -841070831516200304512340363863200], [-1317399724160851490595099980501749020, 179898368076105009511677509841008], [2097833901268372655939008114336011092, 309294198765999840230046359809200], [1082616030234716462734738705515927800, -1476801735481365268226624144787168], [-7393093582261253452668901049061967450, -15231348904565982536505374097600], [2844304930581716620629593623197671310, 96636892576619154205151360424448], [-6497585868977320645509696965837652840, 783540466640180750043786930465440], [-875077069793100066501492348579899680, -816348318864374877562954993636224], [-4946954804990825118864380371742604012, 209053443333933084362108789306800], [3629881383618810502833007262215146020, 980182056191703861751099333991280], [1452100243726458334115788094016197040, -624431873079415676098916075320512], [-443727081431290612558473345082892170, 556418019207005805458928660941376], [-1848443861458047952795864782821156802, 2577641331984121961878218181440000], [261762062825686317433665505949161800, -246482375825199354447872372089376], [2538408484275501987916994173536629690, 952803743593645197909510444005760], [4145875764472267243355212535326870170, 1107956228757867370351405726920128], [2654347247907930586326774035386423620, 1577415700955816617491118233316080], [7945359592806602425163496694186696862, 312467890244361564244686170414400], [-10300940693832757744283249163853474060, -827734277374714078582898378422224], [-12658910286611850417304622930508013710, 339341859809590869857383161023424], [10655146357407961870064895163035159050, -547010990098689216059619545274624], [5387293058888890221297099301731102080, -463642992595734366058630013449728], [729674526023407632056675703877252980, 365478655848206409127275493746224], [1782547774217991625891412937526494830, -1288315995663190576945476012281280], [-7470304467936325466975143354138575850, 127866382548163805848586653357632], [2203919240152168786382447635250989470, -2200712043587331201586703400661376], [-9174374976712060840366057627754986900, 580547402627393076785660245842000], [19016729574763770693353918336935785210, 1970886924129161553794147265109440], [1699978296033461800469035818522422838, 4020013528229808336785169973289600], [6904311500258114935724884273070889620, -2322060467780647649688897476873808], [1866459556490515814129463092587419090, -1962502510476072464545915350158912], [-2299674735532419590567940548970743578, 5117446913805110631986992230753600], [-7891661442386574544464791476604193220, -3554733422592308391318260906986224], [6342952046505560552831616123030597290, 3693232329221798768577936060922752], [7344099137970128441551430377446878240, -2896939566111230935266774381632640], [13587148150434040923769868257515500690, -3457470444246986808246009332673024], [-20133701183697195379923939699853726840, 5000949681302874419137455619161312], [22471467361565589728882670982777204140, 709711257666300671656644564479824], [2844483893390522257457790976379229110, -5505240261949414239142240220410560], [4370920984135339716616236455493886202, 9226437993682209129801072931516800], [-8251468695543337633572139562237671932, 2819487344288060893707859217174000], [-39159135274246941216491390779107671520, 533530929344455221230875602548608], [-30453719057856713395972973474877965608, 2476003958260745852929362107997600], [6028810294584135381879480132760526520, 5063664930615534211847867558472224], [-38439226945947800534987542428323867218, 4432834087077242850862984693243200], [21530101153206545413173083839241410820, 2721757324850671997347042211464176], [-33617303058199509285028045420291966512, 2709849356827576495914196829803200], [-18908399074932474877567708676249882830, -3857244575342204445599682855623808], [-26560583248766596492669171040881599390, 1487998953370466121872012276953024], [-16492381082592376833660934076707819480, 5381116736804078650638573983798880], [-9820225377615592252816748705366869410, -17165264212108233547775244467965440], [-5458726760373600200520038011370335302, 5082001696298959722915087936574400], [31485160424073418435926994674763289700, -7444517807481237954059689222847376], [-7697076084143899867462552584344241930, 1539688391609711940305728353344128], [51759828638562054272484921421330069308, 7875778224531438760154857763376400], [71980808327548264201369693025540047910, 9189686411259559775542020526696512], [-15394936258211351774768759284648003350, 12552872372837584895553287382136000], [-26273853888477881579712264970250239648, 9143528412924087616736483457168000], [42377087660285971879814848822019816130, 17185968552177803547134119108783808], [65402067622518138964394758930887900780, -3428635324864021827985351159823280], [22599283695768654716847236215213091660, -15078596787801460230219681810245424], [-58058693770724448482012337971693201350, 4771742039634643822970092312204032], [-121646089116485194484568257843815725030, 2696513369696331437221853786092224], [39217358420680364507561429735896660400, 8778832638284221087852586219630400], [74307554201061936609128566840434635460, -17270666097320141051648318027220752], [28700510989284648184591234655398722932, 24926771875793507946134066667236400], [22679996921434316941611436988912263970, -3868649722136383361012562593860224], [128107451388974397376355470805166069660, 5897274970331740229664007318772624], [-52953185636205906842827695391683305530, -14188760349491724553665371202045120], [-50625631549256559147127638121766695560, 30435912829692523893235864513219360], [-79876419779575239986327557527728565010, -22558054753897791691335346079091648], [-114224539270080394724630751256512512880, -9395596894452084036755089441886272], [10522444756190288851348920934374446370, -26837588546577084205823039811136320], [-161857983413670019295100546034759510242, 12899072347129896049555371801180800], [-96589772571632351634688290855989937940, -5972324852019061562115768806163888], [-97195213369110107270929185113628582360, -32418068493387605458246076167644576], [-138086181485942236513916093130943991590, -15921474713199557204711585525228160], [120581924944544069343005654733404254500, 17180532316618719320992581780690800], [-62893638462763891859297138382803216832, -43362434596328304279794015562656000], [130970695691264786698750801387193339330, -14434443536877460189972241320624128], [-220653004008370546377331329719439569970, 11599506758034716281821524662481920], [97342914629035071895290566252276143292, 20918245620632581741883608373475600], [-105456394633813630077131367380315083990, 35355288019964893001103748793285376], [-79269831256877573974268921024330062422, -57889506000263884442733364053326400], [-337693744625467262343202221074523138400, -4620192803521760546896032123389568], [-89297155906340578509510294406574068890, 32207951095635310521687877930888448], [67750942466689592204806521414750712082, -22323769604699818185545875382966400], [82422939790585296717486186725675681420, 34401675036119662588363391988668880], [225583483115028015881782211191457500340, -10469398236966747309019943482864848], [-156306485723895301209755423566953621600, -81266442626897199065282046887464576], [103034261904141228225827452273533147570, 84216068851167041380370716575169728], [-261706290420730234451942300078548082938, 17829694806846473141032173882004800], [66913526835692007146268404792448596490, 52849238902453820229892723277477824], [-56369051484737747235675995781372072640, -15379700131533058844911645011068160], [-62779430153471337291245363624666868300, -40346743700266508726332309852084432], [211284523355398754298757791994776139652, 27268048787879608823585974308476400], [-310599393506835381981119098255012885620, 56220995211402691379318356828687824], [184243450520679199981833730469165199830, 659595430258233374152331957113920], [31388716135033251146357095407469041630, -57442782748297090125196524662830592], [223162366318438261183880982996267542042, -9735551600187825603715749714921600], [-10645776495444038685276439049405449840, -121046714961989466367013153216169024], [400529811939047398549245686887182026750, -65951280903832231708963817528395968], [310327805651107141905997752945505866870, -26235248663672453003879004315947776], [-150277152494178145267115865217724740590, -137525832435837045430497176777322560], [-670835454745345056883012723412288668168, 31432781933782421578342986151130400], [391163920030676888074500915302453840490, 15187949821877626658031853200490688], [828786492896917548095559712337408696340, 16140940905058290560032896015626160], [124916180930784605219316245278709212622, 118188025210907435136771392777928000], [-165287633996870842325444198507743027420, 99404367708191322624696514485803376], [-490417552807419244662704383419715478352, 120422714467781918766574775533371200], [340535380975633094769007569077397034050, 10579719173475535581911892653010624], [162206779529841929595333070277686577612, -10559595010901242098265275410679600], [-66293397077892233142214148579991440710, 96917870065816895670726152837573376], [793228611103407337987775721046144719258, -6703907525732180233165642824852800], [415516059344075401409870108856024998960, 118805490593216930685904704974958912], [366219247677931526339117388182457015710, -72489104948915357579930419210157760], [-732368689007397232781429034769662763050, -12196776445392919024304859113077632], [-649497209183941814265298231682986384800, 13027745963671390211250200331510400], [462464188458790491715880731577778909468, -116824734047589842727248817807346800], [1029380164128144531535588908036265986030, -6948444114092497296986666906542976], [-1352457964676206262074707505654812128520, 44500780310879841827056231910251808], [-556556730397677073088778668505136569490, 86892624857477698565864522455987776], [-125246116355456286297908509096612364922, 84433940625897137000641430510096000], [-924756961779355088632204353665016618480, -146159248138760230488169750617216576], [855680989283057925015857521255738563660, 129602618792083262266983469396690640], [1699561726428386451401700426329737095020, 16538209683257263209644865633988176], [-392519004160591589231868533552460709030, 294992310908321992823545530459729792], [458736310161750028326503259883268092410, 43048529412022812655438017927737024], [-513878424814819626996454496651913820360, -319228254278947061711856108580167648], [1303400253703441862443059801655285953962, -70816448627822068826088536722771200], [1703231740983208264834196486508662097108, -9442111068476744928268016383090000], [55003976501332290028246740243600156260, 347478584277280143025479942310857840], [457037466588503904320639068642268626800, 142668602806938152054465181832648768], [-2181154724599379639079794732232023620350, -150433512583023219211562962566299200], [287954691845557161649525286532253167752, -175335485511928153287150342486554400], [63803308233955526289500957449290298550, -264929210805114610599875624215487424], [-94434008956747792511453258187063725820, 293090424778491883645025568189479920], [-1378004383766338937599036772081296143072, 112658247783233450206920695874556800], [-1780081717272108416925415298755024126750, -272693504733491162780301846237677568], [79022755175173082507491038398773096110, 262081830687214069008581571631655040], [-215269714205142125455496079564122287030, 286926319871709462850136573096568576], [2172803586989412783312471518920661625738, -332963612009478678686984304555764800], [105821737160248565775384942942732408390, 536667704868252238220599890484242688], [-182078824878992860392207359040212437720, 282172874452011348702375186453434976], [980412025670149542618586950735131008350, 44568872841236296960705516966529024], [-1311454037642865606971163367941854623060, 573174791350678187229460248646785360], [1344549306554287519476309693969265148520, -551521796348538568210399350365952672], [-2459326774086361914545712515144552827888, -299907428675075251224649403250024000], [98133687381415532975429736127336446590, -2708957446989923268998677987775424], [3486266017212798575032106604721232168660, 228412929915121996173997531086094512], [800693699059282381590264591637976192640, 959523104866307874648541125084634624], [-402869565260745740354878781092432766590, 991245390147176709305532293318039040], [-2316058801083402299495484220689287395950, 268868545630294902963581578891717568], [1185000852185158823746592298515413731900, 2211355875767784629573454508746000], [-236039553935956460917662494830167079300, 539267034319139696616451443476380176], [-737737511008362198718884801245947251432, -204030447743538371933393964573992800], [-1085813977860940245547744017606311662870, -947417815500744870032081972317878528], [1387379095155027305987994513950130742880, -765865086916907140920055004197610880], [-731788681989087907528819865403588295770, -303700319782449781076367298614542080], [398956520600542731995747887087614006692, -1081699547479145420826637443741958800], [-3435687403814148257514979354315209449022, 43394025273192240007998671936612800], [-400496378749149150478722400352415728650, 237807121842385346698982217170049600], [-1925728568851847484563890613825029972290, -836662414455474422390009256713530752], [727008616810757630859557646430886444720, 726934582935033453165794045011027776], [-313029116919842656990088383671354526890, -459485470033046949994330990503186176], [1673267515796108707221554727084453576690, 612672165801981990841568564832711360], [-2055709336031104218151584989850870007528, 413596601633112735076027891497252000], [-2487523766927069268348161215054043757370, -197211210851557608529340484656236224], [-1353128113755890527475250506966867155602, 1046459994358427433375291829989660800], [2822131082319433967501392666392517875740, 723640630687499681984851276414526352], [1185984165417033502330035490255759813620, 608704790961002924744202165923205680], [-1592114496150127943082293858754880539790, 687916947038254466882627176921216512], [6296025933663317550591540234897056531490, -340601308925806129358430826706022976], [597255824413865824260026219973578378700, 912574761103746287102158008751938768], [1623179380111469476843720257063867715052, 907850951545451027048541936379602000], [3306994119292128056473393295362003967450, -160791087991226961656049659035242624], [5035330446645382839267934975039884465018, -214692343714709155135458765819950400], [-6076199535971328556861265486512034569920, 373050508389370298171632326030078720], [5449203421376221846277805949396641208760, 1403550291395457808316416484612345376], [-2519746575575739466805054495404733274930, 1648104365289151126505709288573546624], [-9435795216593156754383886847784172723240, 347648025519829642457596287083666848], [-7330381593223198075138747016474909557590, -637457553865312721412612659966973760], [6326847868180529256502398392246286685070, 1031800123657660956646141207699200576], [7075852099132075900084577705350277637360, -728380772478018536854676109387261376], [-16457463679328694295288651580907451860, -1790733308448707894467967924076632240], [2750178623314973278186252030758470343290, -2474213338538349852999862025011899648], [9742648311151830836248282683879404223450, -1181007971301382442731707956562771776], [-2775844592757250006891668578192244198780, 516137500552468631351280539508486128], [2510761355488682835492349228120733493270, -1387567065866601882368274767025678720], [-1233601778620820895162043271292146099788, -1751975395282697029648273961970670800], [-2894334467697909903017618611812647065800, -2004254692786106288019449041632248800]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_9_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_9_24_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_9_24_a_b(:prec:=2)
    chi := MakeCharacter_9_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 24));
    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_9_24_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_9_24_a_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_9_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,24,sign)));
    Vf := Kernel([<2,R![-20468736, 1080, 1]>],Snew);
    return Vf;
end function;