
// Make newform 42.9.c.a in Magma, downloaded from the LMFDB on 24 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_42_c();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_42_c_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_42_9_c_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_42_9_c_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 := [37671313072244229184, -730882789543557696, 91263792176643256, 247993465027288, 122405480888457, 576178351086, 95335059229, 954612102, 46944238, 218714, 7731, -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], [-1668627270970791332863497952045896661527008, 13482103338446301797935005213109150524736, -98717332783976011900371589173016329616, 100070246003108140371019888247054398047, 392340023482389288809628690460043298, 45443021340509469523686047121441099, 1341370707509367572536719768369466, 33791830983966703452688420444618, 443582459655435275923950988382, 2172053944775684636246143621, 49921240856851613557455634, 635064019542919519650407], [2720146949133608103183505029070173307349393903338368490764, 120178372428185546574358909974740376881676310692424724712, 8528379682097197798395402459173138020762440836656695453, 210253594312186731868840623852659691487650736614385299, 5066243443942777279584009212253660475740353764766691, 204119359496811400422861595635000335046083233492983, 4513382426718570737136876291254045772671383464372, 108043495186322452329042897996851496194289346056, 933534185481166182584422306349684748737342169, 15630296346939143330995797160852153840075557, 56547000846106996703156376191042119667703, 2229257063275752569792499708573257761869], [59896652469560622679392166139574385472723144715834246639649824127430532, -2182298104558607970600789175071111845612165577692164389908381912931704, 203405945180527125421730399539373782937217785198240632043052550531239, -887974126330493995896069421377607179540383163472534986892887735108, -42646214003758703410814892250453003239736631236062035320171961992, -1384431204018721005265453765029506205458924559524368703271826111, 31429023494244661538337872204941478890756970039658682210094986, 2035201082584182873065392628444593026959220110170997333186598, 15486005625957358937426062346945820468341654718433273909197, 345789949792574232049247782028857672789790211919736806506, -53001757445882925829689221366793161588991235279023686, 69516454663831377672439143751932632407044165817627127], [-38606996891337732807660172167406607360705952, -7295897986218914908003340663100118076385648, -154169692649727233951359332536948335906968, -8420009569528252573024487766610271824089, -179085535195515110491027909968876345798, -6557185297473547534866749953162884909, -141343972439210438863614340278466662, -4315696703133270270490403218137510, -42577011837722094352941459964362, -762806336171384815537523797827, 20450144207938881035665482, -128623186464300797910748353], [-47397954284238931853858555075496397681895786578971005297418683463081958220, -263749992328337750287796313440671281004284897010309948217543188840542728, -109170215466209691279896107671970776982617412616484101206047147256871785, -697644263098801911843062772638995928307284399019504454537065240429471, -101341091968190466709241729972543220710664898259215201741167100750275, -260121559178523199506995305920209504274981724800331799261337179847, -12440984221390698953532225516526987150262106109981930799338659380, 488797598738418851233698944289987462336109969981405356830395816, 1828985868706447477852340928437115600332599878458612822124155, 50893907286626218678412555054131148697673074935089590195487, 237935133051658388553124685636395240607938061822967856705, 12629036537074628444395806300478620811499938784880488459], [17636209953366874987866932386754592313271489349658832376642519445531626164, 613230961179019853436013972470871305834635892161108518419443187518295608, 36201211540386161063366048760626667872244648078620999651161047855625693, 1497847109239986424237934591593814706231473234362749561084065306855646, 42553019962622093713119896336050775179225695793518417409656036176631, 1418889401472955567447666425742854935080346330076276837741919801212, 26938198061951876334398817472014469653255836755780304836124167262, 635267487738941415669609200488395653210418749504546910626892794, 5361227317213908229694397402402971163836149721032816633109119, 96777802275752945272336577553340968240287217387262378384298, 242842406310422160078116014048280813806533005365207666463, 12951200944634716273031424837565360122855570177371491606], [-15679145127399461352091797829717246409455018314361485152037801672275916748, 2483848705747918373997914497097350783553487079052117578259532551333483192, -6219708371801766563651169856256602142110720610434612038787222090228481, 1557619808199736853847484344841120035576495820766252771114336973052989, 16861195528292924906738990278538037173285437587491797885047816765453, 1527094848286350741122954713592671068712853691587043708066085907493, 11649716765563567141216721180508499486315179640163977236010007036, -45553678759084355153572151361280333774528008663777148199623264, -2585714420170250736595445412643883837160681983451221332312133, -51062974191237723242769893962977373202403232011323706377053, 661594955991394051125590099987694311409957816416767602689, -17125353122814478484815498172348209169447148179758273961], [-178490947162904832808963653095782756682751733556050752626651028955137068, 3673607228228122578654973563654347865516512290541658150273135719180632, -575415186707504392483786264809997247285789875259591098439717674863571, 1730103537306178590083319651548972029749117884839027000927912628244, -593404950109746525138426188491874718183914024247916988101163160927, -4401117468470461390967795277737372871427682396874217792535235072, -414222036623824960538123957866458803563258683249753076662404174, -4448525486477998398872074177516769411687922864040075874931194, -100507181626474315032805448591367910176842292050960063871853, -532602084764369096714046838235584774342998465999790034888, -7196672039506844970496616424059081445846306483038129651, -133655592291989216254453637053671546772151311224338206], [-53151660743841612435710574821017244266628228428943750795947880855468785196, -581584643432608900039614432512681953749837251673307892477752455891951464, -138619829105069227966822602290956338791293309087862755204083120418639057, -2314781684442908097403827926628486847580837745161920912515625019472633, -149942917592937560113261924362761193106543663021705548030006571052289, -3195700119179612787289329331808713441619765795645650240003007720691, -99136281067591182250216441463870966487929242518751580652818633648, -1434198835714643056024977106930870039599278688059021242090798172, -19540897081452538511338759767358625942518877044971850464765241, -177657937166456220139732940782253404875554966682691028200739, -1636863820352943139677579491946849377551425061302183689177, -27054509986163656108322976727971764863869643855968163753], [23461687037271730708518941946078642719650063617666476414606614932515334668, 1436558242755168033724135853563691246490414665880808282398820838575886792, -159984470258919466643170848977396796644250217002260652569154769265376269, 3919420727564612420797489213521349185521749127902967256877731329198574, -164810899332084697335518819834131080895867368328356142113386303245713, 1641558862169695680378708446171083297686532259300688146177118510798, -142678122450861151987402655066137092351271363271538270395825142166, 974330085784192680282740460294820058219835711411776147072395766, -27803064982367898222746409379239876610455452594611608268768247, 432228617905487698594488705961593422826006856243794215570342, -5867718321633785732995546674011749352941311794001109071109, 42545458587387680249228307561633466499248231662527013484], [642779612646490211043494072361091249620580296900676429480315083405445450804, -16806947776026423090357548997876884758873181360912810448965077687953505208, 734160237336450975605378240291742827773418826785116710727397250828027533, -32939380520998521341374533398962780200001931938408029811763830909136316, 542398448856283101115349111025624685939621870605082275468949783066101, -35392257783315924439629731714181474886937068692085843689484032948972, -84435422850567273677989038954789662680758670774663248042285739358, -22365365893178443235113734017075393422193811688423173220959685754, -39728206340340757864853625058301167771334939897720116015385341, -4413165596234892284947892669698479992771626901144851826416688, 13722622029634527671074803685583155309116293867629908835033, -568291599472100480626137363959412394012840975025813936746]];
    Rf_basisdens := [1, 210893834246910136519119530202170967097350, 92438673580898260510467502589604969193722668806324921700, 257939941980571987378517198893876613619173027320221867995401221631050, 286680988866952848587612225395958551384078, 4642918955650295772813309580089779045145114491763993623917221989358900, 4642918955650295772813309580089779045145114491763993623917221989358900, 4642918955650295772813309580089779045145114491763993623917221989358900, 24056574899742465144110412332071394016295930009139863336358663157300, 4642918955650295772813309580089779045145114491763993623917221989358900, 4642918955650295772813309580089779045145114491763993623917221989358900, 4642918955650295772813309580089779045145114491763993623917221989358900];
    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_42_c();"
function MakeCharacter_42_c()
    N := 42;
    order := 2;
    char_gens := [29, 31];
    v := [2, 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;

// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_42_c_Hecke();"
function MakeCharacter_42_c_Hecke(Kf)
    N := 42;
    order := 2;
    char_gens := [29, 31];
    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 := 9;
    raw_aps := [[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 2, -1, 0, 0, 0, 0, 0, 0, 0, 0], [535, -8, -9, 0, 0, 0, 1, 0, 0, 0, 0, 0], [362, -331, -1, 0, -1, 1, 1, 0, 0, 0, -1, 0], [0, 0, -213, -13, 8, 0, 1, 3, 1, 0, 0, 0], [0, 0, 628, -13, -52, 0, 12, -6, -8, 8, 0, 0], [0, 0, -423, -65, -119, 0, 18, 2, -4, 3, 0, 0], [41650, 5317, 0, 5, 1, 5, -8, 1, -1, -4, -7, 6], [-106534, -11524, -17, -43, -40, -26, 93, -23, 23, 20, 36, 6], [0, 0, 7477, -825, -754, 0, 17, 31, 29, -50, 0, 0], [589054, 38086, 104, 210, 205, 106, -319, 101, -101, -109, -10, 16], [0, 0, 4102, 817, 1392, 0, -414, -72, -18, 180, 0, 0], [-949002, -184194, -108, -106, -157, 2, 341, -49, 49, 57, 76, -16], [0, 0, 48962, -310, 2478, 0, -588, -276, 72, -162, 0, 0], [1642914, 129600, 489, 915, 966, 426, -987, 477, -477, -438, 468, -78], [0, 0, 80418, 6418, -4216, 0, -1938, -1530, 214, -1096, 0, 0], [0, 0, 150911, 8641, -544, 0, -279, 1127, 1017, -1276, 0, 0], [-782834, 685968, -1350, -346, -1549, 1004, 3569, -199, 199, 147, 670, 104], [449434, -1172177, 2238, 2273, 3349, 35, -4904, 1111, -1111, -1162, 683, 102], [0, 0, 118970, -16076, 23960, 0, 3502, 3622, 822, -184, 0, 0], [11213414, 1001966, -3470, -4680, -5809, -1210, 9445, -2339, 2339, 2341, 166, -4], [0, 0, -369122, 24694, -7278, 0, 8400, 2508, -3060, 5958, 0, 0], [0, 0, 1060310, -3117, -43900, 0, 6066, 3768, -1898, 5480, 0, 0], [0, 0, -1589910, -54592, -68200, 0, -5170, 4250, 4390, -4140, 0, 0], [0, 0, -80354, -68439, 106624, 0, 20268, -14496, -8524, -3320, 0, 0], [0, 0, 1459511, -31775, -69082, 0, 11791, 493, -69, -5230, 0, 0], [77301986, -875689, 9125, 10644, 14627, 1519, -24179, 5502, -5502, -5142, -427, -720], [13898106, -7578596, -2134, 2714, -378, 4848, 5116, 1756, -1756, -958, 2604, -1596], [-74517846, 4917288, -734, -8198, -4410, -7464, 2560, -3676, 3676, 4522, -2584, -1692], [5720262, 1833994, -5986, -10328, -10681, -4342, 13065, -4695, 4695, 5633, -3602, -1876], [0, 0, -517828, 21600, -302146, 0, 34446, 7230, -2558, -3598, 0, 0], [255307562, -2998288, 2298, -434, 2990, -2732, -15580, 692, -692, 1126, -10292, -3636], [0, 0, 1281652, -139772, 297060, 0, 22844, -60960, -24092, -12152, 0, 0], [-65533830, -982788, -20285, -1691, -21660, 18594, 45937, -1375, 1375, 316, 3992, 2118], [7617598, -27187304, 25202, -29454, 8803, -54656, -36289, -16399, 16399, 13055, -2284, 6688], [0, 0, 4138387, -134523, 828608, 0, -57043, -56981, -31123, 49348, 0, 0], [36266654, 2169964, 23894, -21570, 11371, -45464, 2333, -12523, 12523, 9047, 37598, 6952], [0, 0, 2452462, -214858, 379730, 0, 203424, 34524, 7204, -85198, 0, 0], [0, 0, -7745204, -411909, -1090616, 0, 169566, 52422, -1594, -28376, 0, 0], [-137896022, 61566985, 84233, 67738, 116551, -16495, -141069, 32318, -32318, -35420, 59715, 6204], [0, 0, 5465255, -657589, 153804, 0, -243239, -22245, -3823, 108932, 0, 0], [-322848830, -928403, 65508, 3989, 67285, -61519, -125156, 1777, -1777, -2212, 7637, 870], [-318504866, -14775616, -46598, -3282, -45757, 43316, 43753, 841, -841, 4123, -48602, -9928], [-593361886, -79771912, 16547, 693, 21950, -15854, -96713, 5403, -5403, 4710, -58216, -20226], [0, 0, 3268110, -424144, 3140621, 0, -267323, -117939, 57439, -127875, 0, 0], [419993270, -35204746, 52804, 53278, 80715, 474, -8815, 27911, -27911, -25367, 124704, -5088], [0, 0, 3760052, -85014, 1092919, 0, -298363, 247453, 208147, -123733, 0, 0], [0, 0, 32704590, 439926, 5465352, 0, -172482, 34386, -11442, 149232, 0, 0], [0, 0, -30902569, 1649247, -1576496, 0, 305253, 240243, 37861, -7036, 0, 0], [-1388517982, 24901352, 13878, 230230, 132080, 216352, -201178, 118202, -118202, -112028, -55220, -12348], [-1211025902, -82437479, -111798, -78625, -155279, 33173, 315898, -43481, 43481, 35144, 48821, 16674], [0, 0, 6159532, 1953238, 4507956, 0, 749160, 127136, -182120, 207856, 0, 0], [0, 0, -42960648, -1833892, -2580794, 0, -677226, -433110, -19582, -45542, 0, 0], [0, 0, -17193622, -2430675, -2553928, 0, 158778, 52476, -211922, 502892, 0, 0], [2215434250, -183279029, -177634, -158039, -261911, 19595, 401100, -84277, 84277, 73762, -38445, 21030], [0, 0, 57935492, -2169017, -3183716, 0, -928266, 108450, 24158, 512188, 0, 0], [0, 0, 48643183, 601457, -1481750, 0, -236973, 423121, 176439, 100510, 0, 0], [-1584449754, -14814634, -495674, -254540, -624309, 241134, 881321, -128635, 128635, 125905, -238662, 5460], [-4408148534, 214380760, 107482, 26610, 117610, -80872, -343252, 10128, -10128, -16482, -118160, 12708], [0, 0, 27260605, 58431, -2316493, 0, 281268, 635916, 541538, -858563, 0, 0], [0, 0, -90106092, 669139, 5519072, 0, -383646, -300618, 43474, -217480, 0, 0], [0, 0, -138994917, -598287, -1697859, 0, -1430252, -488428, 210918, -300597, 0, 0], [0, 0, 105532434, 6404006, -6918320, 0, 390906, -1211982, -446158, -292040, 0, 0], [0, 0, 49869368, 5677436, 7810020, 0, 6268, -620652, -64972, -461356, 0, 0], [-2201657574, 166958772, -527795, 23419, -506952, 551214, 1155163, 20843, -20843, -2576, 120416, -36534], [2834665558, -968001242, 644612, 631662, 974107, -12950, -1909051, 329495, -329495, -302167, -290332, -54656], [-672057926, 144176452, 395624, -178620, 314470, -574244, -1166314, -81154, 81154, 97466, -456220, -32624], [7961045018, 176255189, -639959, -739582, -1002541, -99623, 1069311, -362582, 362582, 377000, -573189, -28836], [0, 0, -87619559, -7864169, -20593380, 0, -2165389, -1310283, 172267, -658256, 0, 0], [0, 0, 66622746, -10669633, -19088912, 0, 529458, 416760, 949118, -2220764, 0, 0], [4316532442, 783566359, -71200, -48149, -124919, 23051, 229278, -53719, 53719, -5570, 33159, 118578], [0, 0, 116054650, -5748088, -19687205, 0, 2673947, -139213, -1249023, 1646371, 0, 0], [-3172304350, -1053653736, 1542204, 1872564, 2432112, 330360, -3106548, 889908, -889908, -982656, 867768, 185496], [2755360726, 163913574, -577632, -1292094, -1294269, -714462, 1437225, -716637, 716637, 575457, -434676, 282360], [0, 0, -34587844, 5173504, 16712458, 0, -3961074, -565662, -461974, 2569810, 0, 0], [4426737362, 1615451864, -883019, -803341, -1384258, 79678, 2466621, -501239, 501239, 302102, 199344, 398274], [0, 0, -160724635, -15779661, 9846952, 0, -5425749, -226071, 440971, 1384376, 0, 0], [44578906, 380149096, -226118, 1037286, 296518, 1263404, -131044, 522636, -522636, -514650, -60644, -15972], [0, 0, 197700334, 6754780, -50207868, 0, 2048638, -830654, -869474, 318712, 0, 0], [0, 0, -24965560, -38507980, 4213368, 0, -2435952, 810948, 302376, 1272984, 0, 0], [-9066812426, 1403086338, 1927506, 2869868, 3453059, 942362, -3787507, 1525553, -1525553, -1344315, 1593058, -362476], [-1050185662, -436787563, -1749822, -1534985, -2405203, 214837, 2688662, -655381, 655381, 879604, -1466363, -448446], [0, 0, -231245102, 9513834, 14648444, 0, -7221014, 230462, 2156306, -1549796, 0, 0], [0, 0, -593607138, -28682328, 35520321, 0, 234209, 3081961, 651843, 1335249, 0, 0], [3211409442, 1295583075, -1295817, -2540874, -2439117, -1245057, 3775551, -1143300, 1143300, 1397574, 40617, -508548], [-13904183990, -804735104, 3676156, 3899568, 5554942, 223412, -9130882, 1878786, -1878786, -2020782, 100216, 283992], [6439255162, -2371189900, -265700, -1875552, -1126282, -1609852, 3200290, -860582, 860582, 1014970, 1808308, -308776], [0, 0, -379034322, 28715263, 14221820, 0, 9731712, 144840, 79624, -4920076, 0, 0], [8368372310, 3932539538, -295478, 345492, -43633, 640970, -913307, 251845, -251845, -93647, -1252418, -316396], [0, 0, -539750152, 22996596, 11295854, 0, 22422, -5115462, -1851278, -498478, 0, 0], [0, 0, 170915936, -18435248, -8307224, 0, 9252348, 4308288, -974764, 2119024, 0, 0], [3179090990, -2865848692, -2582030, -379970, -2682261, 2202060, 6348743, -100231, 100231, 279739, 1084452, -359016], [40695516546, 346509867, 2154087, 963594, 2602695, -1190493, -4004985, 448608, -448608, -514986, 751797, 132756], [-9450345882, -2816569766, -883420, 2350730, 79419, 3234150, 1829665, 962839, -962839, -1387891, 1025664, 850104], [0, 0, -339002242, -19892282, -4878194, 0, -4724136, -10663152, -3257476, -157394, 0, 0], [0, 0, 559195238, -37580627, -75052004, 0, 12098952, -866580, -1941976, -2061116, 0, 0], [0, 0, 647519252, 24581425, 43163032, 0, 2432400, -3052326, -4109860, 6006124, 0, 0], [0, 0, 260753542, 17680226, -27256364, 0, 7634546, 4879010, 503226, -196328, 0, 0], [-12258639898, -6159084718, 325774, -226968, 130511, -552742, -2101403, -195263, 195263, 31705, -1645118, 327116], [25415536046, 5837385096, 4805394, 3287238, 6532731, -1518156, -7146723, 1727337, -1727337, -1559901, 4191402, -334872], [-1959775558, 1352942588, 7663363, 1690301, 8505500, -5973062, -17300175, 842137, -842137, -848164, -1131312, 12054], [0, 0, 715998614, 119572350, 144864950, 0, -24321348, -679368, 4764112, -428974, 0, 0], [-23755945838, 8057481736, 1188712, 4777884, 3582004, 3589172, -1980760, 2393292, -2393292, -2384592, 2789956, -17400], [-54857135362, 350937508, 8810774, 5442222, 11560027, -3368552, -17078923, 2749253, -2749253, -2692969, 3291878, -112568], [0, 0, 439482518, 60728602, 245749100, 0, -20002978, -927198, 3019302, 1526036, 0, 0], [0, 0, 320962894, 51191766, 30345610, 0, -16021596, 7964484, 10447544, -10143578, 0, 0], [0, 0, 595341004, 82327159, -31760280, 0, -1471404, -4472754, -424224, -2676492, 0, 0], [-42797927734, 1864907651, -10112814, -11856527, -16138003, -1743713, 21425408, -6025189, 6025189, 5831338, -4825409, 387702], [0, 0, -501044090, -20048586, 94447172, 0, -107498, -14997082, -8363746, 5966032, 0, 0], [0, 0, -288384856, 14064710, -178198773, 0, -20264971, -7196443, 3429179, -5636905, 0, 0], [29221471306, 1017986708, 6631540, 2622824, 8549158, -4008716, -12005862, 1917618, -1917618, -705206, 3174836, -2424824], [20170333674, -4637015448, 5613576, 12448872, 11981406, 6835296, -15404178, 6367830, -6367830, -6081042, 2190804, -573576], [0, 0, 1036706380, -49983340, 42106204, 0, -10327188, -7548728, -2865276, 4778056, 0, 0], [-7912257274, 4011637014, 6096858, 4772064, 8693007, -1324794, -24767151, 2596149, -2596149, -2175915, -9977286, -840468], [29078300498, 2100641432, -13224142, -10199178, -17972284, 3024964, 22145818, -4748142, 4748142, 5451036, -9050608, -1405788], [0, 0, 1112116395, 116701173, 82836195, 0, -34378882, 3828598, 11262588, -7138431, 0, 0], [0, 0, -997059166, -62735034, 193529156, 0, 569202, -18727794, -8198678, 1484300, 0, 0], [-78549305662, 7614935192, -390961, -4446819, -2298742, -4055858, -5952845, -1907781, 1907781, 2539038, -8642548, -1262514], [67017598450, 4336294555, -13124763, -6460168, -17215541, 6664595, 30761929, -4090778, 4090778, 2369390, 421625, 3442776], [0, 0, -2906727773, 178845017, 14788636, 0, -5582871, -4706729, -10139247, 23432824, 0, 0], [3272381054, 5381474760, -9093690, 2739106, -7615793, 11832796, 12496657, 1477897, -1477897, -1261209, -4212826, -433376], [0, 0, -767391804, 7761417, -86026056, 0, 71501970, 21096546, -5336070, -1314264, 0, 0], [26818652178, -1737152049, 10445195, 4973822, 12699099, -5471373, -9787081, 2253904, -2253904, -2719918, 13357213, 932028], [0, 0, -226595654, 51242262, -62295880, 0, 21855514, -24075886, -5957062, -20110988, 0, 0], [61930816746, -11381851140, 7263085, -1350965, 6936420, -8614050, -18380945, -326665, 326665, 1024300, -4181440, -1395270], [58772090674, -9012898752, -6717198, -3396450, -9115272, 3320748, 2481438, -2398074, 2398074, 998376, -13351032, 2799396], [0, 0, -1033621720, -108203240, -100335848, 0, -90979692, -3652632, 5472716, 28155424, 0, 0], [0, 0, 4308256293, 161739867, -25949142, 0, 31456045, -7921993, -10885935, 3564822, 0, 0], [0, 0, -3053595145, -18900597, 120154060, 0, -12946607, -14030257, 13459993, -41206936, 0, 0], [-168850119202, -5214617796, 1791738, 12608394, 7019187, 10816656, -8290971, 5227449, -5227449, -7380945, 519954, 4306992], [97080862130, 3500441933, 2590116, -6232619, 267821, -8822735, 2785844, -2322295, 2322295, 3910324, 5643781, -3176058], [226802872094, -4293489632, 11053358, 14461054, 19130171, 3407696, -33609081, 8076813, -8076813, -6384241, -3425552, -3385144], [-33162105422, 22951185840, 10441902, 5457594, 13715784, -4984308, -16202022, 3273882, -3273882, -2183712, 7955664, -2180340], [0, 0, 102909876, 109215823, 189896144, 0, -23982216, -33160362, -16624052, 20390876, 0, 0], [0, 0, 5253094800, -274873376, -186645932, 0, 6736284, 31440080, 2299988, 22321968, 0, 0], [0, 0, -3429439966, 101571479, -144120012, 0, -39965136, -47448084, -12265536, 3198324, 0, 0], [0, 0, 670410982, -350204890, -150324116, 0, 1461634, 13380150, 29506554, -61117052, 0, 0], [0, 0, 4001560988, 301899657, -142867900, 0, -70983282, -10308762, 12987358, -7285516, 0, 0], [166661399298, 15408782976, 20390352, -6846228, 16275240, -27236580, -42476796, -4115112, 4115112, 2731116, -5811204, 2767992], [0, 0, -663694906, 62404794, -35714732, 0, 99505018, 2936522, 15458386, -85461952, 0, 0], [21337692978, 7801004376, -12232863, -18525837, -21081318, -6292974, 52216257, -8848455, 8848455, 9677382, 18902076, -1657854], [-175250459626, -11111258814, -18974478, -6843012, -21441945, 12131466, 23100057, -2467467, 2467467, 4375545, -17316366, -3816156], [-304580647062, -18684567159, 25300137, 24000354, 36239055, -1299783, -58254045, 10938918, -10938918, -13061436, 3285147, 4245036], [0, 0, -5139345723, -27898555, -857156440, 0, 36633535, 4224129, -7914785, 5694324, 0, 0], [0, 0, -919442760, -657727492, -384535250, 0, 74042130, 32403042, 3446990, -13235498, 0, 0], [0, 0, 6252125653, -164924521, -245735000, 0, -121630389, 2378701, 12899451, 30945268, 0, 0], [0, 0, -7226180968, 161403755, -378774864, 0, 194505300, 60775794, -17336280, 6863844, 0, 0], [0, 0, 3878630045, -394564261, -29460555, 0, 79553834, -84235150, -46718452, -7215937, 0, 0], [-371306483726, -16347388367, 409032, -8846707, -3522731, -9255739, -6117140, -3931763, 3931763, 4914944, -9230839, -1966362], [186729458810, -4832216484, -36669168, -2594628, -37938222, 34074540, 60937170, -1269054, 1269054, 1325574, -13670220, -113040], [0, 0, -4913614716, -116907411, -306277488, 0, 32726172, -54124734, -24939456, -8139180, 0, 0], [174506086726, -33576044774, 26131760, 42204894, 47401747, 16073134, -63667879, 21269987, -21269987, -20934907, 9865628, -670160], [0, 0, -4048131254, 133216946, 602713274, 0, 178542684, 6919080, -51932816, 47479778, 0, 0], [-29937617018, 11373213978, -2207412, -3749574, -3118485, -1542162, 3906825, -911073, 911073, 2838501, -1419072, -3854856], [-165879968710, -8811810733, -69751834, -24547143, -79211359, 45204691, 121584580, -9459525, 9459525, 15087618, -27378613, -11256186], [267333209262, 14227353576, -24918, -15429142, -6996133, -15404224, -29065153, -6971215, 6971215, 8457927, -36086204, -2973424], [0, 0, 9766183186, 71612009, 777538076, 0, 137929914, 76420752, 30971518, -69973000, 0, 0], [0, 0, -8312388968, -565737236, -25013184, 0, -108343496, -51042332, 17702824, -41127644, 0, 0], [0, 0, -3464401908, -413557307, -192084724, 0, -124073082, 54154374, 54299926, -19558900, 0, 0], [-376284087590, -9297799907, 23719465, 19536270, 33475087, -4183195, -71971681, 9755622, -9755622, -9780648, -14777129, 50052], [31054923930, -23180806752, 54675186, 66655686, 88117626, 11980500, -105631416, 33442440, -33442440, -33213246, 37161396, -458388], [-57486569114, -27244451398, -18923690, 27079184, -3400337, 46002874, -14044227, 15523353, -15523353, -11555831, -36368254, -7935044], [0, 0, -2041772794, 525231358, -211527932, 0, -97671270, -33786426, -2337550, 20893084, 0, 0], [253100766058, -17557075856, 37298596, 40716888, 58919638, 3418292, -91567906, 21621042, -21621042, -19095846, 4650328, -5050392], [0, 0, 4965593406, 846221758, 45199994, 0, 64556496, 72836412, 16963156, -1849726, 0, 0], [-15451507730, -33730683224, -38538154, -60461418, -67045565, -21923264, 71302475, -28507411, 28507411, 31954007, -34281244, -6893192], [0, 0, -4349350791, 373202511, 630961848, 0, -44385377, -32503375, -4708017, 1459356, 0, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_42_c_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_42_9_c_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_42_9_c_a(:prec:=12)
    chi := MakeCharacter_42_c();
    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_42_9_c_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_42_9_c_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_42_c();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,9,sign)));
    Vf := Kernel([],Snew);
    return Vf;
end function;