
// Make newform 9.24.a.d 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_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_9_24_a_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 := [97377280, 0, -29258, 0, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0], [0, 30, 0, 0], [0, -3051210, 0, 135], [-13166100, 0, 900, 0]];
    Rf_basisdens := [1, 1, 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 := [[0, 1, 0, 0], [0, 0, 0, 0], [0, 17070, 1, 0], [2140359620, 0, 0, 448], [0, -52068840, -6700, 0], [-3383642499670, 0, 0, -712448], [0, 56834260348, -587150, 0], [205778476850456, 0, 0, 35757696], [0, 515525395024, 14763800, 0], [0, -9854914990910, 630733575, 0], [49791379648383908, 0, 0, -21764383808], [1528578128356354910, 0, 0, -10500608256], [0, -784858875864220, -18217322850, 0], [2096109129722497880, 0, 0, -589933098368], [0, -3121499288156656, 33704659000, 0], [0, 6648804893204178, -357950546625, 0], [0, -24469385199585840, 2135962067800, 0], [-46908974320486263418, 0, 0, 21337371081472], [554467225276943936720, 0, 0, -20960113417472], [0, -256949632766269760, -13593026376800, 0], [1389554758074421664390, 0, 0, -241346655051264], [-390645815131573557916, 0, 0, -380716817262656], [0, -4165449121937070968, 61106262577500, 0], [0, -528574317491009800, -1168489865500, 0], [15422116373173492952270, 0, 0, 1488781249113088], [0, -21254881795361745190, -1159674256684325, 0], [138382647197975349653420, 0, 0, 1311887586457408], [0, 43456711288518552432, 2146501466459400, 0], [187122790628129837400554, 0, 0, -20808675532840704], [0, 79933957161661748088, -2405667682737500, 0], [211566371848257186248780, 0, 0, 96576961921948992], [0, -507057635488670461760, 2275262647959200, 0], [0, -1341381538532539829540, -5871901259970750, 0], [4259535953478420690890576, 0, 0, -176769329007047936], [0, -812309411491281229690, -19229993870904075, 0], [15410577793411791500172548, 0, 0, 421326886729651648], [11658875174113120902542150, 0, 0, 743328635973164800], [-11319470580096093492183400, 0, 0, -1969972966095354240], [0, 4286770502895890663184, -355226473276925000, 0], [0, 4079898237390061644510, 167772475777459625, 0], [0, 16267293047666569577680, -693410552718530600, 0], [27115849274088192075352658, 0, 0, -5773007235516755712], [0, -33816019724868880221200, 407426876154765000, 0], [60488761744190373178270850, 0, 0, 3103524656303726080], [0, 32363486161088300094818, -1190888608142670025, 0], [81566999491543434344086364, 0, 0, 33513845688032494656], [-574203264973652905852433968, 0, 0, 31141299345309000448], [-304980226571562822523794820, 0, 0, -2193050239173023168], [0, 372274192489915197733752, 9287803013827124900, 0], [101922265908925878302024066, 0, 0, 105003435951767851264], [0, 204120894750658079639560, 6683562014324057500, 0], [0, 159765356645363179106320, -6534264733182387400, 0], [1268741289548869200827162222, 0, 0, 30985919080027161088], [0, -750955939182545682039880, 8357975459924020100, 0], [0, -201400191915463121807824, -13545156492058311000, 0], [0, 2593721617426887971394944, -1509501616529067200, 0], [0, 745996628609578466072970, 26663825437078193475, 0], [3823305227884495209900302012, 0, 0, 71939791277188826688], [7941570580290394029374471570, 0, 0, -1582588011495015886592], [0, -670538874783898404135600, 90870725497923311000, 0], [6139915648672069706114549600, 0, 0, 99588827479952857600], [0, -2646209169968530150505294, 31265814090156186575, 0], [15753944141772863648396453840, 0, 0, 3177224576491800957696], [0, 1695111914288565762937760, -356480245801995685200, 0], [15150025297918316378095538810, 0, 0, 761595133125178791424], [0, -2487148197783100241406190, 529486337651814649375, 0], [26679601364428895522843453792, 0, 0, -10481725291336209602048], [-11274526387820983379421091330, 0, 0, 17055381039231671423488], [0, 47858178660018636317970376, 576783774222597645500, 0], [33384709194343835334889676486, 0, 0, -15102816082336169067776], [0, -14729333070274685368228424, -2168633103484852818300, 0], [0, -73845026304335597451669760, 285355867678685955200, 0], [111124031393484397944388589540, 0, 0, 33079190768221292103616], [-635852814734380231343718197650, 0, 0, -1721046743664886519040], [-218050190423077744140284377384, 0, 0, -14030967137812161924480], [0, 19053099246330882277481904, -4830417988753823250200, 0], [0, -32499201786977894917495290, -1925937729645535792075, 0], [290188121301109902167222750390, 0, 0, -18914294116610716326144], [0, 102006554998187724529322260, 7567576845406297372550, 0], [540987264357153914710725260246, 0, 0, 36878646610677971577856], [0, -57640927709299328202437320, 14096468013171245256900, 0], [-307396862347371036641578558462, 0, 0, -60928644771629722840832], [0, 502128695618321513397854160, -11208202899712395340200, 0], [605288506214914438804890290210, 0, 0, 354094190108837686539264], [488945989590054552622380551324, 0, 0, 115572534492543388409920], [0, 779583977750317491020467272, 18229645874206225125500, 0], [0, -1095043883471071427606096660, 7971588346085358211450, 0], [-3253800284429500340718404346490, 0, 0, -373566902186869291037696], [0, -1147341731155971404315794730, -25190185584718991884275, 0], [4448059705334397086886210775820, 0, 0, -413199250522596262530752], [0, 1481271919929174817445966936, 27423365738962770456500, 0], [0, -2634136382047899109025629120, 29917585701995148402400, 0], [2718355269958107918004159418900, 0, 0, 696980048532933338109120], [0, 656027341248597187822796160, 40810746093153500372800, 0], [2349443326896088383452815751264, 0, 0, -256211129528630973502976], [0, 2563133155999738153288518880, -72459316913472901622000, 0], [0, -2186713350156112974358635350, 59040045556836087309875, 0], [0, 5968933437194261534800022900, -78571651789552904382250, 0], [118941643033127449812907036760, 0, 0, -1520957760678095951189376], [-17283682090324415126513674063078, 0, 0, -2703079118050585867629312], [26101850451991906422769666904840, 0, 0, -325003735799321061421184], [0, -2679153579165647370202338290, 215818605086365398012625, 0], [0, -5272246316883807590042824424, 16046272930995634927700, 0], [0, -600487972436447149585636940, -237119216029855248741450, 0], [28369561449490385110364748805712, 0, 0, -1308639448706101964821760], [-27431632989672201995282784046510, 0, 0, 3058147437039263726654976], [0, 1567724900094926067278789312, 5378034025018753962400, 0], [0, -6786397872717638654600368632, -322388864150888019334500, 0], [0, -12722926234470591247372494480, 595767496786205359918600, 0], [2664180721747636031906589553898, 0, 0, -6466497577192698573767168], [129221791730191381295081559627980, 0, 0, 5113161790503915458020672], [-61243848019563677993732774501410, 0, 0, -6678878794142393104176384], [0, 16314171837066040650696608272, 411175909780988750329400, 0], [171423802977227474377096291874144, 0, 0, -5151995339004657360664064], [96688462172714400026547981329492, 0, 0, -6338458119381175908421440], [0, -38696845759520160222668010820, 800116157727060508349650, 0], [-105831843954961472889101101122040, 0, 0, 19130918296531488370593664], [0, 33799965416099088340601082480, 14093082250727074629000, 0], [0, -102225235209370828128765405258, 511860992892127059428125, 0], [0, -57140285856950655247887140640, -2852456238264375607529200, 0], [-317065405767656262786995469638482, 0, 0, 15240735524482767128142592], [27380641990554188129268938232050, 0, 0, 51836025376277547302364160], [0, 17040827969641948512195920086, 482998579306398459898125, 0], [0, -58577360060253245616800895784, -2463052956087376422556300, 0], [338135334722943810178191759586328, 0, 0, -50116473592471390525682048], [0, 17065018934801119176899462970, 1475282093612954386130475, 0], [-3575409130075133008027824161854, 0, 0, 13148525386009013371392256], [0, 266434776666117070278159578080, -2468720543483663268671600, 0], [183439659308123926172620269796820, 0, 0, 34627668208869457882894528], [-794664807267704770141710519074950, 0, 0, -37830932249749530701515520], [-427356865670391131359381157560624, 0, 0, -107836400585046616753249536], [0, 189488555592221212312613611280, 7408043241410519700483000, 0], [1529074373954169825630328529459348, 0, 0, 19836841020910939362159808], [1492543813413777076425664675646930, 0, 0, 85614653466836589506810112], [0, -165804728400327470524112855220, -13304469635074722566199350, 0], [2129951117884039348631782725652994, 0, 0, -19461126708607645632190976], [0, -388520462583732685808189770502, 425527482741489906956875, 0], [1470015537453472641440501170111400, 0, 0, -61602016245688546866903680], [0, -237955798757807642753690312698, -22417193344632954953654475, 0], [0, -417378832997608379265110902980, 3011964395808432864200850, 0], [-402061612678132697004871673723032, 0, 0, 155059473163652061578963328], [0, -893893382083953651551960944350, 24109989098202706846604375, 0], [-4893715235701868637502300227615820, 0, 0, -20975406269716851834529088], [0, 69384936510447170071891687216, -17372400360564991780247000, 0], [907133518834395089872263021243866, 0, 0, 162103766092521018709483776], [0, -1183239220551329288566750985600, -7684181424106872248328000, 0], [-226784029121294168598101383667890, 0, 0, 539026660444108780572769024], [0, 308505692037255291308350998884, 29255219105088719561422750, 0], [-1950457065750381167586508602019096, 0, 0, -347773416073177146823982720], [0, 700121764770486737118948712080, -57537418016908389845781000, 0], [2550768505580588199165570267020150, 0, 0, -798562997756002438000559360], [0, 168533936619805295370293418160, -64503843203336299010562200, 0], [-9732713099964973898102545554287080, 0, 0, 388944111001503819797102208], [0, 2679825237443703651228950125024, -9502639112017285271686000, 0], [-8320419779772190824968125912171960, 0, 0, -1024707921258267133146387584], [0, 1707250757783769957970558100240, -89697658464176568127881800, 0], [-844941266778599137212153111908044, 0, 0, 118257750883527525975040704], [0, 2674050752474320071165782362260, -74431904384326493572219450, 0], [24620858366381365698481211711951690, 0, 0, 173705024315377060348532736], [0, 219426250593896965000420279510, 66223544510560097542534925, 0], [0, -1215487624403226883459084323728, 45898861468304435458571400, 0], [0, -4981702452487824718852372056316, -75726047452684537588726450, 0], [-192456887902254529832493328817620, 0, 0, 159276206698566567685863232], [0, 3395347937162345687528983419480, -5877684271977660367457100, 0], [0, 2716948576379098798708913988, 28363896263483632296866350, 0], [0, 3229737406915768991085021869088, -128943987485964525828826000, 0], [16585613764591277283624450590192372, 0, 0, 1413931395501793438714775232], [-4703423847438105679000075811840290, 0, 0, -1311178812418455124982794496], [-18507503884508001537069972200738146, 0, 0, -2401741403389933274091746304], [0, 11987690000272406322469540058246, 79150308066932364149870325, 0], [0, -9260914924094107519869760072480, 25742751366947651716387600, 0], [-20837182106613015997619109378060538, 0, 0, -5231262209628043795239166208], [0, -4596727304133901760098786929360, 66283308474252695585084200, 0], [-28904966226586487834431671628140970, 0, 0, 4460271247993947444241672192], [-3400547922830995278493102363801324, 0, 0, -5289696427009766293886421824], [0, 15204973327632061872355304688160, -369538330913634226182125200, 0], [9711743958705175653190015697891648, 0, 0, -2998504320258179967669109760], [0, -14366552463924902899693942887130, -304965536466949869045677275, 0], [-26504759890629519408590584278759460, 0, 0, -3444042857824913423466001344], [-23392380717901176898054061192452906, 0, 0, 7222350925945732941956756224], [-29267645978012766284034054502790620, 0, 0, 585462232539454113460652992], [0, -21338660214318320519156821465080, 81697186116596420465395100, 0], [-80085178177004969095741976546709310, 0, 0, -1118078731609325925388477184], [0, -13734138343208695309102484859440, -362413300631373417221369000, 0], [0, 1227144593779958864536737807664, 1108821191270165602459221800, 0], [0, 24535820512037257938907060463110, 53547960595088206606799925, 0], [57786909310595453493838902130579610, 0, 0, 15383443446502443918685211904], [46010779382418267672118528055857760, 0, 0, 12428195720644133952456600064], [79699610533060674363938831231515766, 0, 0, -732867077062153693816679936], [0, 21759721823562345940602208029280, 1920491719114049698772088400, 0], [-7219885427045719718882373997262530, 0, 0, -14958878816656098314247892992], [0, -22221143447314540338799477925648, -1636775198582368003018755000, 0], [213106330514058539633461520164935488, 0, 0, 2677386911814422711764073472], [0, 14578259665781865459734401632350, 1583323377177180453473211625, 0], [0, 3825080032967121624582146611296, -801049114347913714620750000, 0], [0, 4121235131265524294133840901152, 1809092038147877533438246000, 0], [-204045729016007606913239984785106398, 0, 0, 6271484622743666750922454528], [-240656628614206569416661355685018950, 0, 0, -1654606751581742032660663040], [0, -20229553978219093247531507885744, -863797662155913440529873000, 0], [0, -114870796506633610740860022926272, -1008034305033887525561716000, 0], [0, -80226361596717495883973248588930, 307559251833925462342347225, 0], [70967996191184260276257201500514908, 0, 0, 51719536611439607158247789632], [-99753978361490416180258255407079630, 0, 0, 10052244911069100864904830208], [-149742872405288116320025283903051314, 0, 0, -29274809866401497649222258176], [0, 76149481768422679988159483352520, 3166388263421857712477895100, 0], [0, 116322186506380070163201731083874, -2461543864506209969245239625, 0], [64161197811343525966458088976498684, 0, 0, -19765968036788690179225423296], [0, 95430205163452758580281699610328, -2284102525939411891933039500, 0], [0, -185091838257467406767838011229880, 3765722602237406810886639100, 0], [-339210802001455576388150009727653272, 0, 0, 55670484829353490724308425088], [325649392158297033497348356083993650, 0, 0, 65363798377502444116415055360], [0, -90464088718474339233812700789450, -3084097587965778311231763875, 0], [-440459938444644733884868047635539780, 0, 0, -64255701925415725227183653312], [0, -154561847349330821129427063995472, 5835117834965226643864538600, 0], [0, -165780798002555239600835618798240, -5829743203743511816267025200, 0], [-455458196020361708504260406073929062, 0, 0, -13272743104032282117499538432], [-499450336992900241415297761618605340, 0, 0, 67735632299607148827535075264], [0, 340762266787617791209761268103340, 655477232506715600715383450, 0], [0, -16925069925877647952830378939920, -9027607565432267047059923000, 0], [0, 142959769444167993922547899230622, 3120519415273467721788343625, 0], [882512794655866329445164392518259042, 0, 0, 50298970617140650871897982208], [-308241074500827315193135962801504964, 0, 0, 95092752954799465733569691200], [0, -218632284747424805448440727824220, 5724607667187999976206289150, 0], [442048791867891850622788117140958220, 0, 0, -106197580996627236301624604352], [0, 72013309702591890687285037282408, -15726291755663428783697050900, 0], [-259355418602438086800779429361622066, 0, 0, 312479977811233563665088330496], [0, 159954896312656476638421320887624, -19331539177284433404662045700, 0], [0, -159342666961893654203876085643360, -9804836453294657041079678800, 0], [-2440899449826567486820933301001647860, 0, 0, 54104254300489071236442515776], [0, 484905285530055182521833096805760, 8762042462926420332226772800, 0], [1934844611060864574047607880877104490, 0, 0, -104191817245138716415510732544], [1876231329402741579456917921026958504, 0, 0, 247889665818532784039731492224], [240844474850291594979287254807805612, 0, 0, 290729809672862118907282769728], [0, 575018479200727558168299014505520, -11376602652791665476540045400, 0], [-2957203216878436072643407072900621240, 0, 0, -111736303544324208935305233536], [0, 558038731437021064356420610139008, 17557606431314845414684353600, 0], [1345751779372892929187336377399672574, 0, 0, -337954289207226582575244268544], [0, -388878623566101842647803836635786, 15784090256621763929095300925, 0], [0, 579435203672891329049100856714040, 22969495029945966450710453700, 0], [0, 1037025337009093964464660291302480, -5553720670394507369136474600, 0], [0, -794127360023738765366346255901032, 5883615537006389345833668500, 0], [-3087058424174121437327063463038809792, 0, 0, -88377861854442134663437501440], [3109915571247456671181819836785786100, 0, 0, -332354542554384073866978447680], [3657106054637405143798233077503672214, 0, 0, 532531283789241433704955518720], [0, -899445915781806642871791168079456, 29618689135315913296637818800, 0], [0, -1003458628489579877718533630344000, 29944806111233329492847908000, 0], [954387273500201084020761242093591540, 0, 0, -77372339880174887839114307904], [0, 400417218984825542042716312818480, 12477045805447036080726543400, 0], [-1275143566453698519757093102405280416, 0, 0, -322555648238156344871048390144], [0, -926144245368838754539266871281920, -4114258065369191736164528000, 0], [-33337699234653219254068523062932550, 0, 0, -32480566990160880556399189760], [0, 1469291072850433593431124561788120, 69900803293950317735301322100, 0], [0, 714077563921810944828156141593264, 33151410067108449096874257000, 0], [-3089407208331347109001988498904527146, 0, 0, -650156227727694092878180284416], [0, -1311308612039048054568507368481286, 44667025014022708753105033675, 0], [0, -173045154129634900326684443706960, -86018936996961894753534571800, 0], [2501075883624011149277695762094078738, 0, 0, 666845926982734330123750851840], [11759231394191909352034551821245931120, 0, 0, 149847811858530522239874742528], [0, -1264039640341043575645297628801846, 7454980979194429336771571875, 0], [527473476806649445583658586939274570, 0, 0, 603107018051858314647363130368], [2076647899249603347939323473482919580, 0, 0, 995359787248230993113434902592], [0, 1304057755584188339693943538758992, 92210084744066049596684757400, 0], [-6063653828991759112979698494660086494, 0, 0, -938301364547769366544036248320], [-14939454286592704926697064015989672090, 0, 0, 1610609456911103455603793664], [0, 407512495066757110756655834414596, 50269515005409936332451212750, 0], [9197456474429921883117289471401798464, 0, 0, -696094304192109749154148238336], [0, -4716147743277982390471716470907370, -56343756693592355544046179475, 0], [0, -3097729094205131661419392270607080, -84975169021745856919195241900, 0], [-20549712690267209302643136791940368440, 0, 0, 79018324997423923648685048704], [0, -4401455368210327868203376114270442, 45675152916207423359194214125, 0], [2102304082846985642026917461838420278, 0, 0, 1067935481484354852954874133248], [-5533406840905574484177409463490449680, 0, 0, 605194176288004099684814385408], [4760778326423709052373253823219642790, 0, 0, 856742720981951970426275055616], [19142047512162265235641314391224960596, 0, 0, 1372085458217582039801031289024], [-23956880184466033163013740515147507090, 0, 0, 48662446796858007268288129024], [-16305650605071293092434326643575700580, 0, 0, -1204991077716441996860986955712], [0, -5965901463042704345178321873145752, 33517769771866833610130085100, 0], [-12611893432639193852368480719946835674, 0, 0, 1959491930596413868299592165120], [13309118912289775885568949784134828602, 0, 0, 422898520777717968248961879552], [0, 7252383817715620455820653672790480, 126147998451320367030812717400, 0], [0, -1231216230307574389447434997201120, -16492557115102672245598794000, 0], [33833746354364431681521650304807472508, 0, 0, -820299296789104099843784658368], [0, -10828536122240122873337826694144752, -186506364366987450303590979400, 0], [23568941532914230584599238119837038718, 0, 0, -1304608096925645378089772176640], [22570563561558744875420948223363142760, 0, 0, -1983171365414908179170444994176], [0, 8747482068677199842383420536232640, -425621313528997204556510600800, 0], [-30881226679960688763096366140417615410, 0, 0, 1533803140960373121874116542976], [0, -5473031938747629017050146626010466, 477785310382554163640185703625, 0], [65006238542927319385499819362123463684, 0, 0, 317349044674209293733029662144], [0, 3052478499834238208130055659323880, 423306900210261469567290681900, 0], [0, 8414625211260714081867273760259910, 39119521842216179029845067925, 0], [0, -7817782481575888392780921817604144, 117795362363115498412222183000, 0], [0, -19618191799206771445069682198800328, 136041739033479357766497138500, 0], [0, 7058569364085051329028128688922640, 428885641075734536692318438200, 0], [8019323971512980156749829453538659990, 0, 0, 11061588109384388726000764285696], [0, -7064637836014819398180606865692810, -762816481740156648047610548675, 0], [45284923098565938745595602445938852652, 0, 0, -902759466240470759347455580352], [0, 10342918604579128348460124008571466, -143227805899497273521366480925, 0], [0, 10865539025656276948102626602137640, 608297502080260495691870962700, 0], [-108462647371856501410946233127641786360, 0, 0, -5171392207788038644684799901824], [39142395671587201997094983106698645930, 0, 0, -2861143979328598551892780487168], [0, -24589213348198853305049401978622658, -649431296201381726964229971975, 0], [-67291161997697165489962335875205341164, 0, 0, -2582913845696550600789657824064], [0, -14088888994576411010453845339822560, -309293273651009612051150714000, 0], [-116244996947502094452881759660276778568, 0, 0, -497873733928890320446806891392], [9941971694352707644906635883619676830, 0, 0, 13522879562625289764915236332032], [0, -24856950554208841129160527515622760, -595221185378746359899754619500, 0], [-76753259346160735741340662122962905366, 0, 0, -6312235668725379366697292460800], [0, 38275649323601847927511151726307680, -703379343360330000232175799600, 0], [19590640936522946266139698080979093790, 0, 0, 441713083442987141026868718336], [0, -30711017553155592572699060737567632, 1033610123627861462067853733000, 0], [0, 41277673908475629325005232438762570, -165169125177190968732199562525, 0], [0, 20001923001632567300750837220551980, 1583718890017486058277625090650, 0], [-157772860338121563373358002220706868360, 0, 0, -2268618633684693230566351132544], [0, -31333179533861588571236871279913120, -1073114826378169790663191678000, 0], [99849115580522516515660594001887911926, 0, 0, -3082867615984002049410404020224], [0, -14540152054359191431269850986877120, -1877897628648990704679497981600, 0], [0, -3381597807761713176539527459573440, -415060754825706531833990199200, 0], [271417828940676010304444874028352790830, 0, 0, -1836179962886432014854237244928], [0, -43294051112429910774554587227592040, -609233294486746165037646894700, 0], [9850115165498564714158336380899818592, 0, 0, -19443745354661507893152979768832], [72930111710357059940934428737610035610, 0, 0, 6442407506733793457781419544064], [0, -23298368610255134057826724218480430, -828427557838011024032807385025, 0], [38603070539769372953030285634716266820, 0, 0, -34276756980597215783353565716032], [0, 39751202302696739858219338024118660, -1613835003667075021995881419250, 0], [-42329158282877325171669664165713029218, 0, 0, 13223580434586324908880746253312], [-138578008063788863932390710211325863816, 0, 0, -3174136421680494913026451146624], [-2169254480550834890222093426049861160, 0, 0, 4439930154152258079474461639296], [0, -12315741162844544197603099524075136, 526143428785292685415859656000, 0], [0, -75270831600975076251985496457491826, -457757012985247760258658814575, 0], [-163507728675546171229101087791519353462, 0, 0, -6103529943436762251358908155648], [0, 24845595902660660463676246737728782, -938551797799661542756045036975, 0], [459279980768145842388651040609876670876, 0, 0, 7436750585578704939328855099456], [0, -30613643582506224170173545402986960, -3579431533138431931664441415000, 0], [-260185889884039384267746767488542620848, 0, 0, 15093140931481827042792493615872], [0, -57698897321591867792581115288870808, 1655264973127322656051751025900, 0], [-127163604858927683690864093465040915994, 0, 0, 15568010064418647353796493680384], [0, -31526511953862113890444213393995384, 1377760361277213513431109972700, 0], [-283396577324818746231057999129461633242, 0, 0, 11702147319753416914675729074688], [507599247141591921027621259968126359180, 0, 0, 29558231367300436956356169859392], [60957069790266961257541882990275363470, 0, 0, 30599157825109419744819329137408], [0, -55610392298885234815453148091775436, -3035114554032868533114205658250, 0], [0, -65845801439376408484078110292648390, 4288406540777861742301937493675, 0], [-90884517271070684125051422665247690868, 0, 0, 15787786228311013091870828933440], [0, 175433403684423531885299503890405162, -837578721871578316880447354125, 0], [0, -233405432765532746794177727202594440, 1047504779225792301681245371300, 0], [-311937608511288201200768239381965787678, 0, 0, 37483190269060520507918613546240], [-537310202021313250246082273415114685120, 0, 0, 28453714227607948793597939325952], [0, -36238151700459758499059255124820640, -5872876609493183659963498129200, 0], [0, 132049866602508445692156078741266858, -4334932943586398573993486440525, 0], [295731901412785021132065286694994274088, 0, 0, 74253170955864443336861812600192], [-83682494754655064207000316356266496890, 0, 0, 13184412851975953505473047604224], [0, -77555817089517528671631833442929790, -2265424304302574622062758676825, 0], [419404978613147613467014888702426597820, 0, 0, -61807100092714398427305672915392], [-58243975618172216362490940372876408274, 0, 0, -27459882852024802407802216373504], [0, 73152162297006586034148533153293792, 4290976083564064435052780986000, 0], [0, -62539563207434807037687428097282320, -377183886652541744094948220600, 0], [0, 178985757482316760107213049632214400, -3042396074509756578713363704000, 0], [0, 167228427262988838297549272041805564, 5440515907362052695507727715250, 0], [0, 172454414768964646839386514861535136, 4215029138797013489705096705200, 0], [261526009433438870109126459302247930110, 0, 0, 51469337920095314993275028018944], [0, -169407666894863164991140058482936920, -453799482258362109245054514100, 0], [0, -188023824110307926462593940864378384, -6078063308382778897074869459000, 0], [0, -98785672655188699257526064402951960, 6839288601993958893765453782700, 0], [-1128368403952173476934483591299299198480, 0, 0, 54037418175650626269017909461248], [-471068683033747289335150819621892105830, 0, 0, 142623131690946726841332622140928], [0, 100178244191922359563969860163352210, -3594604665879981617860875934625, 0], [1654096205947343098796475894514863812900, 0, 0, 23847525815682575003207004212160], [1057633678291734982458373696813415247338, 0, 0, -32237230204306222302755154435072], [0, -9947917707628350494778264224045080, 13586699998753567255576597389100, 0], [-521155797327605767862759614909155744424, 0, 0, 57977121635921602562856293771904], [0, -248370143398765231228221984951422016, -16677037695293482242910153791200, 0], [0, 363734369138160497552046247598876610, -5837384573564676646386335368825, 0], [-1140408832081965075269624248789154539852, 0, 0, -108641102974158374391028097436992], [1220893135846365933595171107540286307930, 0, 0, -35337706454114053621618549371648], [0, -67867276797332568318840029911257160, -2133367395123945966280774770300, 0], [0, 412836570255113374334831827073839920, 5961792444573091696894154562600, 0], [-665493663819234668410377721424795005150, 0, 0, 201307864416730541071575611013120], [0, 728344504167218048739680906392735060, -10141680532408332709238743895450, 0], [-802296009967407284470023272250542633530, 0, 0, -303738836072437349248230823726592], [0, -244366818866301994495195010274037490, -1291836802938539209775868742575, 0], [0, 368950736382127403568478388156404412, 25638500792971078812353795543250, 0], [1296206732231073503647264058326773760100, 0, 0, 89994118672343240388458528272320], [0, 182386075198294913520216041052823536, 3111741548937425373507328589000, 0], [-2202464907882366301332879143849974363096, 0, 0, 107268387243322795017201018711424], [0, 395380056283293708684259653833630416, -7986216371579398224398311509800, 0], [2813853597221367942147605714886819324212, 0, 0, -41246455524350849195204781862208], [1041814356931109227957807444854803958770, 0, 0, 107623565787008290553804531699968], [-4084350931703665278087523236454827717520, 0, 0, 4209634469599560714823893702912], [0, 358231838163779341872001274391117680, 27870734504833497783231025845000, 0], [882041008459046837733523042028844410174, 0, 0, -174621210229789221110499832131584], [0, -798038958717507636842483471327547034, -27287734893710521123158055559675, 0], [0, 707667131101915128669844353999537120, -15337726974910986299957905676400, 0], [-1341298783332822968020904397913731365320, 0, 0, 111132485119025270344111224556672], [0, -1179787034701192249429236661165272720, 21196269155543878534778569339400, 0], [982820698627216947407881984857713464790, 0, 0, -101714462078274765941003973161984], [3395937118627189292513597881541768370044, 0, 0, 136892332873798465973535038374464], [0, -227701796449829269909856085453396140, 6447647073237921642594086792550, 0], [1456461125485276708049698422366142537592, 0, 0, -413864931310872329753570025097088], [0, -801674223220913393764980845091545890, -11778838501205193070496189983575, 0], [1113126697102321014310575707597569930886, 0, 0, -280970507020367581025592866265344], [0, -184126517898191478221487097470946764, -609317491914471080945859175050, 0], [408780100355046472424792715193712033900, 0, 0, 364532983755905194532451369444160], [0, 1310273631341858946777981166510873972, -29580417464357586184640204631850, 0], [0, 172267899918944022929636678847461570, -575212809278146160044399500025, 0], [-2404155988278746104827816895579778745628, 0, 0, -525679057598047055934420832139328], [-1764964828680289770298219472091691178230, 0, 0, 461576512968091299034676549394688], [0, -215269970234923898765477417525719660, 15437192888113793692527267290950, 0], [-1158059125925469079444785073196755119880, 0, 0, 619254888794250157379139579084928], [0, 869886590841685178096582884670984760, -21350615081418851525002716384700, 0], [752394067981020681089660361598657591490, 0, 0, 310790163893877060056578069782016], [0, 1010193575734540239492088349878740526, 1780221977261750996633990210625, 0], [0, 5868743706080376014361395827267736, 21298271838926078193530641111700, 0], [-4867793568250435691039169935196616869448, 0, 0, -49823394366308391446119508908928], [-399594527378135130085304205897830353690, 0, 0, -899720652097443395593038612071936], [0, -365893322676893809515125878912149390, 39993341433019503031459045160175, 0], [0, 245247577372569493996792931648915440, -8371721321103679654524381951800, 0], [-2341265377484131890564388115050805513020, 0, 0, -302173691382939905421987399130688], [0, -1258812160839111384521823911418448876, -69527713248118929826959016608250, 0], [0, 1425266551071813118765376095238891264, -57884270317750799005883354851200, 0], [0, -209593984645253510208222231079156330, 59116154455076842824649166519725, 0], [-8353118943133471827712598583831616318210, 0, 0, 100854568910280886316540372073216], [0, -389655274111447975533615618663241344, -25811170334951082650324469688000, 0], [0, -2513621880653524729795967336539540040, 31109322052111496778245796935300, 0], [-1113126315092195243205975656589674240470, 0, 0, 967361267280249243404180310001152], [0, 327478670783245106782116224833310162, 70878950547919493204429602787775, 0], [0, -204476263104875165157301250735519848, -18518709098875143120769582731500, 0], [0, -825783738274667348415745330163934120, 65130698018816121311645752830900, 0], [-2756183195621624902463415994651586130712, 0, 0, 1143504434734996920321136595571072], [0, 1207799727695533689763238104283801200, -65020318062550450168549261563000, 0]];
    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_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_9_24_a_d(:prec:=4)
    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_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_9_24_a_d( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_9_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,24,sign)));
    Vf := Kernel([<2,R![78875596800000, 0, -26332200, 0, 1]>],Snew);
    return Vf;
end function;