
// Make newform 29.10.a.a in Magma, downloaded from the LMFDB on 17 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_29_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_29_10_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_29_10_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 := [456378417152, 115773751296, -2974719488, -1038861888, 7409504, 2830996, -4592, -2901, 0, 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, 1, 0, 0, 0, 0, 0, 0, 0], [-645, -2, 1, 0, 0, 0, 0, 0, 0], [-318309112134922022912, -119824273783332350976, -37031257559876553664, 2036284603062787776, 114728804711338636, -5585746755804376, -51380960778211, 3628782688552, -24206118505], [-566945984913808912384, 51171846561640967424, 12232140633130223040, -138810329723380464, -52730446038313316, 39514496384020, 72238283274393, 46114646956, -30645811893], [-23835185471020802486272, -1672141488408091220480, 237917267859066078656, 7225812409972194912, -583997383883102588, -9649471699062160, 511126104077119, 3948353615584, -145943679107], [596537573429976887296, -984362576950249740288, 26711124769445420608, 9643203691587552256, -250864100373963860, -19178886358511208, 426846090538933, 10132200890616, -206831158817], [-1072681155315824624640, -182922462425474090112, 18409968314351361408, 583798768217020680, -73700257565341764, -819303572581354, 97500534227889, 422294149298, -40920390157], [155905174428934848512, -1789026083597896539136, -194758365437806467648, 9807347762134578240, 849024072423653588, -11663314406222248, -990199083095925, 3949803218648, 346626955361]];
    Rf_basisdens := [1, 1, 1, 6207629273111834624, 3103814636555917312, 6207629273111834624, 6207629273111834624, 775953659138979328, 6207629273111834624];
    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_29_a();"
function MakeCharacter_29_a()
    N := 29;
    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_29_a_Hecke(Kf)
    return MakeCharacter_29_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 := 10;
    raw_aps := [[0, -1, 0, 0, 0, 0, 0, 0, 0], [-27, 0, 0, 0, -1, 0, 0, 0, 0], [-83, -5, -1, 0, 4, 0, 1, 0, 0], [-796, 81, -8, 0, 16, 4, -2, 1, 0], [-6595, 886, 45, -30, -11, -8, 1, -4, 13], [-18431, 725, 0, 72, -172, 24, -60, -50, 15], [-43896, -1311, -53, 298, 124, -90, -113, 7, -95], [-250574, -2924, 21, -242, -436, -160, -59, -280, -433], [-188250, -2689, 1306, -540, 3290, 104, -288, 895, 170], [-707281, 0, 0, 0, 0, 0, 0, 0, 0], [-1329251, -40435, -2858, -1400, 9179, 740, 2632, 617, 5046], [1610496, 89172, 300, -7232, 9676, -9128, 1496, 1930, -6674], [5825006, -231453, 3331, 8622, 37736, -2870, -7457, -5601, 6847], [2418533, -225220, -13109, -18446, 63353, -4444, 3467, 16270, 16631], [5001575, -436393, -13375, 17254, -75281, 11792, -7341, 793, -12839], [-12351433, -57519, 13908, -31500, -178340, -25760, -11320, -21780, 4313], [-26187370, 1163815, 24100, 8524, -332146, 72524, -20614, 22807, -3020], [-26756236, -88871, 68825, 29922, -191196, 10626, 47501, -16525, -52277], [-74697432, -1452058, 112640, -37944, 440, 19172, 92104, -20150, 119928], [-52791986, 2165872, 54480, 96, -148578, -130176, 114576, 91792, -44688], [-47182012, -558930, -25102, 142332, 33816, -164828, -95962, -684, -71828], [-18670643, 749607, 325605, -116134, -294151, -114796, 52343, 331809, 25073], [-52076434, 4049549, -15816, 53164, -585694, 159008, 902, -20567, -7184], [-75866946, 9870751, -1381031, 188462, 2293404, 233770, -251495, -55833, -539], [19287570, 10830253, 637349, -344738, 576056, 464778, 3937, 218181, -151279], [40548096, 9656026, -737346, 831696, 1086748, 652544, 321346, -106936, 138172], [-238131030, -5057502, 118878, 287652, -3486190, -213572, 290366, -419858, -269030], [-153443488, -747501, 1373648, -100364, -2936276, 241344, 743170, -678425, 49144], [-17604747, -5020759, 1357683, 271300, 2784100, -558248, -831939, -258402, -3588], [-316230482, 23436748, -1532494, -605768, 2373956, -1225488, -47378, 375300, -401682], [-993223146, -46829178, 1906893, -676682, 4234012, 1526836, 1867741, 429454, 1079647], [-611573818, 10435962, -1486693, 314502, -9620772, 663028, -1499089, 1004414, 1144389], [1105087320, -1409496, 3107242, 1978408, 9847320, 1262480, -1861766, -2670670, -523844], [-1824983166, 16061613, -3620782, -1229944, -11041594, -380648, 583720, 269729, 40374], [751870353, 12098631, 1495782, -3715372, -27002908, 1685968, 465262, -1506608, -1406047], [-223261100, -29642785, -4523688, 2133944, -11877556, -1190028, 513074, 369799, -4867712], [1578612022, 5843089, 10666665, -2449522, -6205632, -2476362, -1775735, -1180843, 4400309], [504202531, -143359542, 4257870, 788596, 16376325, 2582384, 3902810, -4450570, -2294018], [4815710630, -12066748, 8068958, -195260, 26008226, 3534644, -2495814, -2756128, -6450198], [2250709258, -31816158, -7458538, -5211124, 8837312, -3040636, -167002, -444774, 2222750], [3188598786, -140830804, 3606908, 1593496, 34522822, 2532936, 417372, 5057756, 8258396], [-4625467289, 94482211, 270881, -13120500, -12661932, -2016420, 2886859, 3906430, 12407980], [-4875302314, 162211562, -5285331, -4847646, -45215732, -1152424, -2102731, -615350, 12522891], [-2183600618, 609935385, -785245, 309582, 22757848, 10987754, 1188771, 5037293, -3754609], [184271738, 174159780, -6192344, 10841496, -80011544, -4758024, -866840, -5293688, -4344852], [-6675682948, 300522229, -7376936, 11142184, 61874396, -3613548, -20498298, -11179959, -11559700], [-7179011105, -156761814, 53538050, -4781776, -64803927, 8299396, 4169542, 3918638, -4374506], [-606259450, -331292542, 15011876, 32484336, -25453506, 2378084, -13545596, -12669834, -10678108], [-7686255538, -888266620, -38557040, -24207592, -122700990, -19757284, -8243188, 9292096, -5128240], [-3406792246, 105318645, -12211249, 18850626, -124443692, 11319930, -7343533, -9477751, 8696595], [14763912693, 141702866, -30956055, -10958558, -7839032, -7802398, 17739741, 34659563, 32408452], [4083266602, -1453799323, -9708704, -6924912, 13486974, 9053912, -13318422, -5279499, -10110084], [-10356463329, 493715862, -18174455, -231834, -84793888, -5591190, -6827739, 343405, 27599862], [-6588521083, 343067076, 5141630, 530144, 156445907, 6201164, 38491926, -46630496, 1301026], [-6872488095, 118803054, -79449560, -10019302, 347590652, 35648946, 5837886, -17067681, 6621577], [5607392473, 1416739845, 74019886, 39671308, 264498559, -8075144, -26593512, -35382127, -32200046], [-15108512280, -2486786329, -50198987, 7121122, -28550464, 9388042, -15385555, 18398313, 2355015], [-61289490165, -1241204295, -98655652, 27522728, 26215857, 50015768, -13366722, -2063455, 26718120], [-11571926994, -1181260436, 53897300, -22784368, -295218144, -69439136, 23252908, -12304104, -39761024], [312609477, -1506385220, 135315929, -54122130, -55966024, -26118574, 38664005, 21337189, -8939828], [-39334510990, 356000231, -117756584, 37023660, 210546134, -40746876, 37379870, -1600985, -21749368], [9012744962, 3040786982, -81174312, 63030396, -211792340, 26522868, 6869892, -56080982, -38740504], [-47425490875, 3302295544, 81365329, 47618022, -179194379, -12058324, 84010073, 3277102, 16069973], [-61286310634, 1097526978, -110331115, -5069774, 106744796, -899736, 13111565, 717218, 12489603], [32826460641, 6202651954, 77915342, -37082870, 234145772, -34447722, 41345812, -79048277, -28507617], [40179825932, 1703658163, 53799877, -30772558, 44220348, 34150058, 145703781, 33375237, 117391815], [4692599615, 2953046408, -420999822, -31517984, 403893897, -83458300, -57152958, -9648148, -36097458], [71593293996, -7514861915, 19119477, 23639202, -520554924, -91211674, -12580787, -102100169, -83637533], [-66797546406, -1871846348, 363665976, -96054472, -479570430, 47584048, 103037872, 50560648, -39235740], [140249565307, -198381029, 284505478, -95417792, -373974860, -69992200, 92388814, -91859638, 106153387], [82771188646, -344294620, -27997324, 54683504, 230834704, 55364692, -18055704, 93561404, 2157008], [-63507304251, -6101086111, -190222789, -85305706, -760658179, -69296948, -101504375, -76896441, -56348353], [-11980683894, 5352685056, -66546939, -164853526, -1513872488, 167667064, 162769921, 69197848, 71825827], [118597240247, 2107361691, -48360697, 66994644, -136902028, -28646016, -35032319, 67118918, 149124522], [149672166, 5237662044, 354998753, 213507286, -1491186072, -176344720, -66237503, 81021984, -167184109], [-145989835024, -8783428761, 176316024, -342379504, -252046964, -264290648, 2805566, 94386403, 35826192], [143952675404, -2623738470, -314840804, 76609956, 557725136, 227688164, -119320996, -247537064, -103111982], [147644595431, -789004883, 203532387, -22499160, -1907929676, 43983920, -131296811, 106652080, -269141138], [19192803265, -18102526918, 230878305, 112898314, 1709238536, 213936478, 10568369, -142285673, -214242020], [206962791062, 1243651672, -223170720, 60666696, -946462308, -15834176, 136758472, -75124984, 91876880], [-62080992442, -3394204908, -1015032734, 310870252, -172393246, -116818828, -374928106, -75046020, -382899510], [106842471132, -1340221587, -650700523, 126010198, 1145880740, -77889730, -186044071, 260218623, -277653285], [-228585935586, 2841865077, -215277542, 35316516, -453303714, -506490220, -456292168, 15715801, -267569638], [291563542416, 7077859026, -1388858866, 272808292, -172866616, -44954412, -67588830, -15726028, 178058292], [-85519103614, 11484919821, -412195366, 315226308, 2194212878, 243480040, -177493020, -95654031, -353664322], [-60707877034, -12476278150, 1330586523, -633619950, -521848500, 49429280, 398394423, 404019518, -44745455], [347576831014, -1614618976, -550764956, -178116804, 1841135188, -75094612, 585386180, 292012936, -80455144], [268245565398, 3631663200, 1232159796, 19721000, -988326128, -115116476, 577766680, 135361792, 204614296], [57984735910, 12452606398, 1027614956, -104888792, -1104056840, -386484288, 653313080, 351743210, -191456432], [-179337253466, -6513935795, -1225779912, 1006870208, 2921625698, 134207624, -382147254, -151669303, 96460904], [-70301818587, -7108225704, 1041717791, 246321874, -1749864839, 731086900, 155769855, -335385350, -179346365], [-345047736793, 7744886295, 583179796, -631267564, 4411528429, 371919244, -18367246, 150912631, 1177311284], [-806721646920, -19315839, 189284740, 404833936, 5857815952, -47038576, 584089550, 258419677, -182258604], [-566680630769, -4986080740, 225872337, -1258511882, 2051150459, -622159788, -26215399, 493367682, 676014973], [-629577052378, -4445832889, 133911694, 1157908528, 622036214, 509914228, 145015196, 118534459, -588137538], [211648435727, -4098741553, -942474788, 1134387308, 3190115741, 954286396, -181062750, -180188681, -617056748], [162978730767, -6427570535, -771893022, 1024246804, -3672013932, -440686284, -573988114, -855474740, -642250009], [-710305366641, 21641039364, 951098102, -876149142, 2195165348, -1116858434, 430339772, 886826215, -167322363], [348566922424, -19801111250, -379051822, -906550212, 5392673148, 230964256, 59453030, 641176242, 773184098], [533160794148, -34794967884, -570405842, 903361456, -7472499516, 273197864, 480621182, 728988206, 196103360], [-1139423437844, -20888601893, -208503046, -206370864, 3900184988, 338529628, 494594248, -389225637, -52180306], [-369816088506, 62629229594, -392716366, 30134468, -1674766424, -465172512, -370546082, 192934506, 340243630], [2025470679179, 5572291892, -4364184726, -910112384, 450430029, 38709956, -1889279902, -196139528, 62361222], [367136380098, 32654380426, 764935478, 149140088, 5263953896, 1585257664, 944193710, 291956594, 558051138], [-460593929960, -3585481682, -121091524, 525938728, -5594397884, 928040728, -419934024, -1501735262, -1146618144], [-405950330568, -48798866515, -867574961, 719557550, 1781131276, 611253506, -2116810365, -1111882269, -992044607], [2191371881406, 45970769399, -1329522326, 259773496, 7527417886, -438286360, 1539352716, 992065367, 345205114], [698849958695, -23696866144, -713159444, -2365357638, 6709479900, -640464178, 41790510, -389487101, 1000015735], [2241820621641, -1726577459, -2189627313, -308003670, -11271645887, 249941032, -698904547, -1239807709, -2072265529], [-1913328783542, 26398350601, 1097415427, 133765402, 14461882864, 532251430, 506767875, 454078713, 2409356215], [-664569025289, -83075723837, -599181860, -699961372, 673228669, 124089676, 608714674, 988386307, -611915924], [-1459993892775, -54836463077, 1666605413, -147468176, -15043009548, -1876137124, 384642207, 291263412, 170268674], [-1861500563064, 37669735972, -932189154, 1281659800, 13156456944, -1116314568, -1656431770, -894027002, -1293367080], [-436237222161, 47912303680, 1950905356, 1750365364, -10970410939, -2321254060, -759609716, 31790472, -179072336], [-929312265582, 21580443230, -3530911392, 366439304, 11660398450, 143683180, -1018647784, -883830826, -527806116], [457545938208, 27041571129, -4590937917, -10869686, 11197069448, 1110965614, -776508185, 1229283163, 102288277], [-955085401740, 19808193969, 4584314178, -1066902536, 5715429600, -426052428, -1223238932, 47939665, 920760838], [-852927484694, 3513664807, -6580174946, 1381388804, 2279856922, 4173788512, -149804140, 78623031, 1493897902], [1036308692346, 53480511359, 2619233671, -1260496146, 4095253468, -2527238490, 2683313423, -34604245, -1098241393], [314542777705, 21643528138, 3090828144, -1711322784, 12674337739, 1817319936, 164501588, -1143315822, -1942487936], [-4673793322234, -60115411254, 4494221154, -2973280972, 571573192, -770980256, -874606682, -1707298914, 294977258], [-2541440106293, 97872543946, -1812566081, 2317775150, -6823936792, 1441640854, 448159219, -2491494755, -604912864], [-1567209673982, -26662529398, -1542076020, -3883815540, -4839883688, -1611120324, 1183883880, 1818684938, 2881885984], [4173156885108, -16494126040, -2777625110, 368370508, -26529146900, 1761434512, 535514746, 292211104, 1599113950], [-2019757453408, 196084776778, 2183979756, -1951404984, -1388499884, 738113140, 249726468, 4057673870, 2558314092], [-1897355830215, -56859017117, 3822924776, 1264586620, -1504585452, -719924192, 1043334300, 786475044, -953111889], [246725048813, 70499025381, 6200581414, -5261052392, 4889606444, 2095939464, -1258782234, 1800688714, 515920085], [-992663500314, -87086869178, 9577725776, 2949515032, -11100556982, -3344229188, -1796186712, 1554957158, 205062996], [189220389758, 67154276258, 13636743057, -3407920822, 2435778348, 169995440, 4532635057, 2752908546, 1954341007], [-4797491154384, -44568718700, 6086985196, 2307529580, 11412095276, 277188140, 887234120, -1195259342, 1191050658], [1403422283185, -8965366328, -4609810684, -2800106472, -4125604877, 1972795184, 5014035140, 4364989520, 3238729124], [265294067986, 48147352540, -9533189773, 4454703110, 27014471188, 3621905920, -2264402617, 2297827044, 2507493437], [-558552977722, -65751095848, -3047306621, -3515099906, -265420584, 82625152, 173225703, -1259588600, -4642497963], [-3420102565020, 29733550919, -4865404389, -6044669374, 14040599956, -2622306190, -3173008865, 1408749065, 4030430721], [-1883075042094, 77505608568, 5413114996, -2971316280, -32384495400, 904352884, 1957733984, 106324604, 1749521236], [-2553907028096, -183287218679, 6740876825, 4751076558, -11646233088, 3807528922, 1909809345, 4735666475, -250846773], [1360620983118, -38164589021, -2951538779, -5305552550, -33163779136, -2428446582, 926943625, 1034497975, 2171847613], [-1935685652470, -229968955782, 11186662524, -2985582272, -5317230154, -3172370644, 2876127100, 1458160042, 2040971656], [1555011318212, -22311210367, 3502691485, 8081581842, 13604661404, 8465463914, 1027794881, -1743615869, 1092410695], [-901930363728, -59447037142, -165695134, -4032594492, -26673515220, -4973645676, 2599106758, -5629183512, 876184756], [-4834269443364, -24444560597, -17657495422, 10693956456, 38262069320, 7202595848, -788322004, -8196985637, -3024045118], [-1662755150567, 341620636765, -2841378388, 2528338368, -7441187988, 4786387124, 3242515404, 1018192790, -4984343913], [3239783566782, -30669509962, -18391781987, -7305865834, -5481108156, -397032156, -3744190499, 1993668910, 1215732319], [13806622299, 133926315862, 13922008860, -6328435732, -430026207, -6978185228, 7995858240, -2280502466, -3245181688], [-4145473144520, -136663117561, -18443727791, 1918698494, 661994312, -2563026234, 3647038873, 2701612929, -4541168681], [686638692771, -88746940101, 2333848599, -415611570, -55384968121, 2259773980, -3961574519, -2769750991, 7396348715], [5028844344830, 157465624956, -2631629704, 8033332276, 16395980756, 3592665044, -10592017880, -9341493148, 307281548], [5711817015053, -3023736064, -441088456, 888584270, -41442541220, -5942514946, 2219816722, 10497501237, -4301761007], [-4202977109917, -569116633448, 6192919899, -3935622790, 6675980971, 3282268188, 3631347619, -3959857110, 3211186175], [6341261125070, 438204789724, -351764404, 6666021816, -13555723786, 3037542332, -9422196504, -4303539604, 507200992], [1055248458047, -352992204679, -21477838700, -11722671308, -18831464524, 992490704, 4214116312, 633225852, 4404132369], [5204085882722, 258274573786, 2121193014, 7568080988, -61255010508, -8719809812, -1133769882, -1909250018, -11777998790], [-4318148624184, -159593712865, -15414461356, 8489439580, 28423737764, 6112855352, -4371293122, -1600977585, -2704138576], [-1871256979775, 248484164227, 16297107496, 7094615568, -20927484853, 7270887544, -12968409970, -1406170541, 1249738204], [-646125339482, -93431479926, -14494411385, 1719936106, 51129975244, -10933426640, -9830870365, 2998366550, -7123995075], [3802405261779, 302449866725, -8659201300, -11826593744, 119563659241, 6382385624, -391002930, 5431487109, -1473291792], [5651971123870, -215017636682, 18203278904, -10315290312, 23414680318, -12791244144, -5444611084, 5583120714, 1980147196], [-4430552918270, -172162455724, -15159548972, 18001801752, 7205556784, 1406830000, 678955060, -13251713120, -5311188336], [1892190903942, 166421724546, 18724333762, 5740622652, -63559364488, 4667090544, -4735250058, 5593684634, 6270566870], [2558785221725, 10668571369, -31766373353, -2249492804, 47566481836, -10711988344, 826390497, 7857114718, 1991273544], [-636361232115, 42422681522, -23792903841, 7050892482, 17835975033, 10430434700, 5765412747, -672543332, 5220934379], [-3150853154111, 358273436104, 29664471481, -12370927970, -85015465528, -3972979666, 21190768881, -2606023475, 8285956596], [-930479707313, -796681800941, -6456927183, 1901305318, 30889436663, -8168205904, 11245220955, -6302982547, -6771633759], [-1346918738862, 600205640626, 30781614833, -2092887506, 19375435812, -4211929800, -4077292675, -2917699010, 11714913099], [8499817775501, -778497044844, -41264322792, 23399176606, 47384784020, 5082796354, -2973424690, -14226437919, -9371958859], [989767297703, 763464442343, -28213289085, -10070879998, 40998852131, -7579540112, 5506004189, 19439432365, 398148531], [11805321913922, -255508046422, -14511912866, 10618439908, 35452692834, -1162812200, 596552362, 4252282178, -8886477942], [5844036191356, -126131815552, 70195430, -5763095732, 32310134244, -6489927044, 14388661006, -7894952910, 3950931132]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_29_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_29_10_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_29_10_a_a(:prec:=9)
    chi := MakeCharacter_29_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 10));
    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_29_10_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_29_10_a_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_29_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,10,sign)));
    Vf := Kernel([<2,R![-456378417152, 115773751296, 2974719488, -1038861888, -7409504, 2830996, 4592, -2901, 0, 1]>],Snew);
    return Vf;
end function;