
// Make newform 48.22.a.k in Magma, downloaded from the LMFDB on 20 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_48_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_48_22_a_k();".
// 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_48_22_a_k();".
// 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 := [-70812, -53560, 0, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0], [-27422720, 948864, 768], [109690880, 75264, -3072]];
    Rf_basisdens := [1, 11, 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_48_a();"
function MakeCharacter_48_a()
    N := 48;
    order := 1;
    char_gens := [31, 37, 17];
    v := [1, 1, 1];
    // chi(gens[i]) = zeta^v[i]
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    F := CyclotomicField(order);
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),[F|F.1^e:e in v]);
    return MinimalBaseRingCharacter(chi);
end function;

function MakeCharacter_48_a_Hecke(Kf)
    return MakeCharacter_48_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 := 22;
    raw_aps := [[0, 0, 0], [59049, 0, 0], [-1611042, -1, 0], [-90477008, -25, 11], [-20398219396, -3842, 416], [-198162067474, -32706, -6677], [474939839778, -258706, 96866], [11698275227268, 1737246, 107426], [31637014357864, -15793522, 1820478], [-1097578327023578, -102873171, 20187574], [642886046483048, -232310605, 6305123], [7395091687227574, 266214044, -544654759], [55798063961323706, 295010730, 751945106], [-23182538497120836, -2529920390, 279155250], [16370206324631584, 13246829770, 1563213102], [162797113982359358, -44307999143, -12036406074], [615381602048496284, 10719102072, -42546775788], [2727902485125824334, 38029614744, 8797622009], [-12479645194646343388, -498925457672, 102579523860], [-21955081267812597032, 191667091974, -142409915406], [29471821831390618282, -1415921429192, 159635580038], [-73793718943275133640, -249240763601, 864676356247], [-101733638042376651900, 773807829526, -858087655964], [109185486032927678490, -3095450705836, -1901985488876], [660014388924788363586, 31914611948564, 3277635789560], [648051797631160994670, -71362606985103, 5723356231362], [-167337787583568935744, -48226934491895, 18490420302805], [510025585304800677484, -31847875005580, -7456082242312], [529177512077538363822, -3983493353486, -17180390295497], [-667040950047275214830, -43973634682476, 22699718785480], [9432668950048261717336, 117632276416089, -62324602125247], [8407565298855415246244, -972284848638480, -6769151579960], [-4373406182924851277702, -240693025750274, -150760064302650], [17129885624312196300332, -121957972873744, 285672878249484], [7849748654812462800174, -2676450466527409, -521247704208616], [8532220101358403994944, -3223069212145481, -184172566995285], [92281624158665710617358, -3756974119748660, -207211054572247], [24185142942171825442356, -2091028357765110, 900505343498442], [71278417020997976247912, 12176717700760104, 3251265173312640], [393316944539145539826502, -2245695110351781, 154230880126180], [108774614362249480889876, -30741277602737688, -2883905276339428], [663191689608265730038742, 13169744739564938, 1819641720646695], [344905127171192624714624, -46464436559367128, 3278746112516380], [405670807194371358905730, 31767455091569192, -9144313381153126], [-406072118180031460826578, 55964520352711525, 2237608621272442], [-268824015743328174509824, 24690053568965021, 10425298800674065], [-479524267320426500486604, -65572070821309592, -11609356699813620], [-3183420635558657698878056, 45758997692288493, -6813156082207387], [4481434899286012461835572, 972082305218818, -2841999180115348], [1387322224400289183533670, -343160172029545530, 50897028847654979], [-4444137249712131101230230, -97786050785086140, -4769316740219680], [-5801995421222089418043568, -406209642074174076, -117341315186221016], [5534554053163382682189586, -279034285826963964, -58899932311429022], [-3266370744463712937873044, 88586109091565726, 303365180210925712], [-4890074945593685873540606, 696537608538650464, 216286864724686624], [-22526350442346544205221624, 838815057605831648, -144960578437391156], [-18536383334530161120181802, -735883793335383123, -287171298882569398], [-40495962754218901967572728, 1181246656823445829, -42312206204749019], [-3886200342297973557121226, -2136443232735151110, 190530293003332359], [-44217543916207210202917382, 178297348615887456, 430506662857196420], [-18252614588174227763274180, -2213833225858637216, 238004752192113280], [-60216732245145982068857618, -601816578229580647, -897482582290472266], [75111313576568675590580500, 8531447984342118872, 1111318101050405732], [91301588785222686605488344, -3029718774257622532, 231155231375356552], [67261936236549426075593946, 3881796018599903512, -2735354011988501662], [49423467774447101315303270, 10675897875496128713, -299514207688843290], [3667895920875663562367564, -21955618476058570284, -1526577896290928624], [97397462952375821046731858, -10760085808253356648, 2666873366998902006], [-351779949410492714372069876, 2364502994182536470, 5177035581561471188], [31076730411481833329116398, -14428449161156066824, -4520721115668591647], [311362788090076338828419266, -31384661737014848140, 6322334930762368584], [-571336405090558991609619720, -23185098984227578906, -4423298631316346606], [528257033241495241487508472, 15299667343852292715, -991281503236090165], [-150471863650887977201032666, 3543552572540339568, 3918486508956555129], [831921201867547525883384812, -84221695839548191346, 4293291517353995882], [-340963223891262809590066176, -50898291208098821424, 4549993887564025956], [-963619468077018800746543650, -23153887422409148785, 11616143877913783956], [-2086294357489753067777692642, 4362999699399965296, 6220460290408930445], [-1339430130301601828275974462, 16899432800311178138, 591558247861214326], [-2289983506443022343217573350, 25593839040777998572, -7712895485350939224], [-3080337415783185495608478796, -53269260572806821014, -5252829587040037508], [-2619139115511898114646207098, -5810405593133850454, -22704485489147538065], [-5594842193656661974894653504, 165858492777127700598, -15075631899150419014], [1212364840585977063109663666, 370608074478659107848, 39315061741257273708], [-2182940856232338701188614576, 137742465844573906177, 1561337762291900285], [-3900010558572923010480491284, -1003784575547940474, 22646426494490554492], [-3378450622577586319776588974, -125025493377108711370, -11274570153860271830], [5385205995165421464755310922, -290955467103833287004, -32893728995987081816], [-269750135642087386436220890, 710934329610262489203, 7133367195896832660], [-4126203194044625216904014456, 331355246237495428525, -120994785959753007907], [-2606054750497936852369110044, -98916102683321312342, -12601056357662007972], [-3131124043834218623207509008, 440980375497787115318, 75403582993528690230], [-786341177505923309703964976, -760108210954329969745, -2284518532779275397], [-2442321059865612919076326292, -377982718277335219260, -108930252113434104452], [6525485200090700011493167252, -138838507265627720384, 288323608142079326256], [10012182201244919136123851336, 142509967066053605070, -240449694508476366694], [-39361027494359498365691245338, -173568430283256535439, -30511884201110915878], [-11441460779122227677628079654, 81630541158847430322, 570478170467252010678], [7072823912634251895889457404, -719909030973536845506, -549737300735499648574], [6083213700056760168498902238, -3780072488477196357894, 126568068611277657507], [4150634562535988694768956628, 3514393922259162389270, -427995079352976479058], [-26123299800838177041159276314, 1889056072351288490919, 774151171261532595036], [-53656863786880876605791685020, 2116080322707673484886, 38002701139432135040], [4450046728709313154147180042, -3475099942154403588182, 1417159807330417943738], [-34009710986409153535353942724, 252267636826513830836, 1240610628539503942380], [59104847747696834901047815170, 3504251838486158897528, -588963902507763236542], [-97214900968065036781668797428, -2083466525472987947844, -69163809913452205908], [25952328773665087822863882610, 35733649915283418964, -1912640285325556272376], [-82611925433256824499438518392, 7333100771224974087970, -1373578414276062419414], [17852478661782196381657701434, -4115463266761757485264, -155972474882157504670], [29826464045593685783211351544, -3717476698793939771615, 234599282756617670177], [-260488027425398268301096989290, -808190331024544760360, -477168850603135000871], [61824714699955282431279844810, 8990717917558180261112, 1777927058866267561604], [88238323415053060530873560012, 6195111723987032862136, -1389641848775067638872], [-5998752669410159703651200224, -11369269773154293559817, 285074362249624443683], [129452473304991235112288938450, -16386982062525894984482, 1812902197565277422054], [264381921648193425288967527540, 3920831652515827811470, 887238492356470222694], [184375814058939118108415596376, 15638509321364396228606, 4006226407841866043198], [-124661241316506499932537621498, 19837237728539960135839, 1895922850750753144760], [288179965917994296868825225044, -905688357946813120020, -5695288022432096055132], [-229585912432871684718397634714, 19484249865807748619340, 3096158021378654349293], [293076042986984228497869220130, 7143137727761319407920, -7673236407033592798788], [-238011818167046176715137026274, -23077724485627238304789, 3215547997719631017796], [116804304638163228320944251964, -25373386369189858441174, 214429703754581656044], [-311716822221253349531406038972, -8715700946394277858934, -5770575901198164324334], [619729013763557901713748418918, -19942572879704397176295, 5508750219366159274366], [-114674192142439289968525822266, 5501025046328973442182, -3528453297713738712725], [365728280036389391194417806912, 1608943808231022737914, -6661807389062585557974], [-494764819793930478317206871040, -12832799401738284149913, -14043588586657382999301], [-486152997729012628162424655938, -16183744189211511335770, -10861702099918121554377], [-322571141379978575214215505692, -7577894277176883017628, 22654664637515278797660], [942401324894601106920332951368, 14649648676121748067204, -15648079563012124497236], [-927721935021494827013972184680, 55748254234048750361303, 9749303260858356318959], [-1308628602774104454058598312778, -46172901744988181820858, 13373244980373957259603], [311113177493292691433872444202, -55385738917718467638034, -6277545727816014270014], [1232219918639719473095443608578, 50592013635087295789984, 5527823388989682221474], [-1515110899700393931393145276754, -68684525714948074919715, 25880760388046342455534], [-1513953017524675444301717434332, -127868707841164964998534, -29410175996270181904066], [-1085936773031534531305279082410, 183626467907917032730159, -9844383198457854415908], [-540384966882728236143495015398, 124585585619115297735214, 24303013882657147149094], [-2423196857889098203377610337092, 70261309256845193136922, -34766657195249280662746], [-976704435923799373019511167330, -30042012060482481314883, -29988381935770828293482], [-1527595173536557063875688491776, 115397331161081585518723, 32155420584126579841607], [-243440818675111505234082076932, 295608498836526414600604, 12662281855078594108744], [375620734586098927793901537726, 228428187596224151250642, -28771693178084857065769], [-1475368475268768817576721218504, -116939764169510188573174, 32613313333511615833590], [-111611156490707013595055189530, 340146102652286610869812, 20908331512931989612013], [1533539594513132331472937210538, -92448959333392203871606, -39588757542501001140614], [-69457615460613260865258933364, 285363775081739695064662, 20218885626865675641430], [-1075830796471125786077053534560, 190349925010698486523224, -35682735312749207941148], [375683679309629949610314190462, -462549412300271070093776, 39349658635135551805113], [5114397546948759308974686640242, 423688660416790861047768, -47718536811536297073752], [4211545176629934062441244009668, -826683896088561130041998, 66468716549056219991274], [1441437551631763429016535825144, 96146718496165508727312, 48486469334470821270716], [14169495587821710186615399316220, 261131405788277171586574, -24456016786888437669226], [4304830079504956817204823738800, 23385204519063274582764, -71899008486201865930896], [7832018693381338654172465279456, -523812794305077560387917, -33010473565060317731537], [-815465116870648471501020777262, -92255386468960236062110, 202078825944878202224014], [-10782022576408195975811327985846, 453917497106015162677008, -19735382415550325383200], [1733411917675708522158974258246, -899202991066021186526853, -94245181852423532262772], [-3874890281262477800803177552364, 284640366421212586324104, -100443093266456447284052], [-16915256315324379938718312713910, 476227247529730021381170, -64214893540745785981242], [2606581963004285602148402695776, 838399363495822785503201, -273745251720833639746395], [-6543457318912023862815889132132, -999046325470079954259838, -26521992683485374413580], [-6848056713270151657708375380670, 1497341454163175454906514, -110388646231140117379154], [-13732899517722078408203375610216, -650904161084816520919224, 77576291900608286399988], [-1535223754835531501881014444152, 370858967933216072641175, 261640826137885172120439], [21103728674315710708406416032214, -458242694393807652975840, 175951536777447941931069], [16145989489065846701731074785490, 131634157724613637617244, 10907690826772081140744], [6304759352232291127895200823342, 1886099922772747171109723, 118105155414971074263848], [-38557802673508968945314778841156, -977597069679894160817668, -130941205497293797399332], [41849787503492047975120397902638, 414433097456560285262692, -156468254599582398063943], [-15442132781831414432255039582872, 792870468272439960318692, -309305716116766107906508], [-3675182320406624558190769960022, -2338517977818224063109504, -22077609382268767601472], [-24954122374804788897475584597224, 268910245807695466654107, -32154289463327858499189], [-51888206241867151253041709504006, 417271753308234863618560, -126335662836956294756276], [-11004683645828125194493801880004, -1197555196110028530610432, 164679725836259226509136], [-50131825674792896256322520789378, -1597309230510716056154945, 19374631048261164284136], [1980970891624445756099228622656, -1836597034215995076641839, -372273049032097076124371], [24511959758419519658091546712414, 1057277609009468739136732, -507878306521807449823067], [-20105194818004805650917709185752, 1580436860709641640848655, -668713180268135090100705], [-11218528102726252174225947996620, -4294310121211985735282466, -361344486613498057060380], [2723384431578703121783415363718, -2497020090117782382947746, 284217292803214273459847], [-83552369204561597872988062845334, 1433674417036040402999920, 180829085822138441899156], [23633954361173138420394621865680, 2863083862904995902789232, -1025997631377673436964196], [40287525351786979240459352165710, 2009478043031491454504979, 248630769499570858003120], [48141439860875295506925511073022, -5013245671837705433062034, -338128339249226776875185], [921380892515018391925623394884, -1056015498629707977174664, -206024202715237457579336], [47053444897107640962153169105514, 5195571508913657018704084, -1145377533755108226782022], [45587147026130213088425647061248, 470754047765222712466032, -1635253027878786304497608], [-25276138778614517810652797978046, -2928034665920042233250648, -336526063508915758962176], [69086165597642054870934249517612, 5099238570364038738828784, -90682321355851180370052], [90238121916390311215539154490804, 3669768639447603849728752, 915944748160604941169600], [90832320632346049449563248498518, 1070966703671289174501951, -2615692844110968955641088], [-75754515884283246439798014911036, -2361222571256207322421392, -1350366649323193692117488], [205635997531066373302243706459530, 6137824614806661489963560, -1104179860556521422514236], [33397757016879493034703058612146, 3067734468776798023634600, 2450234352931414592966610], [-127643805932230785638821007704354, 5737774371197822328309102, -718772497118800724204561], [90057562256592008487350559124098, 806674378042180456683048, -177921932510690183141348], [19568182549297083856360065681448, -14255249302712459981055676, -853494217816345681395952], [67012857836720317621323235443942, 3713438922957164033053019, 1860579285096869790945008], [-22297217581453221846635764572280, 8444214146504764128612813, -476591922304947420253139], [-402335506653503130525638410440586, 6959570744610706242761354, 448855234690216913201467], [-134700350396377329127124733953374, 15001194583728462135250856, -2397845755735671411461170], [165634662569137323401144403175292, -14511526977232697828685846, 3090455735679764224916792], [-289783412495586093687774679823898, 18089876037369103210338961, 48888465067259928079178], [89508313431959449917875978862488, -19058335453015764084630207, -3429507436488906455190431], [80813120596642196207702674886900, -26301721159684052871395138, -3493881761188594593573008], [196351631808978820648019942973258, -2237851912690928431887748, 628846617726485787695528], [-220203363069658545096179608223236, -20543216645393688500895394, -90372336958819476471482], [19035936014303916999666424005970, 25018174364841673335638112, -241032266819400888855518], [-31297659618314044820651339191346, -17843315198196579853042373, -2695932978832122816303396], [-2186741126059296507668521849872, 16968928057812696465788825, -4227852552767707374943795], [-62970761502955674517900905126084, 12507269561726284958238688, -6749766812470865818536836], [159936795559561617585896015109144, -22191351883592228737273782, 5944774270984906849531358], [607020933415549921290589643223818, 17829524909902147360987288, -179097465515090600374468], [-625018977595604382200250769646120, -8901714333843684115449001, 5804543215117580536349791], [774623429048300880301885715483106, 36171531217585650875103934, 7701375675840179380898950], [260469561532647573759576241192088, 5541975653242018915241368, 4555347121019876124708688], [-746177922742087001272021973703626, 4048666113835201070028459, 6816124542516954239367760], [811639134457110769832675092382214, 30232248673216760812369330, -5698217791699041785772453], [547449815378247720744382556056272, 38534126417233903097794057, 6782843600927610550176029], [245368395247439949145369014021938, 19840496136501026599725346, -17753231085825010228844006], [302201561487596496520720695000072, -6633849017671411488007499, -13489369447713173340013259], [239405167082498798398002668750404, -14022126721732377572957594, -4610377392555159873926124], [152120914809943278657153877203558, 15881654617421926673629804, -10723487967592502808592755], [-328163395700459871312925202091366, -41482323488757289490012820, -1614132969956756992929516], [311580776693587704190384863672752, -122671969915366118527689162, 1767167226502348347351422], [1120011625825056009576004524453088, 3775993524261633744806653, 3382477873336640978716377], [-491334919126218458904992933053908, 46107440725608885277328452, 18687609626251323670282260], [-1971144254365459458148995852434, 28780078988568445139088834, 17983825367162714129090911], [1852020876631617525510216658682852, 22399338111842406231148262, 9782350406498632337008678], [855853968974940618741612411719224, 101349826968663011424267925, -4609062439910699823388963], [245538376017679265170708879853098, -8554784797098928975806840, -9953805334945557173843436], [1729289458013899362634057685626684, -82272421835242556828474802, -2580511228381489429031786], [-1214071401220667274240452314470496, 21332934563836460257497406, -11207610021312048402505722], [-355676805150588224417084731363918, -6770924223437589221371476, 12298680502017274761046992], [-168452962710548713252545372350226, -11304313885169388390480225, 16992210744159827562104312], [-666035934595177571618959229527636, 34528217213611955962745346, -8745627640383376889501564], [-1942727537372326436198461432531912, -15495576314011322102996850, -18508209694285476603505386], [-2971368214778646039961435298247260, -21927079145046506796038426, -3418938228844890858259296], [877048110943369564664756523749756, 164326728560236397071672900, 19559616377263913756738064], [-690745096120880292203297819859088, -53661931876877287016060641, 8589060885884803971183955], [401914260277497278322526399239294, -130008180855079428920630748, 26785787652757505385410177], [-2573820708920712765806985305992110, -100610439588411465796778432, 32093402420291044923352196], [-1995102961725516430841606339178040, 22045473133044912597207218, 37746185379327895125256502], [-1914007984609836590111119310506200, 113009130893234652232466043, -37548193367961011328785885], [-2642913809035689319677259480975708, 157873831062625021497123316, -2914495896613617648097040], [1293977593373746988270513325674028, -100971511002613700755192908, -42404630466236704309016912], [1031374914005981474179807311626704, 167428093302090869582236316, 47430541920114960923762644], [-124977061727324384901419491822530, 203285864885838878334157442, -38639339206735991429994233], [-987756292568881970821458940923870, 291037775566359941776479060, 3241989635831830286601000], [546077229471087819027899913328088, -210746649898560218648885434, 4686219606439702186136534], [-1244415976515264684678222365980118, 191039063149658020246433400, -21545133476845160792896704], [1310034425825094512747027119284246, 69193901002438496898438861, -51954995894480111613096906], [-985284021303062098502057587057964, 233625340717500753758690932, 8841343426926816447316752], [1358603866710496668446223897149558, -37083676965797375075759142, -25163144188092552223146213], [917588844483627562382148697255772, 11053323282158250862207668, 42786951282452126176104876], [-483871762644955762463081257134194, -469542717769861913774852099, -9305617159324815687565614], [-2094404079846706657517669348393574, -276695157136080186186004360, 69836521550784985788493812], [2036518501494187564013694843372376, 42782973316700138523979289, 61719390463811783402181273], [-3024130041581030604928941908666396, -64781098568849346426724312, 106191591973650802107368924], [4668159765844752107113130995251622, -123421001699965155941518830, 22922672461319781557848155], [2036182929902105344223485173337422, -191573778208352446960126332, -32090058379730705374548495], [-1280670142635990979170742690072814, 63865448119845132404113082, -53588306948454724648287206], [1410297586672999519344797624048228, 279269026955860107385978476, -12068654710595281842407144], [8456358402719084081224968630862246, 539506395339396781683744543, 73641513336359892727027796], [754330113505237822793813919231034, -453464253038758418339934644, -16406813384644591541842352], [-507926857654110846547192215201652, 108818693753527261665864306, -70208380674122732759185754], [-2749630151660682895594935111269858, 144219397606125688227719727, -31346901782849188791865720], [13898804249695592899502732677242334, -25964726957702212944533184, -4393315960648367059577919], [-8288541385332609946448624163514988, -263371029595928243157269140, -67260342737057477646290828], [-949266228449820218529423852052550, -621286704398071365132396256, 10998114239028009035629192], [-13413628014105798208973853293631096, -373423990767036431524703241, 12127169591998426801628023], [9037975748882883164500171551112370, 27324350264340840118577696, 126668323873646153827685072], [-484818728115567421000424978295152, -57388908318401703818792159, 49220299766039395854624005], [168564131623785794054562991724748, 962210935681709027084630626, -6430160383863176436602896], [5426601121524116044598191455187086, -173396465438642301990199224, -104373215607538651253864219], [-6191765862961359227062866112873686, -610801420474812302398964704, 185710611690511737711622026], [-13587380344188561111745573211335020, -926025392299957318066555308, -115033147365228133778748704], [27195886728787122777389928720413744, -154119214148937682844066026, 19600699575321073226246878], [-4397613985336103004755179408975040, 856852085071452169882818801, 42130088572602710511291317], [2879974627499313481503544448541736, 657567970580818522139056970, -155441015000355177705575238], [-10607424652062253706831802946068938, 240049086132507317571367728, 255260117273295088332600497], [-2292371768563695768897504940685092, 188510471061356799730396442, 207121708643942167309004606], [-2056548175154121883403721419362512, 840757009849970803549012916, -16028325602991733268208004], [-23313487023960390470273002507524046, 398340766562270609360536828, 198783468447168482549903594], [-5967001721564264743446272620803762, 573424854204856147098795251, -13533650793879298701271796], [-14650043812685579701540127588319296, -1582810163073255669528435233, -105456436310607592821107893], [5363629178666738822787721144810690, -1388982252520814951029174604, 155322008315302543943957608], [25588449351625987615986334093183334, 812541831913629485368020799, 35941150966317756711421056], [-10229996857766908301494294497148780, -111522783530359807868008816, 439793372847334830935436540], [-14147599262343837195836740177436166, 865258224296714083899092780, 224437857426467242952671068], [-27037937466461235079778076957751252, -1163850365841528416459911024, -241314552211284613396341468], [-28025061233902975477796776096037186, -1138883370409932899991254164, -62520326970309230490086443], [-6173336466168281611985735038947018, 771387128968087658120380051, 224711156819496395073029092], [-26134365539662370528118438921229448, 830898049608468184207293433, -200500967739471173750060767], [-5785201415791118470549722324587138, -1865686437134174785970119007, -525030708557901785805680070], [-54881909211557678906281199070242996, 1240353150898857277769753674, -102492899680897492205355048], [19174551079591167824124320613783700, -2280885529363336817557184862, -314200334893674787019349690], [15299331200276716699019556679212522, -896242626900268538258449264, 475009868946093248624624042], [13927379312710342044465143350697670, 2335797598329206855055817327, -114125434131171714499051056], [-5815079238257713165858540858359400, 499236944625642285852467811, 302749815285691037303855299], [35408649530291061201299561331595572, 2883997012378688790699270536, 160548221272450866998452760], [-5294464702141320942056522375076500, 739135920220364964198719674, 666260730864089793683786898], [38479571400087149575967570073231810, -3998048145494195502486454364, 234297305685720763395571530], [-60595774363750313783116954171285156, -303049449497368003978936194, 438403461752627182419044888], [-18395034081640383012797217989277618, -1716832351355695021451977026, 19376097083104367623279999], [87628870328364772770699227923670760, 1045122095554498109027562282, 200729194978130282521263206], [-38220138725303987028539114314014538, 3062353698411525716253271320, -154454803028539378778846103], [26690308290494518601159033024805200, -2015068636536942459686182600, 33637743722043340101960276], [-68457240254750975854872682446934178, 192020989223275620235564257, 381236387908261398041337754], [26826849906625979990175837371830962, -1758923239656700157328493338, -357280694712122735059413578], [58459532436144633869902236005598356, -4934031296933567695966330658, 543210359276955982812943226], [66184306065025972354447873417067464, 2775623675350847372122114204, -240778213249256345450636288], [31816151868758174034002801355375498, 887390558508804710668991288, 257142238173150400089300512], [-85213288518594558760697542454016204, 469363355891891152448247748, -26384261356336785880922812], [24440591063254573105691622517813104, 2621904668310667227692233026, -743644406165289602136927390], [-8273923822533379188707681844291326, 210953171833927201101360568, 1147568708490000762163720390], [-84200889642294187123793248414638670, -217220088777143258777348148, 230667894618231746990803412], [-19092079132810158797697448577141708, 4005066943195257660342275576, 526490931193605129015996600], [90357732032933926955417151879232186, 1877940756483443461403284848, -122052184201064070891219414], [9623587432945640407887870812313062, -1817771812508222708525680227, -877635861005883369221526618], [-61375267656515514632113195379486040, -386581217133135342954588749, 530148761709320219891975187], [-7766693895819199848972732858996230, 3143294933522055617083429418, -913074337318096891043633054], [117141410096932857560141554869844114, -1252087029352295692522067308, -582567769215244604286789184], [-24294986653330312699569258668626060, -9962223365033527636995804850, -790236191334019491465581694], [-5567161270957965491347444099771412, 2307534498300442783211862946, -770016932648700881206549014], [-51441503070270794876770930644650720, 8936998541345448637046556912, -1036265527824923199622530976], [-56915579371013040587745280148366978, 6948477535222995606527471, 1220326449818764128851298860], [33611997886307980256381360050698542, 264399753542451965140986986, 1097939732335956571222040231], [-102867252920183610453718942924023338, -2511834918720282516099825165, 911144890694242679146223200], [-108369445365903228397912732543707272, 552334014742084804295063085, 1579082037000273853815987901], [-12832926625404550318091162676698492, 7354510890826784587045898540, -1979629933219254636160098808], [-96313911809619188127577799398761044, -6164419249293955334940064280, -1786122623672643891100617228], [-128938947433062355146908221699260948, 4033819998944443393625740954, 237001226344182093895076360], [-27251311929538297535905053537075058, 1022634505605897692189885508, 282527315047623444635537569], [-191744549236168186831323956592414334, 4982609493959393084746228684, 359731599298212602376760372], [35091994389057665542555821627798410, 3210525572158373787341892064, 2383871038288836288221925302], [6620966318064812091066176559559560, 14472611012869276267949471969, 278545728988851164768226145], [-169227334107020651200927906781793146, -5046311177340967217092494332, 1529979911850156176473081205], [198246401345468670487454640025206218, 2994638286158571094072387658, -382299612248643253947792306], [-6467554989577694373434944586790706, 9150776323642818793288141801, -3129801339722974813855694978], [-13608765161571529912239748288839872, -12441348475640200792117908899, -1461009311559169812803473671], [105869007892689540480862160342383302, -16068034746150260487137232183, 1491367700344518497258127986], [103093699914034619289763006096786196, 3279392075146344120183473086, 162470008971037128171483992], [126589528269351519192145407103779622, 178129960405598221382977590, -2243943767417219617608519353], [58578347372090832081133167933670444, -17636818892274128502396062124, 2530804080039099140588698760], [-119924935020153134063585887079530720, 5399335354941944102540724010, -220098629021229988235525990], [299516083574193371924698079221526494, -3634700821201481296475647563, -80224773437771072594814022], [192688059583724740146893390220589332, 5110876702697328358273508226, -32085934915785829664910522], [37880523119731735729277576241333834, 12501521622064104673613393204, 3537414521409462680010708992], [77838685734072395121661500965690550, 4856584172055927191094894249, 2165311817431235030976139370], [42071081803616518088407979937240552, 10343967267926673276978417185, -1284717827156887428494334167], [167892990642833406056994289992635622, -844558610834161875019987980, 1393952737076536098444637501], [121129243276169993885053871312511354, 21525721021459267466194141848, 3629564959635970481213494792], [194289493088050240119439581509268608, 3660037195680350851765005356, -260299261722975959636031440], [-319376832544406851849086677249037780, -4851310989002325883491121444, 2211423060283387379358395796], [-89690374631784425523774139588044478, -18839114792114726953382670970, -3588384189210401651366583562], [-11359857016589857137736041837831592, -9798856732384978292644000588, 3941077928084488048524618864], [174705294119297567319244888610237910, -14672445338327181062442390284, 2589266308856689156875045393], [149953224800960955670984566603139082, -18894749406043645980504422220, 1306755992229484535044427660], [-294223130514814175334480301262933424, -12037104168727583095122763128, -3096667123293062815432411068], [-379786278942376929454840781193105108, 19839057237378630252052667018, -1683641734121379471481297992], [28831471403563922398324744136226852, 9442481190092996133017160980, 2625194047402879493783023100], [-268491977211861123571281533882842422, -148179298101433440925890480, -3975668673183197491073871870], [269619124966515396615952279589595062, -1102968322139529763325869611, -1434480617196260946578712094], [88551596671349625017299999215025168, -31011142718438907177328248109, 2159362234746898349802398919], [-206278367765585939116248024569573062, 5816227918439860479557452736, -144655456546577143423056988], [-69945681290392054612130462340382988, -25780894710487292612852681622, 5013612658073023299317127072], [-294824903911662292399984847405612324, -1974329708810010368519772354, -839229117632888248938815990], [480408677905481535954414280667552816, 16749582057006968020812921848, 913303011248486219976166640], [9965880413057295256765560159182014, -14731648978798237969816504799, 152362761214571847149717342], [92601900548377874566734657134731808, 26178600074731439405551610567, 2151721091487691427139908395], [331839996479123335930194659330322142, -1359132140980116609897787850, -2274324453552255514723950065], [809331640058438872442669609177212484, 5317737471944178563255571926, -4943371627991717837303653464], [-403452857929043328352885088930871328, -5444034877967294771009364216, -3627695230942529975437780516], [289705089338902344780672288512467618, -51398849097917308899813414464, 3599799877804557750853304720], [-254568371848060165534633514511717342, -25523275543593162767226212270, -5218298195853332140851416974], [90721699641862221458012704133497658, 29637419949686014776859447644, -10391767776233463460545114102], [194551450785823817765991372480672726, -4032923253214857977300499837, 3461706612235486751258980836], [-601957795562889250702489083129417158, -34129155241382211797893901762, -7186037718245778469511943542], [-30010061441014349314460986310065920, 5305818086625892004755752439, -13040678090328753220743809653], [509087799443575983246458363599370338, -39372240086787329652463761872, 9527871651067885989291789096], [282069014462835177414705307699469076, -33591772917005112820998178922, 4221568081536353790080499870], [45874745823397080777956801675751656, -2047860739345230011264099664, 9553378981678159668832559240], [-602559742862187285370087603072309608, 54017787124489044151938330727, 1934982639503156678719023311], [406412696663862625009465907305500566, -43852036829785616715077806902, 5469728632266434550179374671], [-373751535019026810838784727248789476, -13120643924265370738287778128, 3216653995240777612058240868], [-593506298635465400321968238931112944, 56966773291263960033063137062, 3486556668513418698717287450], [850228150595127203742543008415134274, 14182368313665930411809140712, -13105062000404943631938888144], [81097409026273641124702540888022206, -35188334096591234709465712029, 14423130861047513348518665528], [-496175627730826103068035068859522772, 74775735601552766718548902576, -8040803864106711321667938488], [1152280277696677734955156858577379524, -32256633559666967140024187834, 385001225707088491942534786], [-175745436189674678531674542680024584, 29238369450142738966067427332, -14134904379032341835338944228], [809418258205235005911329229888769242, 14282499978773600189700264084, 213209815397950616829911096], [81683304775381273569303000629983416, -70377703061020561386207540335, 9916983092511516297214296545], [487090988334992932642785718084370106, 26534487371979253539477772634, -10996836302791416715517527538], [-358867503943332726176375916705919972, -67395347897412492358928614738, 1458771381328025638157111498], [-1022646591443822880572576434631466546, 29857837208976746690040971407, -10886187490728370966582290788], [-155278087150178914139951128565785842, -30186648028351501974556356528, -2558264440908217042578333779], [682146341922606302872308269144780210, -13702487982505355426356885062, 9049370121258654288879352586], [1107679485084106210857112834986377256, 16503227694752076498157415081, 7191757881197705504572332977], [-1014838962846034052023489038712379158, 70700190927081670387402989010, 2921791361922155491126743770], [-161724381536047815323486690791642066, 69907922302296855437110902953, -9592659503327268074546260894], [2289699551020842663111636744742168240, 14353918530404487724778230691, 2557042554043447018466970591], [-1848522929735626838291169943336473170, -5403139580878773208990089438, -2002782762507666332591980593], [-300516949431678998375222042601947998, -78984629783916390221373979910, -11217309213325350105234859562], [810596566853687507350601878970371556, -81027540831866518551363116722, 449468735236720587867800090], [1587733546019780797239621536654914292, -43963001416531855613981846018, -5714558339396504667694811120], [-331063673886979356778822741831501294, -47159745713555842699085211560, -27483743272482810093231858550], [-900727062327941275251628324608971890, 45657280898494699215765584003, 385209942205455849023053820], [-1764623162572806688840565703752016308, -8345628568173979717553394458, -10570918318477345141734693448], [45199563969661673428394341562850420, -56148553888916973043467697230, -9824248604494509617148435422], [-564309544686187062335749471768619318, 17415324066169528699438884000, 5388970783207229546868047662], [-2241634890062216523519592501674718858, 40608274803131354677190920749, 9266426858490817317645832786], [-1347890259506896906039545868710913408, 59043289368531308710166755928, 14873394027202158456698395068], [1552461474028340894622915120546404944, -30165652264642396213720456613, -18209579663451137799429083041], [-276569856921563972706572882373521342, -19226257787184953845975131614, 26158457583405566117694844398], [-743999563385655433080928038212698808, -78552324181259762572504934198, 35422243995894230539399858094], [-219355088530008610725780123562590090, 39223688288976063177868732643, -28960716478134577210617335848], [-1172535863311586307407340610225578122, -17840508568837742884105854420, -6726668152129380662322846115], [-1640574279389203904811721200158517936, -36918794933830761139228519756, 14370686002411877831791908876], [450123797186644694625662793878993804, -52204559944746989494901648422, 4851353333976465608450237156], [1963355497506531250861378979914653354, 70692549431137630195586682384, 17752901003226307511829483698], [278556901874490561717115119341440982, 17254928675994646791307708637, -6871023096749683173473365766], [655424522859332849949331498492350372, -162947297120715723818049533590, 35795751030988148876714834972], [1056660925897916430722491210136369306, -204861374734770396271366975444, 18078962791470255400194247020], [-1877222716485437771720200013769905396, -112325900715004805355410158386, 28529042687056696574853196342], [1572970099692131562713201732783460104, 54671152519501481496114996750, -45119882415076155997612879434]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_48_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_48_22_a_k();".
// 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_48_22_a_k(:prec:=3)
    chi := MakeCharacter_48_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 22));
    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_48_22_a_k();".
// 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_48_22_a_k( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_48_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,22,sign)));
    Vf := Kernel([<5,R![389262902874527045000, -396686171190900, 4833126, 1]>],Snew);
    return Vf;
end function;