
// Make newform 13.16.a.a in Magma, downloaded from the LMFDB on 01 May 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_13_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_13_16_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_13_16_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 := [2307108268997532, -31010911692567, -680104282298, 7133274223, 9594016, -172505, -2, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], [-1429279103841621544764, 41144226063683030331, 200896386715360655, -1767228177876806, -5785749609114, 14123740235, 41041543], [-572341822919257501620, 749249115089087841, -111387074204778175, 319114537852750, 3853554298314, -3848269423, -25853207], [-450145979859887366220, 930325665895088799, 132122565328039615, -319114537852750, -3853554298314, 3848269423, 25853207], [154782273862326832364, -6673200215265119991, -90022628758617475, 513969319377406, 3187138376114, -5201947975, -23661403], [-6567181240624668865908, 50834880664646245089, 2219184069419143165, -6501696937816882, -67845749579310, 73231607569, 463704677]];
    Rf_basisdens := [1, 1, 41470982246522880, 20735491123261440, 20735491123261440, 9215773832560640, 13823660748840960];
    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_13_a();"
function MakeCharacter_13_a()
    N := 13;
    order := 1;
    char_gens := [2];
    v := [1];
    // chi(gens[i]) = zeta^v[i]
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    F := CyclotomicField(order);
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),[F|F.1^e:e in v]);
    return MinimalBaseRingCharacter(chi);
end function;

function MakeCharacter_13_a_Hecke(Kf)
    return MakeCharacter_13_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 := 16;
    raw_aps := [[-49, -1, 0, 0, 0, 0, 0], [-149, 7, 0, 0, 1, 0, 0], [-24149, -218, -1, -2, -13, -1, 1], [-527985, 5549, -26, -16, -161, -24, -14], [-12562204, 138001, 635, 187, 1778, 3026, -162], [62748517, 0, 0, 0, 0, 0, 0], [-289811481, 3031210, 20995, -1906, -2837, -51061, -5035], [-1198185268, -4901120, 59940, 17134, -255506, -9392, -15514], [-8348995112, 1940141, -83421, 16965, 594384, -158518, 6356], [5420439350, -76140243, 1147835, 64237, -11337160, -1573478, 739020], [-28470179342, -212044867, -1625495, 1529329, -18646068, 5358934, -84270], [68310523271, -2381748971, 5906756, -2490135, -18126857, 10479013, -2103251], [74990459692, -2292408635, -20890363, -1505963, -25513018, 19019800, 1559990], [-175353782527, -1429282454, 24245715, -22804307, -100450121, 41496310, -11578924], [-67690743757, 6218470028, -57893373, -34882665, 30166371, -111848342, -21282118], [-3053911235532, -5089602793, -743353, 2748007, 1181703170, -100007224, 28754178], [-11570658002336, -35092004757, -302479827, -49334247, -259627530, 109877630, -5249994], [-8276862658804, -10502434173, 280665307, 54949483, 1349660322, 434566200, 35227786], [-1865134532560, 52393074298, -194309986, -486727716, -267981158, -250940876, 228494710], [5827176457653, 190578864315, 1530256582, 278920748, 6017771677, 971092600, -53246362], [-16499695797662, -12898917883, -1213537317, -1621166067, 5442340152, 1127317570, 614670428], [28104502902604, 402921597188, 552783504, -455174388, -4067555928, -6143279504, -500778220], [-21829874548630, -340704106864, -575591966, 2854072928, 1626031696, 4720542388, -406161874], [-227187704512926, 877765679506, -2798166074, 408073130, 28809931216, -2869343700, 922225096], [-95979110555122, 1279982335613, 2290035303, 9802360805, -81555828652, 12149490254, 3669982000], [55685182463240, -1720977641504, 9199291114, 15506994008, -30478847114, -13732792450, -2539337190], [-171169878990844, 517785979928, 4667884468, -3201225660, 164712825572, -44880256288, 3366857672], [-125229545196240, -2528229487091, -6194405529, 1247091069, 318232461480, 4458852306, 6402391720], [49457028577951, -322988502011, -23754309996, 8738186321, -59000235097, -1285820595, -1261143867], [-189208612875422, -872314834716, -25377226212, -25499961948, 158225839272, -27169157728, 8520069408], [-1590804099210340, 12979456997343, -139803963507, -14629668453, 261110441340, 4631816478, 2223456972], [-2729835369667007, -10047254990920, -34056906091, -85527520217, 89233598723, -183418179630, 39194079856], [-2861236441893028, -25738094323803, -57261001291, 59190859909, -92743780954, -280795614744, -24868700138], [3535254965182265, 22173983952703, 80240137614, 127885711690, 665962437067, 211482941836, 6123554480], [5413604045843674, 63480805146988, -52627501904, 10215547916, -1475912620460, 286068137196, 99340234812], [5081840163085885, 79003628527342, -321653699229, -76173470185, 524956523057, -276735398934, -11675500038], [-923232745902578, 832587886683, 362498746389, -518767185749, 2553424437376, 1346549063390, -171064064996], [-1955428036807446, -132657146099551, -447108471095, -28548803683, 6707881890364, 279156520446, -302306903690], [4445386402595050, -96265726571291, 357477021705, -62092919835, 6090122586072, -888903562106, 252081911438], [3486129263799932, 20554374449748, -536789632366, 273582208948, 539479607114, 1130219215170, 446288318494], [-18767005224576843, 155489580122653, 1218705174700, 1196033677304, -1209057479669, 2874646799904, -397170384116], [1825203801560104, -350872014258954, 1040104728052, 476679340910, -2614566164762, -1940964726742, 201023588786], [6838478773983422, 63676621742871, -41252334929, 1167390076853, -13431364077338, 939159594594, 25470308344], [25351978870862304, -272857884119328, -1810632521570, -1170718945488, 3844586922410, -5366685596102, -939877662810], [-112928093492320827, 35693062722545, 1044195067318, -2850333526867, 23886095382361, 1237429292503, 530853642715], [26011820995007390, -182557668350966, 2101097478220, -1739121362884, -17654358989126, -2348817187952, -1238031880296], [105503049183875601, 288875223761788, -1780636001183, 1928222380363, -1061744688165, -3737088269566, 1488637452608], [-24153602524274163, -771931548199504, 1061244447185, 4180814552541, -44387073452483, 18432792837990, 197389110686], [-374194306494668242, 642229163218827, -5036342692293, 543122744367, -7500962640036, -10238281061886, 1067333617690], [-189138875505407251, 953655884421930, 350897790381, -35381440038, 31015705326417, -3657886718067, 1311008003475], [-468083398902940833, 491607546393605, 1838327844912, 4473436761789, 7159827629115, 7354347757997, -2458578190323], [-335806565056351925, 629646329374283, -2676985700156, 14031496452494, -39133599203681, -11355439647828, 727856693566], [63821325615190358, 2786763861775470, 5608790484310, 3611673889294, -77153019023868, -110223350304, -2938486550180], [-384814745037373392, -995393669132059, 8295922834407, 8289558750129, -18868515327420, 9319251080514, -1794934309564], [-174378247678316765, -2124398746206960, -8419686188823, -7148260671204, 50815832833767, 45708110071707, 1456528457633], [-425824271838093688, -2629706080813663, 16900756332551, -2988493462187, 129644481099380, -19210595558358, -769204710288], [1032987995121327372, 586282721342951, -6746300995577, 368774807087, 114137622383554, -40337310749952, -8171093647702], [1161481799457331179, 4303499602288362, -8719935273155, -26696333651595, -15532007766901, 29049720570046, -51853382982], [-88424920936315968, -4576079918709485, -4859658380265, -28079497822965, 84009972684774, 17609856102572, -6872351813738], [-602212767450976222, -2607263404324838, 17094484737598, 10991842632866, 90633348592624, 34681093729740, 752849015192], [1065073609209870548, -435846933741225, 12954934647785, 22489302960359, 437215891057800, -82713439001874, -697576278700], [-101343347972268773, -1949178829501771, 69116136346712, -15912698269775, 223710046118771, 48201184641481, 6048376981497], [-1697520865072180688, 4899024046128371, -11565817375299, 75813712181937, -541913141651082, -104140222414514, -5271792709330], [-1116367332568893410, 17495103823967628, 10841477433722, 75432114255718, 63133762435082, 28491510393628, 12805315011880], [3148001188139568253, -16475369850163187, -56702108183786, -70744735364379, -425608251819883, -58767869191881, 4268545492339], [-359258939473121662, 9805079066863346, -83104403136262, 5435105430178, -469505999830132, 53518516608064, -26599676149852], [-3268611810893516266, -8543346746839810, 63756126758984, -29066320111862, 602433046323140, 22806480025280, 52249666621734], [1331286877902237133, -12574166195320799, -8265941042294, 166906975799217, -412419395720947, -411070644372177, -32498149268381], [-400247220392526767, 25295097988691321, -62378788580212, -236754494582012, -764994930945877, 194169778445536, 33386478766320], [3633655621748354579, -28905091621003816, 7314916136253, -68932757392192, 1041241122644387, 122276520106931, 13656711996169], [2064606317494698428, -11965309605678860, 110026810167638, 37667886609796, -1014530444383450, 337303813720622, -15479877012318], [-1256714003543770998, 16613489656352765, -10177006143439, 374823890046877, 543680455223096, -411731931061834, 94575407986734], [-8523915445455103582, -29072059880477810, 135031457261948, 199253734695816, -2626361648315750, 113685186904360, -11024757821540], [4828558165456856352, 7064114289743480, -135275730930886, 42120135794424, 2411215830965086, -266826399804930, -85096324483702], [-7263800480416029118, -19839055922206769, 170877133434579, 117839293437775, -1954499507425400, -460094907464894, 111887507959682], [-11540268354517763027, 22404638176969154, -250269000676529, -313554509255473, -838664331278171, -646243037427566, -42286986626922], [-825468005679083086, 7566556019956465, -32983132705029, -41398592670759, 6469394232235908, -478851854605770, -13145267069416], [2604613821754803182, -20770244729808988, -159790046988364, 197280819815956, -246248868197296, 240810694115000, 18850918705608], [11313390223888948048, -26521992793737407, 384224951041605, -831043398695559, -3324727179814302, 281582876822020, -142955598372598], [21742055003524661052, 18177672171066939, 399507942500703, 652656294849155, -1472105186562202, 846159713033452, -51875341139818], [-4829171408263666709, -26581769353784949, -1330546619407252, -93215427611372, -3656974958423239, -1690895807133888, 48046086643712], [23488385254753097111, 93717501364733624, -157718229952375, -274276761858944, 2288394378931127, -1205296040979769, 17376284692773], [-23941024852289915949, 34284246009632195, 45223272276676, -58017561106498, -3025726030540769, 2336859642034948, -369096647805602], [-1031693656687512955, -63474390209628685, 860711138742000, -516764870772469, -2254494838247539, -296422738314085, 49570441280251], [-15369332947840389922, 22104360598983551, -243286076044921, 769884242170969, 7830748426845482, -330816088042918, -123792501481380], [-15657241522452140737, 5523709693411010, 1420490505742529, 203499124164547, -318788750110795, 122269224772330, -159017372843176], [23755313917334966094, 136142866507910925, -915438230823337, 18273994926949, -5514436299681820, -174600590975474, 444515887754816], [15030568128266784302, -132669450675328208, -1252232091093308, -755690659901056, -16212520749079124, -1420549624878404, -102563805359148], [28844764134352840127, -43510000528303053, 396167686219926, -502663620755841, 14328066957846423, -1523752013547255, -14492105868275], [17654349420689793226, 14313556186207397, 379013402157697, -828506970132059, -13265251295673624, 131764626316006, 354466131083862], [7173429469925868372, 87716704759098217, 2180316758385727, 231030173266025, 2175771449510344, 1279930129453858, -685446858782988], [-42040588059019391341, -4876991014499990, -57653503182875, 1196080522809413, -13618350112322453, -1587213544827586, 462915674426178], [1615036201780760486, -533602447294518409, 35586323038939, -115785295456377, 27008079044052200, 192362095739618, -11818932467278], [-3002980633290850895, -65183987784360340, -3156377633219343, 934976418281679, 10491879663369615, -1761103292032078, 664091972902844], [100136319928015740038, -170477403690834805, -317626633144445, 1620217321564407, -10483230027701884, -3175203899162926, 48282508205546], [-72095514606505202766, 621076295850066146, -1155526975533008, 1169985047407028, -6486234303328358, -6263971744564008, -173154207780484], [17670561306373348702, 504192488695965720, 1270904836506656, 5276499446702872, 2733088913488688, 2015816163639600, 1016312743192040], [-155312015244673390635, -45158648365067697, 390646844796780, -1266762085509825, -27912461766746211, -3020702774557461, -43263036324981], [26781675373112825696, -440436604378094115, 1470424844605431, 2515848944296629, -4053219374652336, -5982505111153326, 877164206720640], [80517584450047074709, -532665497492611501, 1704895305730508, -2786125374536065, 32530072020632241, 5179392202138387, -757432573968821], [-177505824467432108741, 480385459756823497, 825430228651470, 1240306718361146, 10706657807590673, -2468729579263140, 180881238191712], [-288648547671816239475, -454718870215028707, 1877344835992858, 4722989954184593, 22284766905668377, -4739718058120985, 903505173546067], [-52951070802900423647, 1487103760617637321, 3631278591244876, 1149292563228032, -7676435409756113, 15847693571577144, 105382757798772], [-82056071783009380987, -769756365939190088, 3869228437190987, 6637679268673660, 11719842164478941, 4689308452896041, 1234335253963227], [367264132603453774843, -1185325917143400835, -3173579209827078, -2456667007535718, -18895084913812299, -6301851366810596, -434685069014908], [-182183007459590803946, 731968999875446793, 1756921223044051, -6097804948894039, -17354609471266508, 14511588711730574, 618945390797600], [143232008566636843166, -1011329925117226187, 1343364560698745, 6582870559466569, -72031271383778020, -9113587135909978, -40673949511302], [-365404621036859900262, -913685624725966465, -6628284572454303, -9437482622000601, 93069590486101152, 8214286356803870, 705147044323956], [-122291739382040117762, -1537058616210484699, -2825979496758327, 5627018540754267, -65132298097892682, 7341150767475462, -1584735726766160], [-199997443282927498833, -1415909071809859634, -3141631100710193, -11874647553774134, -34114627110902325, -572300178151477, -1466002651637395], [206498017475273440430, 1184328781008444715, 9364536772223659, 14506832607718841, -49450098143737082, 5804353513717018, -2060356051297752], [-406295896921446062626, 2216310581711737236, -8544440121768356, -9972240666192908, 58106971969490112, 7472552988287304, 2068562572125760], [-194803272323133325580, 1960369383409160226, -535316353618712, 2811901798586258, -150177358439365346, 3984106631092226, -453036885801366], [304525172416884953990, 1558005912750952047, 5203439466896159, 3425601467052023, 79262343117538440, -1123437939560766, 2700599914159454], [506160050684634484337, 2373603814669170342, -3599184564770145, -1555937097474621, -43483470676863891, 11159345713274922, 1027581860429010], [766726025478437043998, 1121314863272299264, 3816120632870156, 3278739283872736, -39292631996179828, 10264876666278652, 1576402002191308], [90594112726826626304, -308308651062056224, 5112790335216392, 3277703884041202, -22950210152057110, 38019552106953776, -5596499065352610], [156116961932136401790, -262653315603750523, -12979992536173039, -3334349673755537, 2720469090935498, 17139051722890342, -1080450801905468], [80287099242777674524, -1903151700916138408, 11145124732602510, 6211574457171696, 153405668947764570, -2995327009365358, -959946091844794], [347014486456127624408, 3229213319691397327, -9277711944922811, -19510874607663097, -153953425603412672, 12632023556704438, 3893600978835928], [312915073687428775026, 2064581055178516350, 5435228890405078, -13142749556200482, 177780232597455044, -4963211960461280, -3767839334191476], [222244365766386762887, -2688292032147102516, -4388245803321887, 10727366100097816, -142966517777195829, 3833946081269607, -726276816347291], [-526364796798722241940, 1124493281039851088, -34360794699539906, -28844668331449960, -87156752276545118, -38549032736155430, -2534256423286690], [-539748742000166950134, 1752548759658311112, -30146302705093718, -24917551464009772, 74233968932024692, -5105448077803028, -6477746360879758], [311776831193332379102, 7473751276220442428, -4136064453341366, 751046547898392, 344901948193132412, 40957497273336164, -4954249800610546], [-872127536900992164348, -1588749714217238961, 27012366103576295, 26671245106622335, -267801371576179894, 126370353060060192, 12076550831193786], [-1161805397973868461774, 1337989392158793354, 14983628554774074, -848617854386950, -124547819724363868, 19501158505277608, 6598788299289308], [103337129945990225226, -5848364072611850952, -14690915539836302, 13448093422116182, 215320960727416054, -74253738563889884, 7749111633321776], [-877329097200779027390, -2344661532242961469, -33877424980195641, 27917098936753161, -180899194009189050, 17418342714502282, 1855694371327532], [836368736885037934369, -2431823660262202644, -31559988313942713, 35068437877769644, 152659351809573109, -106666013060286091, 16797077563934647], [291548679526836524046, -6463562186973190711, -25493265723723371, -22924754936866711, 187984876444201456, 134236083372881334, 9977864422457710], [563514603632276304667, 4425049893651581868, 76032926119615387, 47172712745408771, 512108956984289671, 68364632056075506, -1342414801749610], [869792041432569314480, 8934786258069181259, 11167346141634293, -1222966581881045, 220116821049299888, 43894105077635774, -35488480394250156], [-518400566878052475676, 7761201341993845137, -26383615387325651, -46935899841508439, 257977181321185218, -157243768876750380, 13419257581350226], [-146390813090383367774, 3642391593014441203, -465336148680195, -10941282067326357, -544880201250130080, 84874954422186582, 11269072737559908], [-901718814850828779508, 11584917818038916054, -97229042928309500, -81112111917156258, -7996089931239298, -67827351679897054, 5121098844919394], [-1412078018967967464369, -1456288341728092308, 19146486225298637, 67847450360695516, -318785526799575985, -103612464780793553, -21993419580207499], [780914503743721321154, 14226171559997957911, -45513973052232997, 47574441597750075, -817354005626841596, -18549559142676758, -27364956323996882], [-1128115590621046853282, 6894127026518049402, 42888497498906878, 26355351977106554, -604302467124166184, 5348615856659132, -19275797804143008], [197569725671736558429, -8082082103109983423, -38034869384692206, 108837769235908161, 422031636597196581, -180681603649821129, 351506405325211], [-849182052142036803374, 7867719332852033280, 107537040787177234, -38409137610290344, 30428184992509648, 83892666785548316, 18695150566650230], [-2807725146825207443029, 7278051613023987568, 35571074025230133, 72648586658501808, -72017352455203197, 133615071401209979, -27427604647671759], [1510447970575848970946, 8207381328369370835, -157477091363644793, -53343443786780895, -831047683722414370, 24621268654956890, -19864710662237836], [-2312622609295713497904, -12637947779458074584, -36740096091623488, 24838904108349262, -272899875361389994, -67792954842548360, 482435023961898], [5101068197612006317262, -13698108887357161916, 52389255008259988, -38016161044820692, -491132032728830216, 164679526382396200, 39465500715440688], [-3834004826901613371790, -1347063133404086451, 68970925829365625, -53952817357888595, -1322310176911444648, -170617768733215386, -23817248074952138], [2723784384154181283413, 1562013783043694914, 159709498618982541, -19572302755459382, 79847804718865129, 339293373281122573, -21103114346372797], [-87419516817222770914, 12235442920328231938, -100856669166691646, -33012291388433470, 1400026243825294588, -190679695846717776, -45234010002599812], [4100874512374274588936, -8942907199831235731, -39280407821841537, -17081281907188243, -1301498456764708120, -99822495491875822, 27923404969074112], [-1985710788215257231713, -28759020377462293497, -256818905811084644, 65416481572432310, 71053699469844307, 38298930371594868, 18678154963208910], [1616203759670064144821, 8961923825398658906, -219046695379339987, -63027190846607990, 259337616941960801, -112778700228198403, -11209413417999261], [-6317736116493617597385, -14528202547172522748, 75903743189097369, -139738871177709672, 1505593296415235907, -192788517014687257, -47232333521598995], [-4265851681773441160421, -14981098939934406080, -40119011648853345, -163396775577733351, 313552258473009053, -227504552177372226, -67623924563895540], [-358782477477584256644, 38881032812528876009, 65707676275126275, 31791770098364529, -2092590555703320288, -69228985405815718, -39546157910009224], [771854778578494714949, -4554837112849699180, -63247217833998419, 219834867065605395, -224507293535709517, 560007514265628626, -60687739095641860], [-8508614398262648284570, -28451267408241999795, 130684727004498849, 118763779207423083, -1239529619238372234, -272782854679756930, 75200729851267352], [-7622347986354765544140, 8266482521864923718, -79356142655556546, 214269489425738470, -880092651065745944, -553003763134965444, -68117124111111084], [-1560850997408787018952, 21312955310961326782, 103099737246378792, -172843074380129874, 983691539643675186, 532299838578783598, 16862967926495398], [-1960551460391553549242, 3040420940627660956, 67697392507611152, 48073411477677532, -602867989842106636, 264537273024915948, 74403059355336428], [3876628958565423002077, -12312359665985635682, 133792565902388977, -216423152590266754, -2642211942222095399, -7489573881830899, -83586063620158709], [-15687915905387616921220, 47152756270393213245, 135948792765485919, -116256094775979225, -2542335422127266070, -529042923586363310, 87805237318605582], [1458095633589887697669, 11894884828106775414, 83877455103635869, -12187925299916878, 1344019872931931917, 170306162870368189, -177711096091530853], [9284706569628005459497, -81334002135990333773, -48654105401114734, -90946377454715960, 686017074489394625, 532874555040706752, -71448257907457042], [-20023423291986992411025, -41213273190617816072, 288464424872748059, 85972881286614841, -472300094195949667, -188587902245610274, -115156518249850336], [4786760295562321498594, -7467070993474624988, -406036905546895012, -441400850060702324, -2215261510747417912, -394427483931564824, 155834894147317736], [-2863496202592295665393, 24162173359244039465, -157011864495334646, -556160631495530428, 2516844301871349895, 789984306455836816, 48715325460724874], [-1509684368634168286774, -12367625671078458852, 270491368360384678, -225853420015953314, -2155413790932765726, -820262058467555964, 68243940477636196], [-1502551540211433745606, -78903177131936527247, -153859575440898301, 385265129874602121, 1629911500541292124, 440385297370633918, -52416597787208240]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_13_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_13_16_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_13_16_a_a(:prec:=7)
    chi := MakeCharacter_13_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 16));
    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_13_16_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_13_16_a_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_13_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,16,sign)));
    Vf := Kernel([<2,R![-1457820061286400, 77633370378240, 1393638715392, 1317476032, -47667996, -121496, 345, 1]>],Snew);
    return Vf;
end function;