
// Make newform 12.20.a.a in Magma, downloaded from the LMFDB on 23 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_12_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_12_20_a_a();".
// 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_12_20_a_a();".
// 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 := [-48288, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0], [-8640, 17280]];
    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_12_a();"
function MakeCharacter_12_a()
    N := 12;
    order := 1;
    char_gens := [7, 5];
    v := [1, 1];
    // chi(gens[i]) = zeta^v[i]
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    F := CyclotomicField(order);
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),[F|F.1^e:e in v]);
    return MinimalBaseRingCharacter(chi);
end function;

function MakeCharacter_12_a_Hecke(Kf)
    return MakeCharacter_12_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 := 20;
    raw_aps := [[0, 0], [-19683, 0], [312390, -1], [2333552, 39], [4507891596, -2146], [12974075750, 6954], [-165474934398, -153842], [-777899556460, 390678], [-1477897094232, 1328782], [-85556481109794, -7636915], [-219843102023896, 2126763], [-456420877658434, -151286928], [-1019934442223190, 349518794], [-2803561946993332, 720464706], [-360043315643232, -2420612598], [28491507940995846, 4734419105], [8979601995508716, 4473996424], [14622235580907302, -3856945716], [-18555297284623372, 34561414728], [-302251237170952680, -79972862570], [-329831906607582886, 67829833008], [-176020869989194888, -354231591753], [-1246451794643165292, 358109982582], [1261864300035059370, -1385364045164], [8623369287414429314, 1139749767492], [-7474323195049324842, 713653601401], [-623062882977526528, -4446904755735], [-32444979444750413124, 1038490936340], [10391840359658288102, 3691540909422], [-35110778586629939406, -2827834268220], [-3713720596945566568, 49068197204481], [33580673219626276212, -28721830574320], [257855442518063812266, 20719644075614], [-31580913325000276996, -53210568776352], [428267440621616839542, -97753367615873], [-755598350457250343680, -48405885861465], [-156114594170834999386, -35639463424032], [-1045351010259025179580, 100386925294818], [51780267519505275816, -272891884398840], [1297490288035950794142, -11879250222957], [3659504311108719351396, 192141837679064], [1485228884509453347710, -409145718509034], [1003731002377899479424, 619608446519608], [-1788238349256445643518, 916483500935856], [-5284826328306972927402, -1058560850593043], [-1712806305966951698368, 251419286621373], [6899679410456368571780, 1145589649982232], [6850413107851271842520, 1367052439536981], [4986653887457926915140, 2593061748133314], [2681075425653049065134, 7879101205479138], [-21737789031487485905190, 199628242008884], [35001957684513362252112, -7926325237731852], [24894087984102192841778, -903616693696932], [27310400587089952206588, 14112465313558430], [-19128703765757122021374, 28269089147476320], [-33696409525511761741752, -10934404687856624], [65937749031134163778734, -32428999368235795], [-89135509246747245278776, 31774396089210237], [68722551464203803824414, 26756688257033670], [230148854784166402854666, 6878602683317360], [-220545729471559275276916, -26833034273763744], [152900877391432396394454, 64484759705762161], [6332101612681387292516, -14919804196538904], [222447689518490646113304, 82701567715784108], [-16058329599269398614358, 35637241627168896], [-330642570200080606396578, -210130939336453271], [-213746995015555164676708, -161766782130682668], [-45398761778374654157134, 169401746577844560], [844737720061596230319516, -398902766376038106], [1350546836315945786845574, -59052784586442036], [-1292704509877790865022206, -189476574789631132], [1449144215208084617474616, -404190842379972810], [476375498093324834190392, 315548624656816083], [179032126191903846144398, 17197543306827780], [493089152697965267446652, -764048646071270826], [3343146161673114457150464, -399438294307397728], [-1158835994161001120352186, 99932561346455071], [-3086388134686605659110954, 957357998188349364], [-6101499291022123087406814, -656961505202047750], [-3129781073587910188757206, -1222719458630271972], [10277953669835999192283588, -33300503888533206], [7531573223114238276997070, -1439776444985780298], [6608214493218542364234048, 1782958159326328534], [11649342754338405820503122, 1254287521369987416], [-3785037290280037565033968, 525893371435113201], [1508717226460774430183292, -2707808140746138378], [-16240933073270137173183918, 1081013940581030262], [-2056210886824038521849350, -450142301472364620], [-10092765149488064037660354, 1694001936982524107], [-7092668019410068408304056, -2098456487868608859], [-21103085849308642914237324, 878886220477647434], [-5197378267276390880524944, 1726592873735498406], [3613539998060253166175504, -9212111417922031569], [-19820353194445164412465476, 3552669647925246004], [-74042342476018120966684, 16482819807847980288], [51495225464487949533702792, -1394585356329796098], [39492713288027847820711518, -758116270471940191], [-14666111214914305641357558, 6328214669620242178], [-7759800038338412795454196, -22441327334547984954], [-73835084976851498140274122, -2658573693892915962], [-37352333380073327965377436, -1435941711062235234], [76557307110942841778380734, 26925834480688315231], [30343099366987405103505780, -18609351730502812890], [-32282354355663758847451686, 38045899561150615498], [64588338792797798735307020, 32194641634392599076], [-159256037743158041441090686, -16635934255787544096], [76482057056387274281536092, 62387433133857803500], [-168166132838653826695544622, 30285407963476045828], [-5209486807274799332185656, -18156681099233374334], [208525370976326068395160778, 22769635471142222520], [53122256300745815282426936, -41421911914781518263], [155627988935902694924273054, 60132923934636150828], [-56739073072425093631574982, -65511477465859282264], [295288611782422548085103516, -71254584906403017384], [-412674942211106195953135648, 60640328432824765671], [-254607002999290090329626286, -85179557545979192530], [-292251414025451851808717308, -92411465231891365002], [-589452471366457141960741224, -6047085871449977250], [-78480101254546079231308002, 85064213789782185127], [-92707578701194511153297628, 88639403695485987292], [306758138952610927090558478, -55505942731916974800], [-348504513267839693229832990, 74463851601028043232], [814093463109986738049510342, 60609783594069046363], [-37861125996351345675792948, -89904172591671413574], [457348162741781170037235668, -30089073380760446814], [192078820438219393234714206, 266076918711827178137], [941661813096718775620103246, -97009233719018706174], [1234592886412618244901473472, -155425405904296551894], [564043272376937652852115904, 263439366220687298967], [-2555549224386898502529914602, 140520867722515297314], [-579687806558822896117594060, -332714022647622509772], [-730756025502175677708964728, 158143698541286887140], [-519208962531274643750853928, -616905228046562605761], [-1637249551969813623724914082, 506834118382786084098], [-462506255472516264370353798, 883437369567206920158], [2788728103365581024726236418, 392208210895953813288], [-1150890310708692701654070954, -447239258362059505227], [860522088229194042956417204, -560943283151801077182], [-5338157957435821509181964466, -172050112812826861353], [2319422703291258641054998794, 1087479646624806510478], [-6235583501613027107273839540, 291600435773399561586], [-4900364494666572919840473114, 1048097130125542137733], [-7679441997488338173832054336, -527725232959108831725], [-1161144243159764451673839156, -1823648462204422375748], [-1564736717709846857081263402, 1452209134896031153902], [879272767930349834665725816, 353535802530056943066], [590096900974048512728735246, -402832294131637560168], [4509326414119805894750821434, -1351371727092754158870], [1626175484308855635407679260, -273673883765253923250], [-1079211114997703708712423264, 1438975603451378949448], [-2015678942793052824215133322, 1247130186010420588644], [4999465655818048838383949970, 1415942413422555858008], [-11321296078532309649916434604, 281752636257960564138], [14353341699293601783595887672, 44711898660989658176], [6326498737463261954845816076, 4301599562426025848742], [8367891777371916008531030448, -836805730060345189092], [-3384706911485004242765765728, -1819088177563591149501], [3501962242858251551373053202, -1849990612200481398366], [-20630979592395562250346474694, 652755789185744017488], [-19662744737337695042362008930, 906619242245177575891], [1016388088380485477703650916, 3939530798344641761976], [-16618636784108511471400584678, -407888770839516936606], [13238136625308977143319860640, -2610130676502966640767], [-9087589393083697366848271572, -5755094399976486187662], [-13046426360435696901177552606, 3448586110185191947186], [-12147566274482654247951888936, -8661525507209150386568], [-15311684843876111659399984312, 9955713374394256851759], [36790675672152912807195220958, 4622905376386536491460], [15452189790246789672385896434, 3123100107499708126764], [-14269876979618381739145076682, 5846086683338222069099], [-14628386070907548479795268468, -492994822676836960468], [-5881818394949724937151098618, -11072812057730609954184], [-24856723658854169132650561368, -4754444326433088751516], [-7052285861046862162971067174, -7956178481162872017024], [-30640391060707893539701962664, 8261655932137372019619], [25885698047897696942461736202, 1279488364705664776624], [7317766878098816300138667404, 10329822257536804753728], [21542015102933729679862348710, -10569943576147256499585], [-49558265441422667452509696640, -2931090123296712110799], [67265833729841003237224212566, 8890869561778239718176], [27671284496557298553481160168, -18472017268923685485369], [77160305317396822685776836, 10244801600576366808478], [18051682485597435662456977934, 17186197050325674442890], [34594116156390078548260339482, 14378827635276991214976], [4820691578217684825851816400, -10128646863930498032992], [123970107302348328363550252950, -2200353205531416294749], [-21124498965230473861786787242, -10629037221923218396662], [118315683200748374621634975764, -4481765733234650123112], [-73440587479648746017899328038, -5144678709217666287060], [-31229485519100236544120046336, 17533789719041609721616], [-125457585209383138329276352702, -8692672663399599169464], [-66144908468641988652620232708, -14264123859016108783584], [-17067297944542371152459813884, -57271415960108686841232], [-97449397403727488488513707186, 43316106273968796691639], [-74220856153102469314540705644, 4854395276272273401904], [-83519832747792791822584296582, -30726672404264041146344], [-49860215882775215868082469038, 7126484095076705416464], [226754448305484017759681016950, 28270181975172860737482], [83441710804929077140599443202, -58608491409747180470984], [101723596817226225452881482600, -25807435268687478811340], [11839227091825849133300431614, 10908743513619455471523], [140859174510993654377562325064, -12802830589699419874683], [-23962637759837211174837411106, -113378080362794426270874], [-15139689713722416887529607966, -94443403084152105664512], [-277849130858501830712148718836, 27682350806263156699754], [218145394199757912466013512542, -33486074587761730227839], [-390574582723558988758317030184, -13794772346895218664567], [-26099358338934812924732166012, -41084047557283762236946], [-184964348397926274223403595654, -103082155491173030559956], [-38497986973256404974449688052, -32070308000040315459402], [7466382555665446911621916466, 68085811284693464085096], [373296703830739825787234492310, -26861611570045775074565], [-377046426369735091306889630032, -46997115008799018030903], [-66512108571561177836091150708, -59553390063557464743920], [121786739352637718431425349464, 179860778810407143949434], [-44550036723193341068967172870, 34564190851431247722408], [-192649588994213624628162369256, -125140720636701462719169], [528976011867986604249382565826, 73021508289231854493102], [543433223641216579779467997144, -33695740574947083231880], [-62490172286576247702505504722, -95255490786025708454525], [220038844377456169698416630222, 155562251138426417736750], [-630488132705867137104598325104, -22815882804488644648935], [-995579726386178656616582088270, 47539711633118260389074], [340977815765498777779079488712, 206565754051616277319533], [406034587160284761444058077780, 33261129443139700148358], [-1087400203634287018346145608434, -167608337824893334510128], [36994906832195600556722868906, 129780330731176054069452], [-1024848981410014075559437205712, -35538663226428001446586], [-521364695406022841334881948896, 144400500677728829046045], [-251687327525738361774182823300, 88092043350956968301204], [-588311422188301279822159238362, -11289952059406056556962], [1633847096654715496826303589620, -1429737578246215174482], [991884057283286847600143582840, 14503575864267174604509], [127328021571023913983682953178, -295908234967997368217800], [613638971261240528414185262924, 165740355711733796769126], [1678401765351680742977639731488, 74105061027274062582830], [-466879161470089585870164352750, 258935781827622510985308], [983072936479387876146821096118, 200291891348931169113231], [-21242016928689326648047911492, 646911678122219679555282], [1622748425591079100176095254392, 152328228341158699571534], [-2200699915992695941502149444428, 216946359486500675625526], [-938561140711039126726945234612, 130934643331850269380612], [13588178737788266346933181616, -316815884172976450825953], [-988996872220902001343139651658, 375033377539232973293400], [1100626752849003767702771214642, 719007732268359529836880], [-210358984461873801038494355448, 699195134221369094088962], [-991896565765142284637169496600, 674189256841374804312723], [-1534890902979948383625480402444, -474347089441205355604012], [-1554883294788406186787821988740, -333834826154955651279180], [1894016841080941010203785380304, -796153985611052138962788], [687554404364501798778138505046, -474700076129896353279522], [626499275131312652643670702242, 311491091310686288046276], [-785265170869705086057027736296, 978157581211703347636198], [2176852232433642591557603449562, 133854187766307706540440], [1910747460887293311453767640174, 530536468496065776475965], [-3601384660590276518296845913692, 328760312482596726120340], [-1215823731841541238796447002658, -978288598449806674069962], [348697640379981843300769302572, 243572214039687586456740], [2670545815013372338090732689270, -485690412496739297850171], [-1043802441502624669163830544662, 423423009574886700574056], [-6162594779012244176874917420392, -260284012021406207063775], [-1540059516323092358591558892876, 231237459034068300799128], [4973315122443831688667719148078, -744252452447542174101042], [-690520390437936542189175421210, -1209982077476553615723528], [710077049350709195950723162962, -1257069625553755825887094], [1877147993190330262663844360372, -337382031041963306261460], [813014810476493053756283477118, -1205482183006014644039177], [1479892704866312848425163179018, 679676606420909564943900], [-101611993399260345679995835492, 1797324976799213466817386], [-3139774363199600637000064811514, -1445349225995966997315441], [-214328919708265738548695004394, -1305426416158521424157676], [1763808976014589186351835838308, -827268641097897180340068], [-1021022871284286892861066912438, -841736464358089570012224], [2042331881412188842395933654344, -432736574142219863834097], [-904683604433404072160086109230, -572662300211156537070624], [-9730594870097394077178613760944, 652040383524610450670577], [-4107716715989055220826301029412, -1351578127026398971939486], [567368125051757042300399547110, 3069539052168280786670700], [-12199125919970665510467220805542, -335075338706049419681016], [-1418518354137410857513345124508, -2287590953881721546288204], [-849564468825653800609722961488, 2219814608816926081250342], [-12350711362586570022098416402048, 1840020184197874994993649], [14573110972117158381967690284648, -1091238616279916212686838], [14838972753374697597144066438782, 1377072766495259448327396], [-17626852407127317784247325287572, -1141278718389130186570350], [-8717508163366787890879894490832, 1014272215983852660368820], [-11543615636987803782047106629998, 2616461706528046394130516], [7948129090193578730647683432342, -45560619875867841422285], [17505158723071988324788494218624, -1092065713616631613475601], [5897776779677100154051302855426, 4848343957499264264971812], [-8124048887554567477456836304194, -1881904786215099447181497], [2338828550529276301468497455076, 1620089605312242859471040], [-12386395572397993750708097214390, -255067713504277408492244], [-9217409381871698729050324113924, -4653829850128629942698784], [17465962188257819957029049823734, 1060816802946795566086896], [-2229380315330082664960862434386, -684535612475514234281093], [-5750608663980338490541828069960, 7354412628468617703312321], [-7696819385104929127654767781050, -1690832555680008874581383], [-22787884104685937400051984993444, 1839821724027047880318186], [14251050318817589436735162935972, -1974711385144668030610134], [-10209259846430719386556018526566, 2135582469160101390364728], [3781870793756275422200699575134, 4586260616765432170646295], [-23583870010274602805232440763688, -5182699679518101316628949], [15127585541306985286819568326788, 2805146569734174221879336], [-15307929942609001009786675086724, -3646016739664372420605726], [-14509559992891456689250211191294, 5759106679535707283710428], [-1198994385610638971057399247252, -11808922272295927145894722], [5340443239324444818884872711430, -1217251293732920375195526], [20865313849072630063637226419496, -8963273094797442217766630], [-23684815982865225691176432417154, 1364599320446928572088108], [-9986178211104905922986624296368, 6267817855169991780546536], [-21238446615790053729541198282650, 2532387706007593987840089], [34280321623037323562227378406130, -1539176139178544322481194], [32746996825570052026074369461540, -8015231769176480797453674], [41050580409829892511081644826888, 603954408544185847670764], [-1186178377947966088333452387718, 10770775711123869640426968], [-6044122447038131915206453262076, 9709735656249322790542580], [-16839068672972807285371431666192, -1649302418978302326900782], [19252428461032678490563127403650, -2505387317618476959379920], [-15843853417300417816166281423086, -7882855313600394391619316], [25776768365252293142212578522500, 1437980708843476957732248], [-5312120804282340728758582529974, -488831491712195700208104], [-49799304828020292490051305839586, 3567392919001086867031613], [-30725426345617423962479856651928, 8950049303960458682941995], [-28290054432784841294827901263254, 11425926417424634405316874], [31042378936860045906269738653874, 781295357266567436155044], [13405636343729913979517146131716, 11271788459447818883149926], [-2743742942209248072060486981124, 1191347112209376901557546], [-19511231853919463813367849443040, 864990528364903787262000], [22445640971629362804730573822374, -4469118945413614148855809], [26337798660335818020564010938854, 9958516407528693872209254], [62848813084253357324148024337422, -13211224948484969305004885], [-51804041150064095031473016443464, -6360218114753514122161323], [-18520528439926474969792648600620, -8848726270040304921175764], [-9900686798516305898885279975812, -11706789454493500668171528], [7104878839637151075788691341052, -7080746690515882091963590], [-29196072107393235472009726594138, -3544392153649307942159496], [29549444397923390516931526403778, -2909283417613962783366196], [-9758531612766436709793859670278, -1332987321971933235216648], [-39650858607270617547884944354744, -3455929721830621400873703], [2671310257869038930348257293422, 34882186364652836130887688], [56237623614759272883879399169050, 6118082539773632114288186], [-115541626426379537541192002152458, 5496251781871534301410305], [51084014380376201295551708104832, -3457353056602223854494627], [-8623347501055702405083902976258, -10096804833068077921132295], [-11656072918343193168534177356892, -30915957659409165601578034], [13242602552182167973903757039342, -28283895213741124210271070], [-117489017582441901290573154100612, 10940902766363451989999412], [-1803435792107277836322004076640, 254377930366259105413786], [107825916290413934594764478307366, 21193320495256240864067405], [159939376758040309530988493967140, 12854771330578549930431498], [52380094226185508395397222801402, 17310700565901018645854820], [15206035848453518229841545173646, 23723077809849158110955209], [-2743309645457220394302230404696, -26832212181542440133770023], [105403173224522672645358636132110, -28641680424440434047633768], [9069986068880334005247018338826, 9751894490799322704331736], [-116572660618690186682695005543552, -22221906670029931143417060], [-11740168825356359189089801781892, 42354004828191821115645868], [29742899744205062950873025452770, -12841236433180992598781162], [10656191269001823664539216842136, 17671433939657227984405028], [-143206087587208804572268059844834, 3133719848916120111378216], [-111780553203441873028663487739846, -40349887065746458615414636], [43557100226031544432303539347280, -3807559106001557795745480], [-217314209748886287291909887857092, 18076827934075082733020266], [-56371342734216339610669543086220, -25423603277646739620304668], [7665668317996590625971086357690, -13864501398783459140801448], [23355674867630068309740093113934, -39243408001374408178738667], [273750443516911280110161389501264, 11872846576193109420672339], [14990559783525452516800416694730, 42323994546604733134335696], [314510111184288100402553248622340, -7044131469506926667681926], [6604598499744763744219392154604, -53019093518169481704129882], [-198072294346439121101441538337488, 16337249386464882653528600], [-33116664590110252624237289115642, 7394199914560537947614473], [90113142594763549658326865853152, 54488238787567820179452183], [223557992568067004465074261620470, 30213618161931755978947026], [80290689256329443558138249152596, -80349510106870906984547322], [-92162947712625242467975973009952, -71909496668032997490130536], [180543415644171707120473788596834, -89014196458178871383794944], [-25835310368418449630698189959870, 32786965373857826238998722], [-379853010879322597964903589428470, 5897016533420872577954964], [-89568865125177028666886396998386, 41052727991508128804578187], [-285595578117686318921857933571862, 25795413185876488722397102], [-249764866983463365110534358576448, -96498199894478807771528793], [547247083028989813441837680667554, -6248798255159607369037424], [31539604838027319884573134497956, 134595940970050788247763550], [-313316704500836050211926875119064, -86205390933950526686757104], [245921341170052548813650965321688, -14893739362152204153432561], [-163924880763279511021501017896002, 8304008198895257181157110], [-385312513716219765538323146985364, 40991702127198308173667328], [79120635915494968160433374599056, -22061593712303208173491290], [39653983894830998665485313667906, -118404658921947895485303480], [-212468835045077474055482142828378, -86291001781699920699498173], [347874657247418622814708887126780, 47872539416040124726138960], [-40879875224962037228132187675436, 64406081919822064021779582], [217343251123698324413622314777400, -98624704849644364456664604], [-62922463098399550570510865252374, 114281378264138986861334244], [103853551175587035811181613637880, 180182905777512715248309945], [-47504138717525055247162082230614, -136401510593555417185659606], [207547246423623455193316193518892, -129144871434378126169724778], [-96431940962249316889957929163818, -89198256955001958857323729], [213641748128337222087291690727142, 122564752397922014556440148], [-188476258667179128524930350037070, 9640912879622504381443594], [466659170354978913604888584773096, -115707268666534348115343711], [457169942538758982078760896963450, -43713808214366476774079214], [-90636738405992747545651640242794, -170897302202332005095472975], [601964461820934532824380902068464, -31312273461565559785029981], [340894326255927412437711015584486, 55534496599530872726939646], [-306513704225954432012146516581822, 81874953603609242298258842], [-335676774690518027509841973113356, -184603262378952700411578522], [-238556270127722489060839073714556, -189398601524324546362075730], [175947170441513091361408664497394, 170812943340211235167539552], [175114001647288971019850184712278, 7374819932666884303499075], [-962650009845818457514165250007588, 30603666165405546113466566], [-204952407192996420047765900522620, 179881983066402390186878634], [-186834270446227017836257601226310, -6986805944484647721277032], [72971848475840498525820253705230, -128278368608205034498724627], [-271037907715613157551004785656704, -190255299473714956284760], [-534107638639903970827092087857776, 87953909988278428433493531], [1382692985787873087337046629433634, 2867291082637297372501634], [-586134064496953066092662806278264, -48221277120002059970098150], [370682111754331196609358965480814, 142242788992134714347129627], [-447680300106276293017542697713922, 115239963673366455003965136], [215727600355992021886820205154128, -227164193342572242780450956], [-484666089939803329578839831524452, -258030224311816903495256214], [-390793764098394311075113991797798, -94791836181466461501614376], [1210065386335650168749576355086766, -90090857524937880828741923], [509348959270300794764107161892404, 18673871252770708774825610], [1024288997954449176291047929002, -325160460117768724542161172], [-556157522455768607797122878354020, 27784118585787832745899974], [-434867777885583446108757102058680, 190583613453096241675364782]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_12_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_12_20_a_a();".
// 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_12_20_a_a(:prec:=2)
    chi := MakeCharacter_12_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 20));
    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_12_20_a_a();".
// 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_12_20_a_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_12_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,20,sign)));
    Vf := Kernel([<5,R![-14321206676700, -624780, 1]>],Snew);
    return Vf;
end function;