
// Make newform 12.13.d.a in Magma, downloaded from the LMFDB on 25 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_12_d();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_12_d_Hecke();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_12_13_d_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_13_d_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 := [104882177440000, 1120796928000, 5806366144000, 27792635520, 304613421264, 2167220880, 881574992, -3551868, 1884069, -4077, 1570, -3, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-22840590467384822734606959465214349590226667767296000, -1071979554615385610304266799801938893533106380848000, -2269545278600290361396652335340983377860299889890400, -64525111487439317021755087638275680237643487642288, -6740713015943286970561242314360116125471783345240, -111605039908475583374551693883670801361112162844, -13502868196583347353290208301747829675040892404, -258457006128316465049777434157515519430800593, -11101300871054041928572312938753464059851591, -217587432291196901220982386056147124101370, -7114642949696409997171621646859023331489, -151094740050937523525752906039379058017], [-91913528808862718381509194846996940439901296912000, 1215926388566486029361458741447082022863702418704000, -24888926295369121588011776641192419857759496266400, 72757257843478294488828405121482712757591043689904, 466098203546042875733279487658227139836775530120, 210951988352186053104852385801407798541516668252, -965341248890958025718255498500276981364947068, 451166025245012761529797199141196860032411269, -1054534645641044334183949412734889830477197, 375939747279793120863793947630103998577410, -780148166215604727514801956405181837563, 239367239794354891619990725960300678661], [4497458590797280846062140230013121740154947978403200, -61468250518892254779488785961967608184350592077440, 324319077119669455587390368181502871111121602271904, 16636258185711100588602178655229502728739403328528, 1054904922134058625162609170562444759917125321192, 40285062582052487601463927649593725869927591316, 1859177337959752828360888178444112364991415028, 89697527393056043116246331872419169194044391, 1512459748463237929271490907425867228054121, 76115966582819713039999548121644330183342, 949001047824755292802489894217866960455, 49455115244800372001952745736563163567], [54773450737269599497744960805230636179095007874480000, 51579136621495600546821971417994789121385356539452800, 4137869311843609803600531128975866677947767934313760, -657659771732620601948699390952999357146513548515824, 4421244545551669554516849046715792438532243633560, -2087896772443161190056555647371626883941194783532, 31158581187559892713547529960583409453219699068, -5016621494399613215093629881225881464220849769, 29306531826376532139086538139443405451364257, -4238537010975938735966314837244992934500730, 19008074598575308036392246904064221311543, -2852282899170366663721924818313515958841], [-196855562385203799985900159739282232858827143235272000, -837333483100294505972780502786084783368188796910580000, 292028718938352099196151708094424850500732585376552000, -7322058738931198070609493538848564985934505890904216, 903891345873663241899436329560191830647026576276720, -30327121137309326259444306327936665433661542557358, 2170329425917276504626897865398485440019292897497, -54181929813441177162243688357150156348627909251, 1873612460415866906870996795568797727476687588, -43743367451824014452447076878159546325873315, 1191102626608348595218504011082309055615427, -24384648670564425576030765067619025255544], [1067659872091715785330538476143518696365663885863448000, -1258330353138007877680460665188295112659654698572000, -32035358580487404456600010130490352975567189239652000, 10638284405271270542511716419658178804960415572287944, -6774146952997158734638515681571784704633595921480, 33016423594858687745368804889001369598855580503722, -352850790257850777930876937556499179470235498473, 72408866694927506841360188079067731733690898634, -337266818732659090514716932037631415921053167, 60820595282194367580243859928111988578088085, -235373114060748461092546765261639838556468, 38989573083921836323081187567529180169771], [-297427363326901542073781982891041490122131965740672000, -343027946776392064904808834776804997900054804814720000, -16481181661846152979875667397061019821052893440588000, 12252939295802017667608331723425249928514169899538224, 63802490318338798780946795705038862862267542058920, 37180128195743566619606544096587220978249553923612, -226099184000896912447476555291890905947920643608, 83731455776379304676801347629741068490503266839, -237173677983432080727378018316218157668672707, 70394797533802716992160098503244537621536410, -163798256719055747032043360517664878396753, 45926502827901443956012845194884223231291], [5163214021114912153099707099640605232735390343835192000, 767941535971858369192038363939320080111545963573924000, 66085171944554016553690443971913200967207006203902400, -32882046871810579900115275086915829017942688895059624, -141191850456146224553738672322562017770224248368720, -100779711067010184396876033158533284477860624119362, 717662429805405679374629266582171478100068904683, -226316921318694820405107964529928412132985820939, 727959143122364635423861835481584864742543782, -190166211048428571032895673388746826861442085, 534649803896037388426314850438408728672903, -123394420067128721332764088410377381743266], [-1868125178241007909161020336151941877746222754554512000, 2282707195252996469118136429752320234994166100811568000, 115133386143160924234596613447658647303401462417199200, 91610816337484216630538179016289661872014334609135184, 894530890829273779616537255714788201596568710463320, 260727002530580847316730552722522085438513679382692, -355193216967387213817437170393511822383730486228, 556942453527559666303764155775395878588780193799, -636362118045148884225835795634246633368955487, 465223843358586989766994489037998439762553910, -428152177112126591605011185423011784078073, 297428468896485483237828102594968288897431], [3824130449036085158963485211917572282479114433910872000, 1511520066555465035100228381582590613035058941606420000, 178842706113201661240048682402067210225869649904901600, 147791319525560175797918307451215812068163201486644776, 1546048132295895367691164576671988827767597166117880, 423678867124308421000561378536682676625979205923938, -830307940796459625685598658012613420507085467417, 918551045308803365087801371813375186519946357736, -1300180050379524425793742639748087650547768293, 765145750888083558645058008119587323390956265, -1065019412117527127773228488301741472355222, 492251390846703729967719480568744673976209], [-948105914430378689936711961951358016882755410089972000, 246064752054734100047408708688566830281568608059754400, -55775731993395268295026140166964423717484364221448240, 10027493062622712291488376975338264910621031819703672, -91037927193542442339286196334887007883179938770160, 30997653467889122157262606811334376529515194481566, -459721085672662169905279280373525276001433039539, 64103827953624904220803503104631919913098635462, -411124769619804627435440837926695340503565021, 53216053514525798854285625700662541705113735, -277798578265254131120112102152481607612044, 32848464987461455705658399276840581549873]];
    Rf_basisdens := [1, 85412564654179115636848266501755459760308227280000, 85412564654179115636848266501755459760308227280000, 1708251293083582312736965330035109195206164545600, 17082512930835823127369653300351091952061645456000, 85412564654179115636848266501755459760308227280000, 85412564654179115636848266501755459760308227280000, 85412564654179115636848266501755459760308227280000, 85412564654179115636848266501755459760308227280000, 85412564654179115636848266501755459760308227280000, 85412564654179115636848266501755459760308227280000, 4270628232708955781842413325087772988015411364000];
    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_d();"
function MakeCharacter_12_d()
    N := 12;
    order := 2;
    char_gens := [7, 5];
    v := [1, 2];
    // chi(gens[i]) = zeta^v[i]
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    F := CyclotomicField(order);
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),[F|F.1^e:e in v]);
    return MinimalBaseRingCharacter(chi);
end function;

// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_12_d_Hecke();"
function MakeCharacter_12_d_Hecke(Kf)
    N := 12;
    order := 2;
    char_gens := [7, 5];
    char_values := [[-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    values := ConvertToHeckeField(char_values : pass_field := true, Kf := Kf); // the value of chi on the gens as elements in the Hecke field
    F := Universe(values);// the Hecke field
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),values);
    return chi;
end function;


function ExtendMultiplicatively(weight, aps, character)
    prec := NextPrime(NthPrime(#aps)) - 1; // we will able to figure out a_0 ... a_prec
    primes := PrimesUpTo(prec);
    prime_powers := primes;
    assert #primes eq #aps;
    log_prec := Floor(Log(prec)/Log(2)); // prec < 2^(log_prec+1)
    F := Universe(aps);
    FXY<X, Y> := PolynomialRing(F, 2);
    // 1/(1 - a_p T + p^(weight - 1) * char(p) T^2) = 1 + a_p T + a_{p^2} T^2 + ...
    R<T> := PowerSeriesRing(FXY : Precision := log_prec + 1);
    recursion := Coefficients(1/(1 - X*T + Y*T^2));
    coeffs := [F!0: i in [1..(prec+1)]];
    coeffs[1] := 1; //a_1
    for i := 1 to #primes do
        p := primes[i];
        coeffs[p] := aps[i];
        b := p^(weight - 1) * F!character(p);
        r := 2;
        p_power := p * p;
        //deals with powers of p
        while p_power le prec do
            Append(~prime_powers, p_power);
            coeffs[p_power] := Evaluate(recursion[r + 1], [aps[i], b]);
            p_power *:= p;
            r +:= 1;
        end while;    
    end for;
    Sort(~prime_powers);
    for pp in prime_powers do
        for k := 1 to Floor(prec/pp) do
            if GCD(k, pp) eq 1 then
                coeffs[pp*k] := coeffs[pp]*coeffs[k];
            end if;
        end for;
    end for;
    return coeffs;
end function;


function qexpCoeffs()
    // To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
    weight := 13;
    raw_aps := [[-8, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-867, -1, 17, 2, 0, 0, 1, 0, 0, 0, 0, 0], [181, 42, -318, 1, -2, -1, 0, -1, 0, 1, 0, 0], [5020, 54, -9978, 52, -32, 14, 4, -16, 4, -8, 4, 2], [171825, -221, 5268, 156, -24, 0, -117, -13, -63, 25, -14, 2], [-924982, 4088, -162774, -12, 808, 24, 452, 226, -194, 54, 76, 4], [-74090, 24184, 170872, 886, 524, 258, 104, -918, 192, 102, 160, 48], [-7630, -94380, -80124, -19254, -1396, 590, 2800, -1690, -80, 250, -80, -40], [164636393, -91941, 3591835, 10830, -9824, 4176, 14657, 17006, 5642, 1194, -1516, 644], [-555575, -511762, 576134, -15755, 3270, 7999, 8008, -13325, 3240, 2909, 1832, -492], [-74635715, 290303, -10488294, -102048, 64632, 13920, -3309, 58909, 399, 9815, -4498, 2494], [478529910, -418844, 10271902, 464876, -43752, -9144, 83848, -35662, -59266, 13254, 1580, -364], [11439526, -3357372, -26111964, 560854, -55460, -31546, -83280, 20114, -2040, -24434, 6120, 11220], [12155962, 7176864, -16995888, -1497550, -175172, 27258, 197640, 44358, -30600, 12042, -33480, -19620], [3549046841, -7253, -18137005, 1565118, -31040, -100560, 457697, -528522, 77058, -73470, -41916, -15852], [-94600780, 7537320, 197026440, -2670524, 507608, -379632, -60552, 513348, -192888, -108180, -116280, 18468], [11324794797, -6308081, 239771142, 746856, -1364040, -214912, -904933, -781335, -385677, -51333, 144438, -34586], [470191748, 5808144, -932235792, 2243732, -3498760, 371632, 399960, -1019948, 150120, -72292, 153000, 79380], [-178691010, 4433640, 358770360, 8776262, 1687860, 245438, -757256, -1623838, 468904, 291790, 392296, 119540], [-67551716792, -27828466, 1001161860, 9427968, -3431088, 502688, 4314806, 2251130, 159870, 273838, -57764, 81756], [618209685, -170505466, -1400622178, -32874879, -7765090, -872029, 4122136, -2174809, -771288, 83017, -372376, 212724], [-1129769936, -225136974, 2019226722, 25920280, 12302776, 4160486, -2121620, 1064996, 1477660, -617516, 679900, -457810], [-117285674214, 82323400, -2508270116, -54071368, 10813968, 302064, -4502480, 4478948, 2443292, -1411764, 2525528, -129400], [-341534272370, -194250580, 6787211796, 77350488, -32959920, -3528688, 11087396, -12956272, -6729312, -674288, 2248288, -553488], [58684620261, 73573063, -4227106517, 73609934, 16508208, -1422720, -10995011, -18127222, -5069362, 3694110, -9198916, 340508], [5609652211, 629288894, -10556157946, 163313431, -27581982, 4489489, -15029120, 8872729, 2025840, -5683609, 1567280, 325080], [-3370366992, 352142880, 7079530368, -70480384, 24745296, 729092, 512200, 12844232, -3453560, -10241912, -1667960, 951620], [-142926458855, -31524469, 2452347768, -94006956, -24104280, -7406048, -56750117, -24290865, -7107243, -4554387, 7399962, -1441654], [-9382379570, 114182332, -5183221068, 44800792, 16465808, -4839984, 4029492, -27164480, 1166320, -2233824, -3509888, -634928], [4216944627, -1326180510, -9766660950, 324087, -20978814, 26845293, 13646760, -1212207, 4168200, -10131393, 1862280, -1374780], [-493477240, -3934859844, -2995328772, -477808024, -28903120, 26883712, 70359728, -54946904, -199408, -11013832, 2121872, 3382216], [2390563384414, -326316500, 13496302554, -151335260, -35191192, 25509240, -171785928, 92180278, -22364102, 29838450, -21869756, 5736988], [-23975822740, -3430978296, 44317561512, -427676452, 123561320, -12511496, 37537080, -116597972, 3923976, 5970692, 11386440, 13155684], [-6142368466323, 22635791, -2760479239, 127674098, 62978496, 39542400, 103804513, 110619096, 79355976, 14626440, -51620592, 7470096], [-43252603035, 16549462178, 102690153434, -719201535, 275841806, 24040007, 75330880, -60531601, 5707440, 23768209, 642416, -4743816], [452508684321, 496934995, -12956424606, -784061856, -37175688, -30403264, -720649129, -202445559, -5782509, -1726629, -47417610, -2426522], [-37354704922, -11520355612, 62881560260, -224791210, 374780572, 120593022, 21902080, 260470722, -649800, -23336322, -29296360, -43294740], [63578209856, 6008027808, -120470737056, 2271227872, -210857248, -552696, -315148080, 514080624, -29452080, -134224464, -30915120, -16920600], [-3027669250071, 115874939, -7272036799, 408511298, -49613616, -75293712, 254870029, -273579828, -3828588, -63510012, 58995912, -15224712], [57659417100, -10890838536, -126238396008, 2811122492, -222189336, 151901072, -118638584, -89330692, 119115064, 186101332, 43773688, -53454532], [-3095048397091, 10488704319, -384097518240, -2684553900, 1640551656, -25294784, -315415553, -13992709, -47290023, -24416591, 77045794, -7095566], [-30042935180, 67675064460, 127386198060, -4572619036, -159913352, 76014720, 535908024, -573818364, -43586712, -176943060, 28638504, 86544468], [-15272815348428, 1262419978, -53749908180, -58594752, 435127536, 141423584, 4037954, 543601134, -62065926, 136025994, -92226540, 29061652], [24013505602681, -12731506293, 458045671655, 3476425078, -1953120640, 427920, -31223223, 95355738, -522946002, 158650350, 39103644, 8747148], [122676430935, 67854275838, -177958907226, 4240337643, -491783238, 625153077, 30937488, -376108299, 269430816, 149148459, 127435104, -78278160], [-38249437140, -150851598344, -75078984872, 2724763836, 406308808, 45111856, -179138776, -307132292, 143856312, 295431188, 70459384, -38167236], [299532192455, 220088125282, -376680440150, -1304557237, -2470456278, -95038255, 384109640, -271857715, -66278760, 17055235, -25638440, 27821100], [-18086178800, -231534179442, -195839232738, 2670234504, 707739496, 493091170, -341157340, 714865420, 31426100, -521272420, 15992180, -7437830], [-29718038204139, -24008843945, 843993689292, 9314226396, -3845570616, -177698368, 1834703855, -1070331441, 200165301, -118708947, -175281126, -24154070], [19935352556358, 8018544292, -354509494076, 1609628024, 616217904, -789074256, -1930639460, -2726923912, -2047577992, -4302456, 599989712, -117652864], [-9858153880, 292356152244, 314560520052, 15660025576, 992904656, -1475113716, -2790949512, 2065177440, -193382328, 26904912, -101083512, 41757060], [-82648589443848, -15303440546, 424373746248, 11216659464, -2566636128, -451946416, -2858756098, -3175326258, -1000772694, 331787466, -890555820, -7926716], [-605975948340, -277475365242, 928514904534, 35360184996, 7450475520, 340681278, -4608821820, 1310241216, 780258372, -141928536, 519818820, -530142], [-71176949641902, 15874338320, -573504383584, -5146889056, 2789955936, 424093536, -1037202128, 634487760, 1794226320, -35167824, -920102688, 79566912], [-486871507100, 458441474892, 1430613045996, 15529061524, 4138406296, -1775055400, -2953146200, 557880740, 32922040, 595199980, 106779640, 127247420], [74895909839893, -4099435977, 626933954843, -30923503346, -2591089072, 642516000, -3371978451, 4150980618, 3495953838, -1101289890, 1116349884, -23402052], [-1080108915505, 437782336010, 2590157413010, 9578052659, 8523897178, -637091535, -2266699976, -521889099, 283258728, 33326715, 339679784, 226260948], [-110947561739507, -54878439793, 1943667779760, 27192668532, -7193536536, -90364864, 18545648111, 2475540251, -765684039, -496949999, 2186487010, -110682702], [238228848410422, -6201830252, 11028308136, 18268601728, 2882826944, 1496062368, 10736591364, 6483827404, -902627228, 1345218852, -425278520, 284373928], [265026007056, -545846897156, -1087737867332, 24609362160, 542265664, 6022013344, 1061290880, -7180917776, 2483722080, -466073584, 1755985120, 150255600], [-240646451979375, -28679381245, 720018147371, 28095291278, -2128974240, 34913232, 3269612041, 988532358, -5912232942, 1868066802, 265022628, 112836372], [-2565448049868, -744438036048, 4371173090832, 110911467012, 25643010456, -5102295312, -17902605960, 2602339908, 1362651720, -47417748, 1606421640, 1046980740], [585463751720, 1120987580052, -49016449644, -30016436856, -6344990608, 2176420148, 4922945224, -3832082608, -64316072, -1476189824, 209067928, 377917964], [331731090011412, 157158463162, -6842177854212, 30442065504, 28511344752, -1624623776, -1712658158, -11792558354, -5449772934, 1926715274, -3609767404, 30146964], [324801085651565, -165060624657, 5677023390463, 57402758118, -27959906768, -1535430816, -14605592467, -13158557290, -1725467470, 1125749634, -4749495292, 26852228], [-2311021043080, 66999070504, 4687966450312, -211668251704, 5126773536, -504484396, 19570740728, 7893598640, -5752371528, -5107587968, -4039354952, -306660900], [-495104695119104, 144966690134, -5714704923756, 19474122816, 22301005968, -4472657760, 42534283806, -11874555086, 420051174, -5065362730, 6922724012, -1092002516], [4229267840768, 795337306338, -7639102017582, 174988164808, -23871982216, -4146372498, -14273237220, -4738085148, 4084236300, 10879906548, 1960129740, -1144041690], [1136763571538581, -244111886281, 7967198520150, 135786678600, -37157112744, -3216742304, 22219818307, -17316605919, -4809136773, 270078819, -2115480186, -319104106], [-1257897577509378, 278964012076, -9921120783116, -117395818696, 39968446128, -1030283280, -56296650812, -149046448, -14655605248, 3312946320, 2661084896, -4885168], [-2029556791890, -3350768735496, 701954581512, 19758038870, 24866709108, 4728136766, -10471340360, 22605994802, -2726063480, -17336718338, -850991672, 1449575972], [992863875961, 256792271358, -1752382554666, -507228129083, -50105151098, 13816637999, 75053874600, -61672159261, -1195479960, 5082190381, 296436840, 1640135220], [-124227034507127, -115048093957, 5641616765046, -138219873192, -28361504232, 2431654464, -129252123993, 10544934901, -22863100809, 9597722399, -2034138754, 967381294], [3207590211030, 513142153608, -5923241694456, 292094024886, 10001013132, 27202929114, -18621103176, 18347853594, 10200100272, 843637974, 3141105168, -5488442520], [-3593190633028, -1988619366708, 5145362702700, 134328414380, 29911943048, 898750888, -11732970760, -29633371172, 7676994440, 8542875092, 6288745160, 1756123300], [856803541649201, -191316916477, 9113216010057, -35576881614, -29626763984, 6783341904, 96282609029, 34952332156, 45943125700, -12591479724, 5509209832, -111212552], [-108486900996935, 214948550699, -2506358197578, -388685329992, 10880900856, 2135721248, -2740431433, 46439476229, 22762329159, -15488473457, 29600617438, -1626083730], [-479188403474118, -574364567320, 23301328777646, -64180061572, -116589736968, -5204399544, -123991544660, -18767697258, -18462502902, 1880094834, 3041510532, -628091220], [580632984204342, -554003313596, 23410370736060, -87729863160, -109481773584, 2452826416, -59461739348, -3956714384, 40820281632, -8889029776, -9288855136, 41315664], [-7503384012880, 7212786636438, 22197736895334, -352689271672, 48146425928, 8119055530, 27838439540, 49007540380, -11467283644, -15563466196, -10410843772, -4148982014], [-2623642574446707, -453729367697, 12747408294960, 297883320660, -66941415288, -4737958048, -106585710481, -63107558373, -28686322791, 17060675793, -33492302622, 1520681938], [6630902652750, -5314058166936, -18504445739208, -348638920682, -94194884460, -22975401386, 47679095720, -41739323102, -6276896584, 24702707822, -4116050440, 102820924], [-232137818770682, 691642793156, -27579704470944, -45003902448, 89587913280, -26037860768, -80405418908, -88064367468, -71812046148, 860790012, 21011497080, -3857542504], [-3984104753885, -2266468316178, 5739341915766, -765168623129, -35942755166, -28709915743, 86334640032, 1478518217, -16798765968, 42110502391, -18131692368, -10398772584], [-358466788952, 12886409871642, 13663074785994, -180911188720, -18183698648, -29607165138, -2693243700, 7694099052, -13734388260, -18788113332, -3795205860, 8041579470], [-625069996149718, -77520668840, 3082986973298, 4664323044, -8643428504, 7273378968, 6208469300, 5999760426, 41580318294, -3156192498, -18866470404, 1301487540], [5832598580433870, -1025120852996, 41345913643860, -29518692648, -204627660144, -16211632176, -100111195980, -27239145952, -53266294512, -3235054016, 33834154432, -3285962224], [2392842054800705, -188402569069, 13146752740905, -504565322190, -39058388816, 26636414544, -225065793067, 117368720044, 1017610708, 17559675876, -5007319544, 4583510296], [-14410948945601, -11190680328958, 17464594659818, 244300334035, 149663695626, 43415465161, -31946794760, 15723552421, 11258360760, -33133517941, 8796426680, 1936279260], [-32715061998672, 1848607416246, 67016063286150, -78885044088, 259788384840, 25272498042, -16522118700, 16597518012, 3889867620, -26191577652, 3874042020, 1921195410], [-22083687567470, -14524903353972, 29572424155644, 1292134794, 100827164908, -109345369106, -29446569328, -78445752794, -371524432, 98542601594, -196640464, 76563736], [-39793764476315, -8837389603598, 70316180740234, 2582146417, 320422141598, 70840538775, 15834986480, -46202280225, 29216830800, 19594692225, 13089273040, -9582921240], [36604002601220, 7250512926036, -65842922894892, 947509577348, -249786340600, 11440181260, -50642730448, -181308190532, 36506873216, 10760197028, 37615314368, 19916098336], [-27830110055520, 4553595309172, 59949984244276, -558482250240, 160771179232, 18240774112, 73032918176, -85048218752, 9297588480, 34326074816, 3810633856, -3581637696], [28641209425974, 5896980853752, -51438264766392, 2336287167870, -13883615004, 111634779606, -209770638600, -13756048374, 64395152520, -58408421466, 49230238920, 9450205860], [2563743095560745, -356090232325, 23283102512319, -717117977178, -102328282592, 22118467824, -271604949175, 82209231778, 72207439462, -6419792634, -11431945652, 2720819740], [-12155288094140878, -1724581341872, 59925649198862, 906005436156, -298562180264, -68282132376, 425934582644, -116401981794, -198076043070, -22321465014, 142871258292, -14395084932], [-61026306064274, 16289876059792, 138210551911696, 1985314184590, 610320286844, -158723398806, -396150127480, 343610353554, -16716935040, 5744428926, -16266670880, -7683071280], [-6659062522909187, 389898500255, -21551944960776, 844376376132, 198161885448, 43857190304, 955864181615, 164213520563, 215527608417, -38090847719, -17178999182, 3638314530], [-25912659568606, -5945231543252, 45293766917068, 821331467954, 370807941492, 258936070706, 14048558000, 72694770086, 73934343480, 9555919354, 17865163480, -47136598260], [16643884333380901, -1870503361305, 91448097987509, -1130116728806, -450587188768, 2023118016, -346365358479, 15190886076, 193388565396, -67172300364, 16639949160, -4465377432], [94942971901052, -28964785635090, -217445525869890, -1721859811948, -928937070304, -335967932882, 86134840580, 218082997648, -146581255420, 13690645592, -89746275580, 11961842050], [-23078124330997474, 42616334316, -35537661134402, 2292147655884, 288311455000, 69337523592, 521544197648, 58938981050, 1685244182, 106233630558, -203373296548, 21662207876], [55576717496100, -46322895627020, -157094771146700, -1329903671292, -480064136216, 73810167484, 225136418864, 12100111324, -25774445664, -31199825020, -25027621280, -11766986256], [14883067321759036, -6903916860670, 230828483642508, 3061475917536, -830564623248, 97461363744, 375361467450, 307630927078, -214796140062, 169692080114, -126085985308, 26728612516], [-123263546751740, -10742578941684, 234431720923596, -2320466618140, 614390117800, 49917190020, 296735005920, -868488162420, 70520723760, 37255710900, 100209022320, 79792809720], [-8047233730350546, 3141057128476, -104202902801036, -1439762188072, 323284254672, -91666961904, -241181284268, -247782513760, -42603060400, -84994275264, 135249006272, -20997043888], [121201691595830, 54029459750964, -188044137283068, -1564399565538, -974902041916, 319938687602, 461195386336, -354252292222, 46571994784, -60214562498, 30258836128, -1183740592], [-248482270885572, 1572354822226, -42215393786988, -1850872659024, 643753429008, 369082533376, -21469166342, 1441737150718, 291333659274, 192313304954, -194336418700, 64227911316], [64471245771731, 22000984776618, -106984624292814, -2892380327881, -746018944030, 200403680149, 636698560440, -560484446111, 58229975640, 226182334031, 11992652760, -40240996500], [-17704199936137927, -8837336526453, 379556786488062, -2111787906072, -1965277235976, -61685098400, -1829981085977, -529567533043, 573821894367, -177367414745, -151012899314, -14076947618], [-38799278665393186, -1052320708452, 74773780016128, -2253161350224, -172833174080, 143784563616, -123286232644, 737618445356, 219483870596, -4750307004, 66745807880, 15590369768], [137391987356120, -33138934185044, -307740030641492, 4742305041368, -627657030480, 359747682920, -319750952608, -306558252952, 155842854336, -269014317992, 150948006208, 70579154976], [17604132598565, 89717945858114, 54932542641242, -8330174111887, -758246567714, -15782901513, 972494215792, -267566888673, -167746533744, -68580969663, -100538853616, 16938253320], [-3590111494426914, 11223127358876, -309535562160046, -9759644744428, 1309533806472, 104185568088, -1285577266952, 760941975582, 776253005010, -272560136598, 261997784244, -12199243284], [168328006808474, -86505311397732, -421095338521476, 2590506130250, -894615247804, -161889896774, -395965449360, 1284817512526, -139063249800, -47800078126, -165759765480, -109576398420], [23149329762738, 85997629397316, 40528907287476, 6539367079978, 186052750764, -466632391538, -1052036907760, 461194168582, -21796745680, -62563832422, 26546744240, 61616862040], [-2189674179952855, -16174380119269, 603964888889061, 3030487315386, -3244736102096, -308120197392, -1399707072139, -1875631801760, 503638517680, -255261360192, -309291326144, -44803505744], [-174147321606740, -96897812762292, 250460305536204, 2331067618220, 1379462252248, -282377733612, -695060731536, -119423228748, -26205001440, -384316102356, 101511132384, 178471700016], [-22729071927469695, 3775867625395, -116667198444174, -4230605723712, 473422995192, 137321330496, -3266321841705, 250086348857, -156638454237, 233265752299, -309946237418, 41430095750], [20600042394083262, 7865506421596, -355261130153400, 3394835172672, 976994969568, -498787937408, 728325085804, -2235407056460, -225789598980, -248020165348, 51740875064, -79466654856], [50243434037936261, 17262338605607, -647143900034019, -2054755795734, 3106832383360, 79551811872, 2400737384033, 685552000996, 247425998956, -114002785428, 258959668312, -5273687240], [-65652323679360, -6034599546186, 126849979026246, -2495768198408, 862653666888, -248903990750, -328793642620, 2819774384380, -425774701420, -373351214740, -420747278380, -205346216150], [-444796989814690, -257366720283140, 629113067841820, 3997819780910, 3630897278508, -183832204066, -1030400269744, 92886585242, 70534410600, -247312540730, 124208558152, 115778426628], [92992049700662229, 1357234274455, -28453052345681, -1695433101658, 785706132528, 445615409184, 1135728603445, 2082360701198, 193051238042, 203773107306, 19016787668, 67843470740], [-39294995580680835, 26930113766719, -807178563122436, -21054806369028, 3711078768744, 439514206880, -5147801179753, 2467304129319, 405931459869, 25391666805, 351376204842, 45545748634], [203333728034430, -149005388065740, -554870331813180, -23047967624058, -3148788816588, 696915965394, 3301929992208, -1493371902870, -240145982736, -135134720970, -158453843856, 2465216952], [-299835348832203, 56996359401938, 652515974342090, 9763222231089, 2785079231054, 416733327143, -936017554880, -1481564100577, 519771352080, 190987317217, 420826114640, 111467819880], [2434616836979989, -7934510473609, 292887490361748, 2451931787820, -1517336979288, -76281500576, 536383750591, -1055037166473, 1289179538637, -322458587931, -459022375926, -15344400070], [-400200567946620, -102755287760724, 694747800679788, -15996139810524, 1755140474088, 18800537436, 1944280479984, -697230632772, -90350791008, 892926554148, -206890639776, -219985168656], [1008128910734708, 185508029785320, -1820647844263416, 5102681963332, -7712163935080, -1522481973468, -444352732080, 1331107568652, -434019839280, 630857893908, -359130358320, -104675698200], [-520783261388515, -215919617404506, 819605460239742, -11321679601111, 2968452847502, 821253598699, 1813144740216, -2379646741793, 345736837128, 681370745297, 189457956936, -61549901724], [25067540684454845, 597319731423, -161921829612660, 11301739926204, 421124404872, -670894486592, 4096645268215, -1706742477769, -2379786735699, 68354780773, 941959284874, -109025864678], [-127918266627880118, -46348171096760, 1859647604142930, 1744439665060, -7421303530840, 487741521240, 2463026377380, 3057583780090, 561320435590, -88225028610, 643493230300, 35344462420], [-8229788313834156, 18792009913642, -813534791048940, 1120313703120, 3400752894288, -111899163392, -3692817806894, -935945703242, -1929656001294, 701398162082, -441999278908, 43662467172], [33832610550642373, 37295011922919, -1477207879177129, -3693320234954, 4621875741392, -1153366970880, -6026722240203, -5786830454202, -936172671582, -279245085870, -383176591836, -149649420732], [-141389140743670, 23845559272968, 307897789292040, -17582159819158, -861365221132, -1328605148810, 1159306457640, -1214081362010, -602987874000, -511664242390, -121971340080, 420030863880], [169344375564554533, -31096388537369, 1337883288906981, -8559111968678, -6243578578240, -3855908448, -6444812852943, 896587104652, -1077096953948, 147575228772, 637850825800, -11191375064], [-83964878934901282, 19945529033516, -731470550085270, 3560944103460, 3081125527624, -698241723816, 13228432136888, -928228976666, 1543261448938, -1528646206014, 1888014786916, -241821065444], [662599951406970, 464029291859400, -854487420979320, -41112012001542, -9224151514188, -1313798305602, 5260435765080, -3782842649274, -822866747424, 634913982570, -357913577088, 285996381792], [223799452622797877, 53601514695255, -1759383102162353, -27219097911834, 8905631998384, 1084439747232, -480130366795, 5410037551214, 2122489739066, -160276289142, 414638371604, 112580251220], [308523345194321, -52197568378350, -657336180115446, -3281296639795, -2288414772346, -3543149079821, -1932887032800, 8036908977139, -1666969947840, 269978187341, -1450945650240, -509448527520], [-611425517408208, 590751466846968, 1806029798213400, 39436694510944, 8203792254384, 1323778353868, -4553312696680, 1568945453368, 1080974327000, -15395476168, 586758412760, -200836707860], [-61544690247566047, -39909911897133, 1217637450600600, 25634657124660, -4196354303832, 740702363488, 3145775797411, 532282064663, 475478925741, 1000111086277, -2218840976438, 224433518842], [-2043681572642150, 183605984766192, 4253452640302176, -38135128165134, 12437474327068, 1054843553794, 3847653624920, -4487441063402, 211074612872, 288195485786, 269737523528, 193531672420], [-244011592125109127, 4130614550891, -369711825171414, 13386797968752, 2277802763640, 248204242752, 2434184593407, 115693543657, -1059577951053, 772726550267, -868659771850, 106466557606], [12270345789267374, 110757870447804, -4093527119073026, -28211211309588, 19363869596344, 1010535966504, -3385190662528, 5327521038506, -1759388979514, 1075582263534, 371791726076, 181922395844], [687710695431330, 702121892985676, -674304079882772, 10315211490930, -4576270013900, 2207039540458, 1402557051776, -3778641733610, 1153906207080, 1286341456298, 623494184584, -218664930204], [-1638745127483700, -643977111468684, 2625895532028756, -39450561431780, 8711953375560, -2192121565280, 1889166946760, -1445152926020, -1062611491240, -876837496300, -286095289960, 633468556300], [-56072776816149651, -6009491359313, 514028702452158, -13175987646312, -1310724431784, 41551395680, 8236188627851, 5749233041409, -2147300552421, -586776300285, 4151960607942, -161228363306], [-52076300373892334, -45904776592432, 1253660997828232, 40844071840816, -2245215342784, 1380686164224, 11263981120224, 5939180931896, -4545025735960, 2538416157096, -660735161008, 351884754128], [1298253338216854, 137138520959644, -2449348319660804, 66317542314886, -6012411229060, -2015285892234, -7455148938640, 1163317438626, 766605890760, 831320723454, 638170857640, 190650395700], [2218007079897524, -180214450535556, -4604218418976996, 9920752306404, -16005573387208, 1910693157896, 1809828611560, -2553706392364, 507103875640, -346387256516, 390448556920, 78568959740], [-1254417426900286, 703763220604420, 3212744307985636, -50843916469390, 6600585655956, -2330330948974, 2258734202000, 5873432828006, -2267881246920, -2026130389766, -1489930314920, 32985774540], [-1469937268037360, -948748057126572, 1987056154338324, -53166094498800, 6956766306208, -2418089839532, 3404785517624, 1339239606232, -1639425598360, -371429007016, -1004125339096, 133237589716], [-1738540423082375, 230048085361882, 3696263909077906, 45217890937621, 18783350042294, 752589713667, -7667735042128, 9730003793307, 318847259952, -989193581499, -296095690448, -762990795624], [-75916040067390422, 70696841785624, -2421765444429930, -13574749188500, 9605382677816, -1612721177784, 20713491945132, -2195372760434, 3564694514482, -3518221295526, 4321038446164, -556511429636], [-40018339775354462, 62683883170544, -3110399741707056, 45226007689440, 18292419221952, 2759398646976, 22946984212560, 4507976666752, 6539245977792, 1457577952256, -6017244896512, 624062355904], [-19196615032830095, -79074017200061, 2324737076223969, 72609758035042, -8881901816176, -887000052240, 31498807508757, -2690038033196, -1513233188756, -369610805220, 1013719929592, -165654429656], [-2970470948243780, -967241730083640, 4953043452577896, 73363102601836, 28839034260424, -702217953520, -13064903330840, 5813459559980, 900816059800, -3001328273180, 1026983592280, 639659328620], [-229856132567595902, -15906679178976, 24588238439582, 36808492593244, -6805959321448, -4909150330968, -14743435060572, -22812171844674, -7995122471454, -243060295638, -480167477388, -613829826180], [-24607236295493, 1242599506515998, 1291274923683782, -44566032248369, -982523139198, 2965973409193, 5079016064560, 1854447450913, -957929492880, -3691218533953, -547192838800, 137140234680], [1021382425466040, 557677587183942, -1487144540815914, 38191129161904, -5988104989896, 2423045281834, -1544330394652, -8299725588860, 1992764336468, -218037278044, 1868061259796, 809327553226], [-388921742951346022, -58154714812600, 3381275891867766, -85055889574356, -16208654199944, 1286963653896, -36534546650788, 7512212840350, 2457605392930, -435490584054, 1330726577332, 92067089692], [395036127474652, 1744265023391820, 948277561949100, 60990644964332, 1879716495016, 3308770155168, -5880313242840, -3843697062132, 1929822055800, -3298924742268, 2018719709880, 1098257509020], [-2450151487377315, -768765422074002, 4093833440064774, 44776214011785, 25758634921710, 11194604523459, -3093804343512, -3933038315025, 3506463707640, -5503459784031, 2675451540792, 506713603548], [28494569961017181, 28840610180767, -2166951166700178, 79922327800344, 12706718307000, 246805866304, 34285060398139, -1115367255551, -2085052305861, 1426059753539, -1878188067130, 178672844982]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_12_d_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_12_13_d_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_13_d_a(:prec:=12)
    chi := MakeCharacter_12_d();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 13));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(997) - 1;
    while true do
        trunc_vec := Vector(Kf, [0] cat [f_vec[i]: i in [1..prec]]);
        B := Basis(S, prec + 1);
        S_basismat := Matrix([AbsEltseq(g): g in B]);
        if Rank(S_basismat) eq Min(NumberOfRows(S_basismat), NumberOfColumns(S_basismat)) then
            S_basismat := ChangeRing(S_basismat,Kf);
            f_lincom := Solution(S_basismat,trunc_vec);
            f := &+[f_lincom[i]*Basis(S)[i] : i in [1..#Basis(S)]];
            return f;
        end if;
        error if prec eq maxprec, "Unable to distinguish newform within newspace";
        prec := Min(Ceiling(1.25 * prec), maxprec);
    end while;
end function;


// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_12_13_d_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_13_d_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_12_d();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,13,sign)));
    Vf := Kernel([],Snew);
    return Vf;
end function;