
// Make newform 126.9.n.b in Magma, downloaded from the LMFDB on 25 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_126_n();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_126_n_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_126_9_n_b();".
// 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_126_9_n_b();".
// 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 := [3600954063202500, -240706289358000, 55526550982200, 1285719886320, 370996492174, 6901058684, 1175865280, 26522276, 2442597, 26038, 1771, -2, 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], [-26984773183603377626956274393536147147331265750, 9752897271144501115378783140540022894025772300, 1155801182140862748139978075585720247425691610, 83195425529662130594620284172473556520625116, 3431321599519171490777749116011582452833751, 284512405463777430352832268454748628032240, 11131778344973963974751938311173829249679, 622041487093150864202690645978361783318, 10336572935328367533679520460308503877, 407836869298474437455340301140187004, 1758499405810309934504783994922142, 249242624836958096947291049205614], [150034933393435109178188851023054000, -2348955365028536232136922784228000, 216994393067807114987978096647200, -78770721438988807079781895174936, -210613223065982349309540476456, -177379614919651411062138004000, -4647099311970982545404004644, -492429624969135883257007488, -8227695102102134864192572, -255656756837032256753104, -1989997430335076733412, -202090052997757213384], [11048918485871635720300924597905528453681638174380776000, 2609163799660988726206299505343982055052819191399183200, 125259619206429743630981741652544433292642123735802680, 9559307238130164790593403222159884577147488085189808, 533309023488774125337998971963209286841493095593888, 34189804034808176908885236138447656435084129832920, 1290973311556908475057672630467631408439113945252, 73459172959773528557928505036741541190581453484, 1382489401609375767735252142925667919161845876, 64657565555049528396993084926195892268746452, -218430194229633744914529509073840115789804, 41466642982043738305273750221571278377732], [-1385033580081343277150852263834917916425131597066089579500, 210745779191561667224197624416338698106449666777103838600, -29787325819210625575306777117360896780774995145000648060, 1232027592779266269038516068849525793493825675377304724, -91026519758204630109199848747998457834420709852273561, 4506518819044915963571196219188322917878323825723610, -223436318479859447297797729704951582355477414783444, 8765540175473967287127314623158789312600896826327, -196980006817623228437015963467916486055246039722, 10504015705502733702510209152120248796206238381, -194015480630466339533626171187059766650794137, 4388479248444805057437458729602950655570171], [-5293095787705918997083590471490887293013460156452000, -419668562716290974904738330383989038960444347053500, 62702397948931872764416079524948687000330305428400, -4031076711710260042337512500790951825314288950542, 244612668132502821145590510320859194346222125518, -13661477357598467118481766560883323628495653750, 1017687154676781403107774999026866506293986657, -32631802498374833750630567296742062588633086, 892265623500544966516688213473756968290141, -49828759519689311715068812115650817938588, 1064317243853343151867577142519658617911, -22655145615877602844539183432374915998], [275324311691182360700739206974484799553552973833742022000, -3942558719265851293944702744481663554350271403136329800, 8512437143522830279690437901625218234099750694928660130, 278128366055187188331442850279910733656899724297799934, 36980713962442451166553725210523356839322123814612684, 1081415561159053859223472153367615023520735593146020, 107417504678194535026850048617658691557457774744756, 3085583461554122193156164032207250585169133120717, 112694363162312556941181370547505420607033692628, 1508226183624898879405770122812374504064480291, 35765415206283888264666315831589968713690638, 1430801127012315548536255004183414895900501], [9361922776596285270490167162266911384181747710409702872500, -954583822768520294818550097390091472062905505396068572700, 167407529702279801663465208075137813114106822171222206070, -239558138321409645168367205333842548920592204903048812, 677552514904693448042131723584525824963023892844431003, 4193785715969755422500264023362728313345326976068380, 1923996545362749575291483445290224614431596393115057, 26150668190089625532259883516208033042378832463784, 2038509960606237849143092265767479169239658192591, 1361166715082048437951530903241742857004161342, 867691912636945932596974989416155251015019636, 13338264141537325313311917970564427270213992], [1875373735193013612260589311227188735926664719608962344250, -174784892375947745556909003495742251913050078569843857500, 27840453858107075456932878902958238612876051603058221200, 564047673995712293571115150862116197714825180029691098, 94684408678738039092912173297925421344211107382379908, 2440748130162879528321270320641742883451084732341950, 274458793090965907410697017421479512676875449730917, 12185296013930765281478686195094660614660292697984, 331461532360634094437185559641637695121832107771, 8422984630009060440397463320139801075630411522, 42302506614350685633914025903002917145494391, 7033069129256435263236742547523137130906212], [-17268608754152363884700189816682179160194828035097946165000, 2605041102673272404914277707012809846456674803854412983300, -155404531434038491089437280291684778754177585787052986980, 10343682059347768990257375523775375252102035449571094338, -558105329241348686974037573431324860046641123249341047, 35248118352994088521313915699252645531079078743861680, -1347624057433328366951394606008915199384063970600793, 38223436891675774554631674487002785835933021853909, -1803023773677935799488625560719820759719131894459, 45583677115632861769560840696239322279151267917, -957896318735373078011315058704001773101558914, 6054911108566435115607360647943456052671917], [-3181183256082268381476501560267773637772965689712835254250, 387176339312707602427238399689653932321531829634313210400, -46694442856756660370365179590022384733423872761447292090, 6135202059529055323019406453024806474677421879706075986, -115451070122358703908802014788811016980343501968440879, 20124646119319154325779119575986926123786881134865290, -330571717793029028110814804145189379896868567619816, 50600501181719652105512974305610297112820202056378, -164793884662810630411891769641798415282288058658, 53438107924072141861795008058170768701990400734, -693694994357863440892290681727874517162142843, 28362573161672765973404785148720975674635794], [-238476366159493276591194972213783465778964937336366423150, 294901528412463062345145398414966511027296750113204199040, -1481627569476403633655425429564195787400798583312482824, -565072596867003166685433878177782782384933049063729012, -27254872749017455522781018695113710137673305984566893, -3349486239516574439717567372468893920057256838819386, -96701866330231439914420055960880176379960553576254, -19095274626532405002106584913131626990857378934087, -257929838107492026060138323525210972762971495052, -18892457035468512050282559473396368795492750205, 161501133144023408277785064944509279098148003, -13377736304108994042107898908842008226919367]];
    Rf_basisdens := [1, 127562314326329112726185736550948605192663192750, 14896903529326271843615438766774375, 2237235385617246536586335951817401866224361341488799375, 2237235385617246536586335951817401866224361341488799375, 11184694956004562078456284301417071569138895803750, 497163419026054785908074655959422636938746964775288750, 4474470771234493073172671903634803732448722682977598750, 2237235385617246536586335951817401866224361341488799375, 1491490257078164357724223967878267910816240894325866250, 4474470771234493073172671903634803732448722682977598750, 298298051415632871544844793575653582163248178865173250];
    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_126_n();"
function MakeCharacter_126_n()
    N := 126;
    order := 6;
    char_gens := [29, 73];
    v := [6, 5];
    // 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_126_n_Hecke();"
function MakeCharacter_126_n_Hecke(Kf)
    N := 126;
    order := 6;
    char_gens := [29, 73];
    char_values := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 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 := 9;
    raw_aps := [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-93, 93, 15, -8, 1, 0, 0, 0, 0, 0, 0, 0], [39, 295, -9, 63, 0, -2, 2, 0, 2, 0, -1, 0], [1, 1715, -619, 616, 3, -1, -13, 3, -6, -2, 1, 0], [1461, 2917, -845, 1705, -5, -14, 8, 15, 15, 0, 10, 0], [-19247, -9629, 1160, 1221, -31, 27, -10, 1, -40, -10, -7, 20], [22539, -22558, -1105, 539, 52, 68, 81, -20, 7, -12, 13, 6], [-26435, -26418, 112, -3217, 109, 340, -235, -88, 167, 0, -105, -20], [362799, -17, 12131, -257, 487, -964, 0, -61, 335, 44, 200, -44], [502360, 251213, 987, 1068, -81, -52, 125, -66, -147, 0, -198, 0], [22635, 22708, -348, 76740, -395, -499, 984, -412, -1009, 0, -485, -120], [-262957, -525157, -38559, 79055, 627, -1386, 5020, -1621, 2327, 130, -1124, 130], [-1080524, 198, 20566, -2108, 3538, 610, 0, -282, 2192, 480, 648, -480], [-1021629, 1021449, -385161, 191695, 1951, -3051, -2871, -360, 180, 0, 180, 0], [-159, -2756433, -311804, 311284, 958, 159, -276, -915, -481, -120, -159, 0], [-3463018, -1731817, 356317, 365883, -8066, -3978, 2065, 116, -8450, -500, -152, 1000], [-4745039, 4744168, 1158320, -573868, -9701, -4447, -3588, -1706, 847, -24, 859, 12], [-934, 6293595, -12413, 7471, 4590, 934, 17069, -2450, -1788, 2220, -934, 0], [-3783594, 4376, 458940, 9490, -25616, 38854, 0, 2116, -15982, 2260, -10724, -2260], [1050914, 527697, -695272, -690214, -10998, 5296, 112, -2500, -11518, 1980, -5520, -3960], [9964371, 9969272, -18108, 1504869, -12727, 15130, 8895, -19124, -40157, 0, -24025, 480], [10581456, 21161688, 105046, -255726, -1044, 31440, -66696, 2772, -46174, -180, 1908, -180], [-17962089, 17948739, -823920, 413160, 11526, -7758, 5016, -24972, 12198, -1152, 12774, 576], [16632853, 33277629, 753991, -1590911, 10273, 12494, 12804, -27519, -77979, 1650, -18896, 1650], [-73010688, -36495525, -205584, -234441, 15393, 19506, 10728, -15150, 4731, 4488, -40962, -8976], [22892969, -22906422, -7763992, 3888515, -1925, -55612, -39819, -33926, 18133, 4680, 15793, -2340], [43866635, 43883706, -16457, 4363665, 9844, 118568, -42443, -59054, -31525, 0, -76125, 9230], [2598, 60654319, -4967678, 4975987, -8537, -2598, -30052, 8022, 743, -4968, 2598, 0], [23579421, 27645, -178405, -63541, 89747, -109920, 0, 17955, 17941, 9690, -81510, -9690], [66768428, -25866, 12284234, 43856, -29386, -63970, 0, 6594, -24584, -32460, 6084, 32460], [49691215, -49726781, 21712930, -10915817, 147582, -10467, 31787, -91196, 48942, 13376, 42254, -6688], [9037, -184144837, 1303798, -1361607, 50645, -9037, 165230, 34275, -77756, -10910, 9037, 0], [-208883610, -417768562, 5116700, -10453840, -14410, 139240, -362256, 69366, -181236, 13068, 41888, 13068], [145902447, 145949199, 2027, 1048634, 89951, -38280, 230868, -145836, 39646, 0, -192588, 41172], [59672, 92849195, 2117373, -2189622, 23525, -59672, 529335, 227740, -202541, -70620, 59672, 0], [-78972957, -39521571, -6178572, -6479580, 403788, -1172259, 549372, 35925, 405453, -34260, 73515, 68520], [-46276927, -46291965, 34740, 2062551, -56558, -468925, 469995, -16108, -68002, 0, -1070, -76260], [-166939267, -333907507, 1505485, -2871007, 10947, -110076, 343780, -112681, 20203, -39920, -61814, -39920], [93432911, -93346546, -25066438, 12200828, 605637, -597663, -711248, 254390, -140805, -54440, -113585, 27220], [16829, -139890893, 19707689, -20410386, 632341, -16829, -618053, 120843, -682828, 36698, 16829, 0], [-57252490, -114587986, 31622656, -62721200, -127598, -768536, 937496, 471978, 657888, 44592, 299788, 44592], [462526819, 462492033, -592201, -75272817, -639895, -982325, 821303, 126236, -1175432, 0, 161022, -12908], [-5855, -114603639, 5979594, -7372329, 1379635, 5855, -2190966, -4465, -1362070, 24810, -5855, 0], [659978697, 166693, 57912185, -180659, -3755, -1540300, 0, -31687, 45653, 198380, -71632, -198380], [-517283004, -258550379, -9306197, -12066098, 2422797, 80760, 8253, -69878, 2465287, 112368, -97266, -224736], [-104127684, -149186, -57847546, 676412, -925862, -2039010, 0, 128590, -655816, -277776, -236584, 277776], [433592154, 867611418, 10641210, -23063886, 337830, 851836, -530912, -834930, -1513626, 89280, -586380, 89280], [-1497131369, -748668029, 61340059, 60895612, 205077, -1607637, 337205, 284479, 569346, 79790, 933227, -159580], [32105245, -31784257, 118433685, -58714032, -1436529, 1812488, 1601420, 312216, -101148, 219840, -211068, -109920], [730496171, 730278864, 985461, 55818662, 892884, 1058333, -2269598, 993958, 2437689, 0, 1211265, 124730], [-2398370733, 124571, -19777441, -408933, 702027, -1750928, 0, 133303, 151059, -8732, -524480, 8732], [-3125153232, -1562559799, 58756400, 58833110, 498174, 146030, 360692, -225262, 81284, -191628, -867414, 383256], [189169823, 379103687, 41769211, -86039965, 697239, 2527008, -2398664, -1958113, -2301137, 66802, -1327676, 66802], [1293758473, -1293339146, 158292499, -77583560, -3744276, 379299, 159542, 239944, -20187, 399140, -219757, -199570], [-207271, 1366867975, 171514943, -171436551, -111590, 207271, -2030129, -588615, 733403, 447740, -207271, 0], [427749875, 214026059, -31391396, -33242094, 1709170, -3060087, 1889056, -255067, 1501279, 47176, -718025, -94352], [-318150283, 318312746, -172267370, 87490627, -2958643, 938196, 858029, 78038, 2129, 164592, -80167, -82296], [84057, -2011822603, -176999320, 176994074, -854788, -84057, 2819524, 1112205, 602617, 691920, 84057, 0], [632239707, -200113, -192562435, 1938165, -4131747, 7616488, 0, -655643, -1082409, 455530, 2167042, -455530], [-398937259, -199002419, 301630077, 304808274, -4057407, 709449, 457767, -639351, -4403688, 293070, -1624983, -586140], [-3381678254, -6763540454, 155055872, -306019352, -186066, -1495764, 2243024, 562438, 4098752, 2120, 374252, 2120], [1108524406, 2215783118, -113295648, 228396276, -1228914, -289428, -4263240, 3613182, 1694640, -36780, 2421048, -36780], [-6532180123, -3266666845, 44764155, 47104105, -1770586, 4561377, -3631463, 963779, -996595, -189788, 2701549, 379576], [3751857681, -3752577071, -91646708, 43731208, 4799642, -5097218, -4273788, -1750900, 927470, 208080, 823430, -104040], [2173740309, 2173851654, -5884616, -4102004, -5158331, 14755425, -14813640, 169560, -10650697, 0, 58215, 614940], [-2003011723, -2003289409, -5249034, -457886253, -5239056, 16009395, -17685489, 1398408, -9645054, 0, 1676094, 287664], [3310295539, 1402083, 230694165, -4962171, 7068789, -9605580, 0, -51387, 3611475, 1453470, -1247922, -1453470], [450748, -5023541911, 11931657, -20746639, 8218726, -450748, 7757987, 1948500, -9570970, -305240, 450748, 0], [-5066293009, -10133993265, 407633333, -800366905, -639223, -7483086, 13945328, 381621, 12595689, -768024, 510422, -768024], [1154973589, 577832707, 43771400, 50350437, -8796967, -2619273, 868754, 47485, -8010172, 739310, 881765, -1478620], [10925703703, 10926424611, 9286419, -1211891117, 8469483, 4870525, 271859, -4421476, 14776242, 0, -5142384, -1537844], [4822457347, 2410599141, 152994445, 142615129, 11669736, -21513177, 9728271, 828925, 12068521, -430140, 2056635, 860280], [5065789447, 5065271488, -3305448, -248748804, -1877427, -33212559, 28676784, 4017816, -2200977, 0, 4535775, 1945980], [7137939227, -427981, 63583713, -12576171, 25939585, 8484584, 0, -68719, 13072871, -359262, 634138, 359262], [5477127119, -5479946287, -382226305, 192586903, 219287, -11331291, -8859743, -4595476, 2123928, -695240, 2471548, 347620], [-79394, -9165743071, -1427713366, 1437833899, -9738561, 79394, 19509824, -620154, 9976743, -223184, -79394, 0], [5509330085, -5515583333, 765181695, -377770416, -1156095, 6675684, 10697412, -5811936, 1790208, -4463040, 4021728, 2231520], [294032731, 294576702, 17473425, -688930130, 16729194, -3930905, 7938962, -3464086, 31826475, 0, -4008057, -1288202], [2080241917, 1042431205, -225512800, -218662585, -7824213, 1304443, 5629186, -4295827, -11795374, 324666, -12562815, -649332], [-6937354570, -13877288194, 385073020, -783052360, -2963586, -1473012, -9677384, 9659822, -11752724, 384532, 6311704, 384532], [-14886758563, 553989, 995691913, -2902091, 4248157, 5789512, 0, -448047, 2796149, 1002036, 790152, -1002036], [968410, -26272060015, -393626409, 404189186, -11970533, -968410, 3501689, 4312986, 9065303, -529064, 968410, 0], [5792395427, 11588979643, 1054147197, -2078455821, 4185699, 20596810, -24457004, -12550917, 29847843, 3090, -8368308, 3090], [753752697, -751832139, 1650313545, -824901963, -5351877, 20307633, 21308775, -4923984, 3922842, 5843400, 1001142, -2921700], [9316120839, 9315855516, -24442815, 369657177, -28206708, 26567166, -24395211, -2437278, -55617447, 0, -2171955, -3498570], [29669547873, -1349215, 916147779, 5852827, -9316997, -20746292, 0, -309773, -4193839, -1039442, 2278534, 1039442], [29312510177, 29309895527, 1365480, -1431975984, -8503590, 30540522, -36359352, 3204180, -9163230, 0, 5818830, -7254420], [6753548921, 13513281305, 1317238359, -2638404715, 4020051, -31894458, 75542296, -7733329, 2562239, 2163412, -5876690, 2163412], [6715301774, 2464668, 1705749876, -868290, -2556288, -45524754, 0, 636468, -2232846, 1828200, -4374072, -1828200], [7022473591, -7006718669, 3115201414, -1557787889, -17663718, -14776839, -28248601, 24660364, -11188602, 4566320, -13471762, -2283160], [-17579843391, -8787730605, 181262027, 219154543, -43862180, -55597875, 30392433, -2392293, -44264585, 1989888, -5186991, -3979776], [-6091125, 21546795745, -3422552959, 3405333035, 23222954, 6091125, -345239, -24276405, -4949579, 6179220, -6091125, 0], [1667000529, 1970433, 727327091, -20135497, 38774915, 30416328, 0, 2444787, 15720277, -474354, -9304794, 474354], [-44583449167, -44579954461, -7161608, -2178028001, 2884198, 39119555, -28197125, -7427724, -4715722, 0, -10922430, 6551100], [-6282589350, -12555321366, 2607549670, -5227830618, 11270334, 46036620, -44165904, -36637002, -16970278, -1413000, -23953668, -1413000], [-21732615693, 21732980979, 319717035, -135141904, -45966601, -4675530, -8872728, 12226308, -8029110, -7663824, -4197198, 3831912], [58512924232, 29251962799, 554749872, 531950708, 36885976, -38716518, 15251516, 4303030, 36493402, -4695604, 8213486, 9391208], [-39800670281, 39819556554, -569707487, 279860971, -10886038, -12140124, -29041087, 31816616, -14915653, 3970620, -16900963, -1985310], [-5988604799, -5989870547, 5866455, -1100034030, 3910383, -177703980, 172065564, 4372668, 11618010, 0, 5638416, -690324], [-13416085617, 1173599, 529867293, -49752951, 98734333, -135807952, 0, 1575629, 47003723, -402030, -5900486, 402030], [2009368, 31434634877, -236543782, 290381119, -51750813, -2009368, 132389768, 3941580, 45722709, -6105260, 2009368, 0], [65200169080, 32612649247, 2761669417, 2703209071, 48256086, -115461624, 88622093, -21727994, 29929512, 3401420, -61782562, -6802840], [-86418757565, -86417280501, -28549858, -2652173076, -33851686, -120842300, 135006512, -12687148, -72134564, 0, -14164212, -6778892], [4118133, 8398914089, -4139088357, 4122622038, 16075431, -4118133, 96241293, 12745287, -28429830, -7845378, 4118133, 0], [-8527488608, -4268232623, 3596791688, 3552202898, 36919350, 29001302, -33078568, 11533118, 51008948, 2556480, 37155834, -5112960], [-31981096138, -63964808914, 19997624, -149569108, 5283342, 37317564, -37701800, -31649986, -133273800, -7899980, -18466664, -7899980], [-31567767023, 31571796988, 477618853, -275004240, 70830452, 129205053, 122704298, 15472300, -8971545, -4941580, -6500755, 2470790], [6605329, 8682529799, -2888348089, 2799038221, 58355166, -6605329, -129282109, 50770689, -78171153, 17744044, 6605329, 0], [614315809, 1213479161, 1910842455, -3819209055, -21971547, 1485526, -104495420, 79552821, 22933125, 6819090, 50762184, 6819090], [-36571731747, 36551113153, 8983666675, -4465913219, -20791003, -76947059, -66759105, -9945268, -242686, -20861280, 10187954, 10430640], [-8550332, -97384218701, -3794137718, 3833932675, -10064173, 8550332, 4753556, -55381780, 35715169, -12630120, -8550332, 0], [79185141207, -6522429, -2202494287, -24658423, 65417945, -96755892, 0, 3056241, 28124611, -9578670, -2646294, 9578670], [66861358040, 33433168673, 1276842271, 1269356659, 16395684, 30295112, -1738549, -7949330, 5476330, -2970024, -26818014, 5940048], [37574274804, 1312382, -6241375734, -39428352, 90172294, -20674, 0, 13940354, 24175616, -12627972, -43133444, 12627972], [-4501202, -16293427, -12902488116, 12923550674, -9194294, 4501202, -83252860, -25371870, 22697900, -2865860, -4501202, 0], [13056893192, 26081478400, 3079294314, -6144073434, -23846604, -119306300, 160148944, 54617052, -10868946, -8461380, 39231828, -8461380], [-36540160559, -18268002629, 1898691043, 1943636281, 13005522, 210935973, -60601195, -23472221, -29783619, -19316920, -89733583, 38633840], [-59655314887, -59647390140, 66484762, -8760869424, 80563849, 304361483, -270892088, -25544648, 137353457, 0, -33469395, 6154340], [-6235164228, 16973762, 2564205470, -6027840, -32897694, -111579590, 0, -11005850, 59928, 27979612, 16043788, -27979612], [18990028537, 9489973773, 7712361652, 7616509108, 96303768, -8808685, -10416328, 9930583, 106083943, -150408, 29641341, 300816], [47675088799, -17854617, -8627061343, 148139585, -262258543, 32434316, 0, -1688607, -128596361, -16166010, 22920438, 16166010], [-96587440305, 96542573961, 5330937135, -2659270680, 25065789, -71461596, -19190472, -111947028, 59675904, 14809560, 52271124, -7404780], [37878633, 264257955, 2752659037, -2768454416, -44705417, -37878633, -99513261, 174136695, -68930482, -15256470, 37878633, 0], [3117434105, -3137264669, 4898447100, -2329775715, -208909098, -47984563, -38310007, -9193104, -481452, -20312016, 9674556, 10156008], [68259550770, 1228236, -6616464596, 87843532, -175880132, 417882816, 0, 2263404, -91335172, -1035168, -8018448, 1035168], [41452842271, 41464732962, -83724534, -21114539808, -57012355, 52942015, -8310048, -32741276, -149696783, 0, -44631967, 14821488], [-14458019741, 14422019602, 24930882790, -12396784491, -81879397, -10130400, 6435467, -13697462, -2868405, -38868544, 16565867, 19434272], [-61867383304, -123707122616, 2749747824, -5569803144, 22333332, 34335220, 10041568, -56378676, -54375516, 5310660, -39356004, 5310660], [-97088740171, 97046267806, -2063849862, 986649516, 116462835, 15847719, 74880444, -134625810, 75593085, 33120720, 59032725, -16560360], [-17788149, 205704010349, 1349023623, -1557601482, 257800659, 17788149, -513721683, -102587247, -204436212, -13646502, -17788149, 0], [132092606916, -1175486, 4128065418, 137693084, -256043242, 59484626, 0, 16991954, -153509552, -18167440, -49800376, 18167440], [-43465783759, -43464958537, 154174553, 2442809801, 142488095, 104623825, -87986035, -15812568, 282500524, 0, -16637790, -12511680], [34981899207, 42685843, 2657023755, 3481263, -68604889, 57387052, 0, 23729323, -69896429, 18956520, -113873812, -18956520], [-88517817115, 88481641460, -7948626325, 4166824360, -338784202, 298625661, 324738778, -42163696, 16050579, -20125076, 26113117, 10062538], [-30428237303, -60828274703, -895971841, 2177411345, 44618033, 111456786, -11605180, -166690359, 336213273, -16418130, -105654196, -16418130], [-9670829582, -4845571157, -2175952840, -2309081475, 201093155, -28285812, 28983488, -2342108, 176096207, -22654840, -29681164, 45309680], [73910589876, 36969085417, -60254489, -71777603, 69565554, -105270860, 132701827, -46928438, 3289636, -19347480, -160132794, 38694960], [-45581720809, -91154636953, -4802938939, 9567112271, 25043565, -195955470, 524563000, -107608495, -87482307, -16238900, -66326030, -16238900], [-12580836, -637387023, -3458744164, 3659777306, -152123614, 12580836, -382674324, -86652036, 189866122, -23747856, -12580836, 0], [-44513299008, -88955325240, 6127835766, -12482000790, 42164172, 98938844, -87438208, -68275308, -139003446, 29108604, -55219740, 29108604], [179945142771, 179898929961, -54871147, 2961957926, -152486593, 317025330, -496686744, 133448604, -166334756, 0, 179661414, -51402636], [8991091, -178338097631, -11438254551, 11466451623, -85794914, -8991091, 208470549, 84571115, 58821641, 39615660, 8991091, 0], [109846196250, 32071092, 401590144, -315850994, 595596316, -496401246, 0, 28036512, 255743390, 4034580, -116180628, -4034580], [78787571050, 39365900973, -928663040, -721292915, -213866541, -286520264, 55275532, 57934576, -153766493, 2165472, 175969200, -4330944], [-47990336470, -95878415206, 4115566054, -8724718810, 76726062, 67453704, 120933496, -179114842, -416991686, 25531672, -127920452, 25531672], [52346188001, 104579546081, 1234042483, -2034077159, -61425401, -13887054, -115118456, 81467163, 279794247, -51404520, 71446282, -51404520], [-346773149724, -173360649777, 12856014208, 13094603276, -366178648, 306669438, -160619184, -9320310, -332969098, 42529860, 14568930, -85059720], [87801773015, -87833632084, -11893529645, 6171583903, -421877314, 130955342, 166912633, -76012804, 40055513, 8196444, 35957291, -4098222], [165523487041, 165527144586, 98769886, -3306908581, 103187431, 98105920, -80578195, -13870180, 195402227, 0, -17527725, 760000], [-106064222779, -106129475049, -121646571, 18192166110, -156835421, -779262718, 422937948, 291072500, -117914032, 0, 356324770, 30063420], [-92905900100, -185911643684, 12349620472, -24494546480, -99147336, 158284548, -711766144, 296049712, 202606020, -696148, 197598524, -696148], [-4520295158, 98806776, 4738694076, -108993954, 90550632, -489624318, 0, 70176276, -59989098, 28630500, -309335604, -28630500], [103831205651, -103765834939, -19635268495, 9599773695, 385822513, -81739371, -162582203, 177157784, -96314952, -30944240, -80842832, 15472120], [52820122, 230705831283, 19031892327, -19208774739, 161156668, -52820122, 286049157, 174186110, -319617034, -89914500, 52820122, 0], [-197729983188, -104292350, 19049775550, 319340760, -476949702, 652825022, 0, -46852882, -168195528, -57439468, 244850996, 57439468], [316101502337, 316076595965, 350559217, 9655728709, 290233609, 571341755, -660454379, 64206252, 655186334, 0, 89112624, -35419236], [158436808139, -158417978725, -15667577890, 7700813568, 225192832, 273058218, 276157312, -28126696, 25027602, 43857016, 3099094, -21928508], [-46370701488, -92836153984, 8255528468, -16421894548, -21995848, 1814648, 53897632, -79522776, -129103092, -72755160, -28763464, -72755160], [-649346933447, -324699300077, -6028427580, -6059803660, 127578244, -516953913, 245111672, 19599319, 115110175, -32067388, 26730569, 64134776], [-381779398337, -381779718459, 641116784, 4646533977, 584857082, -522485063, 576824033, -54659092, 1170674530, 0, -54338970, -55939580], [382401891081, -34006431, -2345522713, -169469497, 421863455, 471295200, 0, 14911599, 188564329, -48918030, -10728366, 48918030], [92829694798, -127971980, 38809596616, -522497366, 1228940532, -1074968998, 0, -71998160, 722467506, -55973820, 343966460, 55973820], [-193613714573, 193716436597, -22551127310, 11526024099, -551376796, 186308691, 31320551, 362242396, -207254256, -104532232, -154988140, 52266116], [-14548117, -66894474017, 39494043542, -39250511751, -226042427, 14548117, 1033088566, -61133715, 269686778, 11606870, -14548117, 0], [-56463673592, -28232472725, -16012968147, -16262834926, 144006739, -2633876868, 1244457287, 36558538, 215851957, 35286680, 144962294, -70573360], [-133780919, 189658550565, 49693716333, -49965538137, 446285290, 133780919, 442477593, -575806243, -44942533, 93098352, -133780919, 0], [242418387095, 121247014165, -19087532988, -18647968206, -605140482, 480003873, -236923884, -20449335, -570397917, 55191900, -6156105, -110383800]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_126_n_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_126_9_n_b();".
// 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_126_9_n_b(:prec:=12)
    chi := MakeCharacter_126_n();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 9));
    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_126_9_n_b();".
// 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_126_9_n_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_126_n();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,9,sign)));
    Vf := Kernel([<5,R![57630051544463744865465097265625, 2777516268519933749984224218750, 46621413360100528305031265625, 96393040610417862532593750, -136639551480746413443750, -476262626322570491250, 516425178513746025, 1612081221903450, 18486646794, -1881848862, -190071, 1674, 1]>],Snew);
    return Vf;
end function;