
// Make newform 98.10.a.h in Magma, downloaded from the LMFDB on 17 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_98_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_98_10_a_h();".
// 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_98_10_a_h();".
// 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 := [70980, -4037, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0], [-5397, 20, 2], [-27153, 688, 10]];
    Rf_basisdens := [1, 21, 21];
    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_98_a();"
function MakeCharacter_98_a()
    N := 98;
    order := 1;
    char_gens := [3];
    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_98_a_Hecke(Kf)
    return MakeCharacter_98_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 := [[-16, 0, 0], [24, 1, 0], [-363, -5, 1], [0, 0, 0], [-894, -164, 37], [-6212, -565, -1], [7347, 1115, 167], [406870, 234, -273], [658134, 12847, 652], [-864336, 12191, 947], [-3117008, 29420, -2455], [8596349, -24804, -1062], [-55836, 32649, 9093], [968372, -40716, 1524], [16096512, -77040, -24693], [-34034487, 67746, 15204], [48066516, -32087, 11500], [93531535, -417556, 75290], [-56768836, 546197, -142306], [156350460, -721994, 14686], [204996025, 1088182, 61354], [-65132926, 1794499, 252532], [357629064, -1569286, 275042], [269662485, 2845428, 411600], [753753784, -1333445, -323297], [322765533, 1661623, -1114247], [1153888966, -918729, -296790], [495701430, -9586254, 794385], [522015251, -2155249, -1364215], [-1308907560, -4452331, -255151], [-1503049876, 550906, 879826], [-310933776, 13022485, -1146386], [3678540129, 26853413, 312917], [-1436645768, -10947674, -226658], [-2370695997, 26720805, 3365463], [6069105356, 1823168, 2617295], [8935335655, 18148752, 6498], [-5296645108, -65085003, -2146524], [-4125321474, 25422265, 4805533], [3867206739, -13142402, 828844], [3024148206, -107177628, 3027585], [4122506938, -6249856, -121456], [3627852504, -98782704, 521805], [-8028963415, -100305549, 7420983], [-5001854208, -101500421, 3185983], [-2374477208, -78373374, -2130957], [7730493920, -73167054, -19104870], [40379091460, -30275154, -17305578], [-1073594874, -122346834, -3326991], [24113631865, 258818137, 22661959], [24387054309, 163923571, -20555549], [15335430030, 30513261, -33509727], [25952560273, -45350604, -19185780], [8683153686, 356413227, 28220919], [-24284704317, 322213647, -48250317], [10327011942, -184735701, -54738402], [-22620891105, -25449680, 5297770], [1165520122, -586415233, -50794906], [-2397559087, -531715146, 1038840], [63465315528, -71106431, -77735891], [-29221031714, 230022472, 52226407], [-100245390390, -501622200, -68132088], [-57141265388, -372059420, -37711868], [-66037454514, 63172519, -38658092], [-51795994535, 220056034, -2502362], [-47716504059, 634574994, -136228356], [92742043124, 322883535, 146781762], [-81337079668, -1704822269, -152640521], [12659937996, -1457870385, 149682012], [-176676981728, 663420313, -83851931], [-101665229241, 371560461, 23498073], [-59925322968, 507555830, -219634297], [91172581990, 1177763313, -195673830], [59480781713, -1088537290, -167303308], [-7689724762, 844694927, 6203627], [65204160876, -417173458, 212747801], [405417736611, -1039156495, -269133889], [364309201141, -863660275, 38983775], [-327588026187, -1013901807, 326747973], [556622083711, -2048589681, -116479257], [375212207124, -1624189476, -36831876], [-195017540332, 2447506489, -181065419], [-200628597804, 5600532078, -138734319], [390888315712, -1415666529, 612821715], [1044801813784, 1553625806, -41513899], [434934149130, 1501082788, 129379699], [-299641420596, 1978151867, 33297743], [491135659295, -4246476514, -630441742], [-308540020920, 3379217773, -820548887], [-140685341536, 3614808872, -464282968], [-262685605476, -7495081997, 243003004], [-592925068158, -2380287985, 174854504], [329944405070, 2358725679, -1262135454], [566769891654, -3030064137, -41778381], [-53548318012, -3262335739, 544351340], [176319959868, 6215992950, 967312734], [-1357363916943, 2376568563, 268562133], [-381068741667, 5656182684, -87264600], [2217365217874, 992279634, -108879309], [-1063042558609, 12120152005, -242776109], [-1392031018942, -8850551363, 640679377], [984175003971, 9064237319, 77839169], [646187362716, -17799568453, 19711898], [-1686356203881, 16245304662, -410505582], [632801078978, -4183048976, -1845056735], [834720338785, 21651990688, 1177750336], [2642279376516, -2658343696, -690404992], [-520089020529, 2808689157, -2218027863], [-2921723982510, -862254111, 594112548], [-1670166663344, 474345651, -1707712905], [1063064788996, -21551208646, 2218651109], [1415779443911, 14615760703, -619054283], [971558896188, -26040080297, 720872635], [-36700295648, -1018743329, -1388051054], [-1851119378164, -11610914010, 2019873102], [-2542547195337, -10749349436, -2251329164], [3518264885140, 2984373276, 826786140], [338725204854, 11927648103, -1847335668], [1576094827461, 20679414894, 3221494464], [4545881839992, 20285351014, 77552446], [-1509238576277, -43425898556, 233241034], [-4223111058484, 10033024923, -1999192497], [-3103016811711, -18410366139, 3127639011], [-7478087873658, 10595538498, 1333059843], [3966772280032, 29765184777, -1520173110], [7101937399398, 3891229100, -1151755684], [2761064567405, 21567104604, -441427254], [673272869322, 43717867335, -2661623826], [1622999825500, -37423298762, -159898274], [5869406419747, 65904913730, 1504562648], [1033994907650, -19370357666, -317728181], [1113011276004, -8727808638, 3786581850], [103977905864, -12499878980, 7822635313], [-5075736371440, 13784298139, -6391604417], [-6226004186721, -35759222953, -254085769], [-1546728053300, 78692077129, -4798004795], [1964484679077, -83364927557, 2868309085], [3767116515352, 10991481749, 5467831484], [-2568548875896, 67903685301, -1432647759], [2630069494839, -52251596278, 234592358], [-8719014382316, -3719330360, -1984790312], [-1953446200425, -3502022357, -3848309147], [16019830068962, 20302311809, -2216752204], [470345201820, 17265866712, -8254086360], [-511563672323, -84307458803, -5402649221], [1671188907048, -48927979048, -2740465192], [-1766360724284, 67759156611, -10036148265], [-3748893082959, 79080620526, 9101682042], [8965129383766, -69015475068, -1330037307], [4131935407290, 79160183747, 3051034508], [-6672587716129, 42474317801, 14692544639], [-10157069082834, 33596389560, 13329883368], [-9329788780360, 57309905958, 7483564062], [1282570620348, 63861912012, -3422350053], [1623945004940, 54148663075, -10701373160], [2829667425408, 192023625624, -7200801000], [-205693382920, 4281633362, -3040449829], [12660104850429, -64119003054, 6406022058], [19515842440462, -36754397340, 9974203284], [-1083431006469, 12677909842, 2947775620], [3151797242736, 16951110959, -25402322866], [-2458969380816, -113520172547, -14479246151], [17925514441028, -80236747134, 13701916698], [-21061900436244, 105361244769, -5375696274], [-18746097710703, 6410167275, -12187661097], [12388763600412, 24898342476, 13566978381], [-16700331314746, 50100624957, 24587749332], [-4158827529101, -206609087196, -11263594302], [14871049307648, -26993827551, -19091309523], [8985990432891, 46859156844, -6806920074], [18228674813508, -29692607509, -7125746536], [-1553039705204, -236474319845, -13538008721], [-26371303250466, 107971433103, -3842796], [-4131103694485, 218301517888, 1240430404], [-6461374269440, 132979985984, -1821289195], [2987140849500, -25119831419, 738189169], [-15433433773558, 31721867125, 38028010729], [14098997532345, 162434485918, -12791720600], [-34237539554228, -34368059994, 14577918318], [-12644100180287, 90979046871, 31741835745], [-21570358117846, -8024286461, 19605886012], [-54148422799200, 133833208214, -5635440562], [-3338422034746, 175371908264, -19093646152], [-19427438715411, -167314223372, -18289837496], [39657274298154, 191486963183, 16576658678], [24428175728955, 316103376444, 9437329506], [20786419833995, 105834310183, -42540971207], [-18478272532358, -295105276956, -17610105969], [-34153707543019, -361083818885, -2645466869], [8968560008316, -132972803058, -38028514221], [-7716938937407, 172478761216, -36684064832], [-7334609547312, 5268625878, 1529519214], [3912512218898, 2219346818, -64475298547], [-1243197194499, 265975383341, 52879795943], [50956142393982, 19173932832, 20504473317], [96409809756003, 6652935353, -31747064143], [-67992037878247, -193154124177, -25903521861], [45547753122707, 274180053875, 2694845321], [80357453245260, -318518950839, -558943611], [56981140088934, 183808345743, 30306017778], [-2976398414457, -334346479467, -32815575849], [-56448648585596, -659122836346, -10413672466], [36892465355575, -44612969394, -50258254128], [-34892560324397, 125832779615, 52497112211], [25356773909808, 184580328186, -42847778334], [125237523918255, -64374515964, -41634322218], [-45190215734210, 331146090585, 2270420880], [94629752979054, -264372091608, -33152232765], [-42216745114350, -583673500068, 50010398700], [-166948838892908, -45628923699, -10536977064], [12790386433817, 606934887399, -38427992109], [75630428376816, -768825869531, 65600779105], [-54472709086432, -159175775012, 52562123116], [63996218913912, -500307896225, 71511362620], [62590880955228, -257680765536, 65976275913], [-8594677948337, 896742457899, -16391394765], [2878465686524, 148857127802, 85882907501], [-23575025942997, -726931902337, 34367861819], [-107534012965020, 858899679388, -59185502627], [67905552952686, -847828906184, -26033629640], [37411097814491, -636499711483, 100475221487], [-86036877853034, -177028022699, 39394295209], [18294998700795, -28103383734, -109588052430], [-121130457393736, 718029063164, -33699377887], [108953204306112, -237936712482, -81407229450], [8521240475780, -362243037207, -36195028731], [57429560811447, -245626523725, 120402180275], [171714374069346, 505353268703, -14500183378], [-46301550104084, -179609332000, -9604959337], [61320070328820, 1648276107639, 95638538394], [-70264141528351, -97685858168, 137164363198], [-5723109897848, -233172519947, -150385917716], [73129514867816, -180924815476, -24075665764], [-112972375096215, -368117352495, 65403178545], [-73615147780292, -340226770524, -69643647420], [230166144562002, -469602635037, 12124172436], [-181556857682657, -496994292707, 64793630881], [-128530370033409, -283594421169, -81895771095], [-58923723448548, -750680288376, 119957349720], [-119581317003822, -353695758665, -52875574061], [36003169333500, 258104346841, -32526105494], [-203087774977814, -702785461566, -55819031493], [-74244396141110, 798164779389, -28466605398], [-138581089025551, -1896101096384, -15253654310], [107097700078230, 673423949228, -60844879108], [99686231259762, -7765650243, -246277201200], [118204030557124, 740747016302, 78603943574], [-178895346403650, 258921527522, -106667803915], [-194216831624050, -672928970178, -31065033585], [69509702582010, 818551392879, 115609798827], [-54796581768244, -1035583300183, 28831494245], [-20126726429559, -24653142276, 39654285324], [73632254999952, -93507135774, -14826321375], [126089677171048, -317969383169, -250161932429], [76961242096995, -402051832858, -129156134344], [-90981465763050, -620165173280, 2098306195], [42166481947757, 315991861200, -86424794886], [-1125115981202, 1349125621568, 122782760831], [40306706780412, -1057133830721, 82323838627], [106489732082047, 532895436039, -180454431705], [-161172377409430, 624593121539, 83024074610], [181643335245204, -951655189504, -47923143568], [-34371001304231, -129089991959, 379664890915], [-119329458738944, -2203358040455, 108175333477], [415178533187979, 469744204323, -66183184185], [112872212141818, -942738284708, 223566282337], [255069483876684, -1465699045791, 266575855101], [-160595703955788, 641047432633, 333603405877], [212169947463404, 1552638617216, 67988263760], [-89884292471925, 42094630605, 94983508875], [29003914944409, -2121424263181, -19071415267], [-364402112224006, -573553400202, 113902599675], [23865975888631, -694193457565, -333958208245], [122006894364476, -627186442650, -2024383941], [1839709821736, 1523920884763, -121822484225], [-2678432637170, 405228363479, 86649981746], [-413002158388812, -1125409951469, 25233746206], [168948504433145, -2531934170120, 259032489430], [539599538036615, 573928563050, 104756664206], [41358990553302, 24755479242, -30441410865], [104866834508196, -1071071895678, 167722177767], [89600119281668, 363264906496, -235492531721], [58017959634528, 117471366180, -157582520460], [-507573042824816, -3230180018451, -113260792407], [478000176299098, -1416524091634, -514203498049], [230149310312340, 1257665861566, 23161927195], [-50561865204721, 562177804180, 340748884780], [-321131280246864, -2083590251093, 228176655535], [603465954081130, -1928799691359, -119752010634], [-308525955186600, -1997046846741, -335076370929], [542113952969055, -1024709895951, -118393596237], [20974027573266, 5174641098924, -191099041233], [-461400870677709, 1219109390352, 116457458292], [-475953217171638, -194869016015, -279646320683], [-614622274241140, 2303621096673, -100168176867], [-142955192952579, -899783953467, 291620404131], [473737602852712, 30724161336, 338589081771], [-346031975219076, 3545286991095, -38349743877], [149597896133028, 2830428531489, -442114334202], [213730485246070, -3952146552697, 400790403203], [131383732173313, 2207246135410, -416559475874], [-770880329360913, -1384612181799, -34160802081], [28578867283052, 1776102404474, 512967235133], [761691510619488, 1893506418930, -156832098150], [582168997971746, 2515038295824, -250134555105], [-127332763268716, -5957602586841, 77938670091], [91389060443520, 3354649733297, -32409801346], [873814713482968, 239168730453, -551248527], [-106149722128380, -816494380268, 182183607109], [-64693902505093, -5580866365347, 367741475703], [-194072077773906, -2431877705163, 431889722244], [-190134402485931, -3122539285012, -556331947066], [200296682301477, -1342196544859, -759649902271], [-229409947678600, 428657032479, -282036026928], [-22836646200936, 2052000565928, -50675352568], [392668365482155, 1250000499909, -444236400531], [245537127091224, -1749151044366, 386196313050], [110891995089372, 1527505713686, 347391683489], [443519681440996, 6842022871245, 92768279961], [361142213263560, 1585351736541, -298307661159], [-960502203967178, -1539153570318, 411490980237], [-622734934952323, 1264003359803, 967246036499], [-515953667928960, -937644928311, -461772734571], [549414127594814, 5706269101517, 85546226177], [-563230124384949, 3765560329736, -784337817220], [121576668699853, -2672602043298, -593720155698], [-113462476057900, 7128989923497, 135324451896], [125194951389172, -4094400635855, 390671473798], [-1313969531332842, -2301300737675, -66143077610], [388200062952516, -679796677439, -39956060003], [960689883260285, -4619461034310, -10788339924], [-935235868914921, -1436344706495, 436230857227], [643774160025148, -8048431235086, -106971454102], [-1140816578081100, 1456373589539, -758132430118], [-215282567565526, -4740375540088, 412207888481], [-810571931221164, 2483729306176, 661988951440], [168424142559932, 2552613802945, 824453343901], [-269395291149933, 1890022488127, 789575682643], [-631269560930498, 2202476085420, 389826318396], [-782245704794126, -9201549628853, -511044491438], [1003582643050367, -2099288092977, 778822038093], [1019687149211832, -4631723217591, 637307527797], [-202576030771428, 9164577933327, 322161248787], [-796418573639476, 976491664030, -451775494586], [-397077059944767, 1399004292612, 857452141446], [-101652956652024, -11763081490746, -407455627746], [-757704100401917, -12531259249908, -141418587606], [-18862275605398, 2536282607208, 639178117935], [-55285321452642, 1764688087509, -173777376279], [-42150925987809, -5231945669166, -1345250230092], [-643177863104588, 10085078769507, 14868925764], [111215973451409, 918925928013, 228145199325], [-351996292160928, -2709642599697, -163451206365], [1124063875153354, 7366645632791, 257643750296], [-234783635025343, 4924507162502, -1200811790764], [571774302399030, -6984971062624, 645788169776], [-85153715187474, -10818102537335, -1058831077040], [-1463000923710822, 905564238798, -690079475763], [319328357157477, 2581145973697, -539268701627], [-64618880337600, 1675620500428, 960610540540], [-461956806456160, 10004260418075, -1016468162689], [-895703860856637, -5990344211935, 1247995792241], [1215789601175208, 15660094186700, 552271788935], [1311370939374984, -5160265452719, 483697235284], [-1812143114154356, 902817179359, 1608379850902], [1233570376254905, -7006998718191, -217969916967], [786688379313732, 6423583935447, -925419117861], [931285295089544, -8504391476090, 601128649909], [751719917059610, -5715585557320, 426565632968], [-633770245600104, 1581534373375, -1715471243312], [-1162479619174154, -2246566112552, 7510209649], [1314106240287912, 1389914602428, -904603737519], [965487183115254, 8312026184168, -736779943816], [-274696534499732, -13659813406532, -853790869427], [376519190620037, 3145178492786, 1777376930396], [-354668328267942, -1579304789088, 202038338403], [631787994359760, -5516230942184, 621539660824], [402769861378807, 13350823066117, 490973080849], [1271692244867157, -8165375210662, 961791102938], [160114924762144, 1147392977787, 470693329695], [20353090251993, 7208040789351, 891304794429], [-720728329872468, -7866854180353, -161223960541], [2135714542024424, -13126018537960, 1368145528376], [493931135871435, -19365711008166, 529035123282], [-248084324448836, -9048877976504, -294821282120], [3052188420205896, 1103293314202, 156999388315], [-1420565032000486, -4220333003841, -1592496329226], [-429463414234661, -12742222094876, 523018597882], [-1043989677533224, -13934109560287, 1576998530324], [-83907201268272, 2289016965608, -973201610008], [1713093897168746, -7628189008884, 171786998364], [3029209931991729, -418068431835, -1261314528717], [-326858441061684, 14510061281299, 2798930588200], [779430062486332, 11146522911315, -2191604344068], [-889348800711444, 8132639123864, -2453718895063], [-1915102843590193, 533408746402, -1656545216522], [954667416544690, 20401612972951, -77936633648], [40298344284300, -18778869866203, -1862641914031], [1963656339022316, 12044398170472, 1461876529720], [1762149192302895, 10003030617991, -1600865460923], [-1323516669634325, -6576051208122, 2228977826460], [2062378788488421, -14335063380003, 1036237946505], [-1926840805500628, 15481374968450, -1466030148433], [-2645586825483459, 4394480379136, 1245789272812], [-840298432267335, 6124474936977, 523165971195], [-4132887130243070, -1134263282295, 1543942992756], [2829393806903141, -2307879798562, -1261971205972], [-2734777645144164, 1802463468507, -626648758833], [-1424265002544986, -5706448770318, -190258335075], [-991532387712960, -6722264846947, 2797335937334], [1136708776372573, 7765847317582, -493610151314], [725547119986809, -13732599827462, -842393474600], [-2559204229585236, 10485326246272, -1133344617680], [-179753596599850, 10742212191724, 350026437799], [2832707281123340, 3844785624783, 335959044819], [-1848893151296529, -5887264678984, -2161843746034], [-1348198552832004, 5562644040478, 1567245507331], [596401651654048, -11385817062506, -164201213801], [-3183284672688132, 15683644696665, -321724234059], [-651833521878972, 14597576046496, -1621500888881], [-1614033630576903, -16643670480848, -669048241154], [-4480549225174781, 13932786194244, -59054212794], [-837462282411696, -8233790396816, 3312935377648], [-4463629236421056, 2266460538858, -615625161198], [481140120115204, 15910722328377, 3165738720213], [-4581838342231173, -8155469425382, -792413430500], [2996222045883186, 21092092724882, 228302310749], [-3268380304492416, 1629822505221, 2015501621025], [-2218881359565248, -396019619173, -1436660977114], [873687661477500, 8134407554612, 1653733097765]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_98_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_98_10_a_h();".
// 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_98_10_a_h(:prec:=3)
    chi := MakeCharacter_98_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(2999) - 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_98_10_a_h();".
// 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_98_10_a_h( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_98_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,10,sign)));
    Vf := Kernel([<3,R![2391075, -31557, -71, 1]>],Snew);
    return Vf;
end function;