
// Make newform 98.10.a.k in Magma, downloaded from the LMFDB on 18 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_k();".
// 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_k();".
// 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 := [1444802, 2412, -2411, -2, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0], [-1210, 2419, 3, -2], [-7229, 14456, 6, -4], [-1242178, -2240, 1029, 1]];
    Rf_basisdens := [1, 687, 229, 687];
    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, 0], [0, 5, 0, 1], [0, 104, 0, -7], [0, 0, 0, 0], [2387, 0, 37, 0], [0, -182, 0, 809], [0, -43071, 0, -248], [0, -31639, 0, -3679], [-709184, 0, -692, 0], [4167493, 0, 1087, 0], [0, -100134, 0, -41130], [806593, 0, -9021, 0], [0, 1430791, 0, 56652], [-19120051, 0, 9147, 0], [0, -2664762, 0, 163054], [3427028, 0, -58226, 0], [0, 3105293, 0, -314395], [0, -6621532, 0, -340041], [-203605194, 0, 69906, 0], [-331167186, 0, -30534, 0], [0, 24266301, 0, -1351834], [-167102794, 0, -40838, 0], [0, -22750843, 0, 1981881], [0, -69656107, 0, -1118280], [0, 89705213, 0, 79754], [0, 3726864, 0, 185031], [0, 16661598, 0, 7385834], [-1383565166, 0, -69394, 0], [-1020933941, 0, -352911, 0], [2222728941, 0, 732493, 0], [-1001963090, 0, -3029002, 0], [0, 202845851, 0, -9067241], [-1283208666, 0, 4137570, 0], [0, -361437491, 0, -9197475], [-2451440566, 0, -6418080, 0], [-5985741730, 0, -226602, 0], [0, -294257746, 0, -25911961], [-5668631651, 0, 1591315, 0], [0, -570930298, 0, 70290918], [0, 1087657402, 0, 21660467], [6862079694, 0, -8982630, 0], [0, -441189458, 0, 7242803], [-8827148534, 0, 10814430, 0], [-6919272325, 0, 7610711, 0], [2007376444, 0, -26253406, 0], [0, 1090841754, 0, 188968854], [-4694217714, 0, 7569554, 0], [0, 5409195160, 0, 66196052], [0, 3785806507, 0, 121756787], [0, -5023602878, 0, -82096321], [4977325572, 0, 9198252, 0], [-2576254104, 0, -23308004, 0], [0, -633989445, 0, 146632134], [0, -1371618059, 0, -155051039], [0, 4454251471, 0, 178255160], [39686957478, 0, -22377430, 0], [0, 4732570402, 0, 305430145], [0, -3966598552, 0, 558689996], [-1855189334, 0, 12910140, 0], [40878717608, 0, 51843720, 0], [0, 6758816117, 0, 265184721], [0, -8346537988, 0, -549154917], [0, 6501615003, 0, 567945551], [0, -2496716424, 0, -1675386568], [0, 3315909895, 0, -819837292], [256107771092, 0, -10022766, 0], [168638643889, 0, -17222729, 0], [179626034021, 0, -30382945, 0], [64882194729, 0, 221345863, 0], [0, 12249161318, 0, 122878567], [0, 10396035293, 0, 590842418], [61005243230, 0, -100554490, 0], [0, 14883258596, 0, 224865504], [-369777683702, 0, 120109216, 0], [-173694250109, 0, -33641731, 0], [0, -4883672398, 0, -2529520422], [82869746689, 0, -295554605, 0], [0, 17491796474, 0, 1318911617], [-191288155101, 0, -294945575, 0], [0, -41157750831, 0, -2581177326], [0, -36587402269, 0, -1581632737], [-843211912014, 0, 193617092, 0], [183324550512, 0, 590733756, 0], [0, 81046481341, 0, -1656843364], [0, 18428448644, 0, -6491923664], [-309069435650, 0, -275534118, 0], [406800214566, 0, 366165096, 0], [-61336680789, 0, -747507089, 0], [0, -29292402174, 0, -3656549965], [-948347374460, 0, 342766772, 0], [0, -110128562483, 0, 4520553357], [0, 92545773334, 0, -7050280590], [344055180132, 0, 236389616, 0], [640086369414, 0, 843038650, 0], [-1678435658194, 0, 549589594, 0], [0, 81149068956, 0, 3884618696], [0, 177394431722, 0, -477056967], [0, -81798996347, 0, 12313101126], [0, 83301493675, 0, 11381890187], [-570664795058, 0, 60055252, 0], [-132172265357, 0, 1629901261, 0], [-940222447392, 0, 1142254262, 0], [0, 219447536125, 0, -13445474379], [3495706857977, 0, 584828443, 0], [-2156987941337, 0, -61093239, 0], [0, -4646050365, 0, -17704609602], [0, 216175514265, 0, -3824309055], [0, -113430072379, 0, -5961929892], [1925880346252, 0, -2089134228, 0], [0, 105770439515, 0, 25932166024], [0, 84403060972, 0, 17103524444], [-723935166723, 0, -48273289, 0], [-1730120206417, 0, 3367494333, 0], [0, -318124898417, 0, 22644228531], [-3787340128294, 0, -983940914, 0], [1472191250353, 0, 1526643811, 0], [0, 507130546309, 0, -1383111387], [0, 570408787338, 0, 17887019814], [-3122108064165, 0, 1845675089, 0], [-4810979562105, 0, -930907447, 0], [0, -174820573700, 0, -26182054795], [4926399774882, 0, -7835850, 0], [0, -523234072878, 0, -27405344313], [-3717639271842, 0, 947877066, 0], [0, -897897832357, 0, 14391624703], [5351379314859, 0, -3114721871, 0], [-1236664960511, 0, 7002734723, 0], [0, -891426845610, 0, 11387259958], [0, 258916060614, 0, 33142292734], [0, 1200626439516, 0, 12714065577], [-2590937368839, 0, -638814793, 0], [-6496188685018, 0, -4137064034, 0], [791283501992, 0, 4203994308, 0], [2861343884093, 0, -3806548489, 0], [0, 100089261837, 0, 36358186712], [0, 604942244063, 0, 23919849562], [0, -239099698728, 0, -13068628711], [0, -621804146443, 0, 39118176213], [0, -1203967990406, 0, 63876920609], [3617315433385, 0, -5479263923, 0], [0, 462501036569, 0, -61264518443], [3921784378986, 0, 2825040172, 0], [-14033922376928, 0, -3787273240, 0], [5969849250042, 0, 4918819694, 0], [0, -1922355554724, 0, 18428082239], [0, -273872306702, 0, -98789697354], [0, 80814568590, 0, -54349249173], [0, 67616983047, 0, -6538486666], [0, -1395546585849, 0, -81567585253], [2563183747342, 0, -3171878958, 0], [-4726077309907, 0, 15200419895, 0], [0, 21322079303, 0, 2266485058], [4432848467354, 0, -1367248426, 0], [0, -814546352670, 0, 36401734658], [-12111789791618, 0, 3688721090, 0], [-5033710119362, 0, 8078950830, 0], [-26419541698676, 0, -1046215524, 0], [0, 1504030906841, 0, 165585694472], [0, 1218966216245, 0, -88253816002], [0, 1961743368940, 0, 18638404335], [11554647514983, 0, 7594187737, 0], [-14035429045384, 0, 9422136634, 0], [253529014428, 0, 1911735568, 0], [0, 1495426526133, 0, -44136630659], [-24681500506554, 0, 6199758002, 0], [0, -945396808530, 0, 88824986114], [33832502845868, 0, 7480672604, 0], [0, 2239411220560, 0, -67600265135], [-43146509927891, 0, -7863281551, 0], [0, -602886172974, 0, -356412791131], [35879710365930, 0, 144435334, 0], [0, -248139915522, 0, -351512842075], [45706659887154, 0, 8685900574, 0], [-4080381453884, 0, 35077496380, 0], [0, -276526938498, 0, 249213321422], [0, -1213144046801, 0, 300153769764], [37514200642326, 0, 6134694778, 0], [10750795297773, 0, 10466987719, 0], [0, -1498438984688, 0, 246806204696], [0, -1081149131804, 0, 198996446913], [27521047257748, 0, 194832280, 0], [0, -1688786190889, 0, 65640169047], [11703674904123, 0, 4428529889, 0], [0, 1917727825689, 0, -239200320886], [-40626719238046, 0, -1266333902, 0], [0, 4665431087350, 0, 266483074483], [60450669907884, 0, 6905150798, 0], [0, -3388369240455, 0, -277131204831], [25595189652062, 0, 9653193834, 0], [0, -320950069202, 0, 421245871738], [0, 1327786752939, 0, -596456103786], [5741501206710, 0, 13849194442, 0], [44339737753358, 0, 2225848714, 0], [0, -3516246796314, 0, 512271642469], [-40890007146162, 0, -5510874342, 0], [0, -1836924295367, 0, 2429919228], [23160454344741, 0, 13677615679, 0], [14897229468985, 0, -64878819621, 0], [0, -10664066148473, 0, -310807995478], [0, 11692058880048, 0, 170478813196], [-57432036852420, 0, 32431622398, 0], [0, 4484719095578, 0, -32530941842], [0, -7445093862368, 0, -389834197785], [0, 5058577862415, 0, 647572051330], [0, 1427491625467, 0, 562104599451], [0, -3093476496388, 0, 713544423489], [0, 3548620311246, 0, 155577677474], [-82861584599955, 0, -5000786981, 0], [-137198532862067, 0, 8429923365, 0], [0, -8703892610543, 0, 344262242549], [-5563217390855, 0, 106369721371, 0], [0, 15448987553588, 0, 57547915123], [-41474267661770, 0, -4958239154, 0], [0, -1204166342867, 0, -964547830911], [0, 3518598873232, 0, -691621336268], [0, -10046523606035, 0, 522111020832], [72141923655776, 0, -68757133376, 0], [0, 1211217871289, 0, -115120263018], [-50530813319412, 0, -58296646540, 0], [-103475847316893, 0, 25371092393, 0], [208893618850943, 0, 21923205133, 0], [0, -13962866527336, 0, -466873354628], [17878411207392, 0, 94470977178, 0], [-36632358247576, 0, -167270629372, 0], [0, -8777676295839, 0, -1440489214967], [39872737084423, 0, 48225996405, 0], [0, -3052928653403, 0, -1280623375304], [-139424018528020, 0, 117833076688, 0], [0, 9362433712552, 0, -1242809085516], [61822595767767, 0, -26440371671, 0], [-128777747808769, 0, 32228025741, 0], [0, -9106366595751, 0, 114002166525], [114122875608676, 0, 17572678484, 0], [38282083463124, 0, 7490041690, 0], [0, -19377176699983, 0, 935290684941], [0, -1656211033608, 0, -1102580192700], [0, -2259525075935, 0, 1065002075288], [109490627775190, 0, 18014901844, 0], [-191462258336690, 0, 63019632058, 0], [0, -11753404703444, 0, 523703028996], [93046223842599, 0, -25797674239, 0], [0, -18514290276053, 0, 326264908427], [0, 15893851940908, 0, -555628685152], [94026653997432, 0, -151760720110, 0], [0, 9869650486513, 0, -1010817459162], [0, 6947681665774, 0, 1733389890522], [0, -23589884454996, 0, -106648437796], [0, -17269642957143, 0, 873520894493], [-40143498153499, 0, -206393891093, 0], [-266536312820708, 0, -52677615244, 0], [-29410346676286, 0, 70340651424, 0], [0, 5081410287165, 0, -823324378302], [-189172266916910, 0, 16132862398, 0], [0, -32976699355475, 0, -627985556168], [0, 28682399379092, 0, 535297914159], [-138656342736682, 0, 200597444746, 0], [410277303907459, 0, -45197459639, 0], [0, -13554603759311, 0, 613982123529], [0, -21316022389496, 0, 1892386984887], [0, -14537944782761, 0, 1077302772502], [-196145904798056, 0, -75281516148, 0], [-159646156567843, 0, 86111952963, 0], [0, -9518285348080, 0, 1140044261599], [0, -12699279597824, 0, 58486458933], [0, 27287393804747, 0, -1338336127394], [0, -18189055581813, 0, -762614640453], [317814862214526, 0, 135668882436, 0], [0, -19868316336475, 0, -1248750467336], [-13970198632114, 0, 198189387050, 0], [-157830374548717, 0, 186457835161, 0], [0, -28847437814742, 0, 263415758835], [-187409694098585, 0, 39436473801, 0], [0, -14369630314431, 0, -1041197458740], [-164409592554710, 0, 111367700242, 0], [0, -10877308039063, 0, 2336078298168], [0, 6931762229588, 0, 1355474969412], [-543523741769823, 0, -137043201025, 0], [58002126746300, 0, -5481386518, 0], [-16001642280475, 0, 207348137197, 0], [0, 8567888839431, 0, 2833662980995], [0, 8826829209380, 0, 1037658095864], [-22408409235596, 0, -189435028404, 0], [0, -44941880669738, 0, 1337082788974], [0, 101867820733716, 0, -80718662109], [0, 42182741525897, 0, -2349181790419], [619959787362774, 0, 18348744198, 0], [-50881993622480, 0, 187927535834, 0], [171342428002516, 0, -444375424070, 0], [0, -23733388618290, 0, 437495054030], [0, -9943917365333, 0, -3990094605018], [296786264942480, 0, 278382926682, 0], [0, 2749191529919, 0, 2097714061835], [320992323013855, 0, 13494727981, 0], [0, 68392508848571, 0, -2339476648017], [449463405682598, 0, -47309207368, 0], [0, 46357444887586, 0, 165189339889], [0, 1482825833608, 0, -3880809096876], [0, -37489252149822, 0, -1060038379529], [0, 15667009481847, 0, -1730334279125], [0, 20996565118511, 0, 3607550478971], [0, 33214879994761, 0, 1735930562114], [316686747067227, 0, 170425945137, 0], [-644976001235616, 0, -492292112568, 0], [289612458501801, 0, -533810063633, 0], [-1276988955645931, 0, -117481299629, 0], [-297289585407318, 0, 654198479230, 0], [-57641802574875, 0, 105754266899, 0], [0, -84386317658988, 0, 982019836591], [-481658362306548, 0, -185210321072, 0], [-217075639073042, 0, 195248130840, 0], [0, -49267243316728, 0, -1021191586260], [-654337579037619, 0, -467407564281, 0], [-37869555623018, 0, 791608028882, 0], [824194629294409, 0, 219999824375, 0], [-1320010093064334, 0, 109382338638, 0], [0, 17423405216371, 0, -1616341614552], [0, 127862546906621, 0, -2529192970747], [1123634613835016, 0, -177697599488, 0], [0, 84360273166641, 0, -3121282903618], [-532965701228004, 0, -432233319004, 0], [0, -94137583417119, 0, -4997236533851], [-1002706129626878, 0, -486517221434, 0], [0, 87419163624048, 0, -3001148111491], [-417603038306538, 0, -105681709134, 0], [384891457510461, 0, -665423468695, 0], [0, -77067081647813, 0, 2064215787100], [490094778077855, 0, 91243916201, 0], [0, 22064119591907, 0, -6289330023689], [-476036135097374, 0, -583192450758, 0], [-680824702340585, 0, -491778427755, 0], [-1003525869696720, 0, 37810801702, 0], [834122034083075, 0, -518457879607, 0], [0, -104338428810390, 0, -2247979460902], [0, 59710898688411, 0, -6716903446637], [1260082632888902, 0, -415467356230, 0], [0, -81151470138309, 0, -1899523630589], [220852960543875, 0, 965707344873, 0], [0, 4054733969779, 0, 8881230322894], [0, -3198480372905, 0, 12142393185014], [0, 144542736535030, 0, 2962411178498], [-51125149154680, 0, -725507899962, 0], [1607534572685251, 0, 587404590713, 0], [0, 26164083149334, 0, 147142109651], [458762663749746, 0, 9200912494, 0], [-780309408824705, 0, 272219397357, 0], [1314959902478227, 0, 559381177909, 0], [0, 46917390254638, 0, 11474921264489], [380757969684091, 0, -145530767963, 0], [0, -21864313391616, 0, -15804442128668], [0, -77831059953324, 0, -5379716894091], [0, 173174214266725, 0, 5285764859585], [-2108658743885218, 0, -367360445640, 0], [-1023695001723124, 0, 722012405822, 0], [0, -98195149128526, 0, -7247131171938], [687602652738764, 0, -225725409726, 0], [0, -4652586860593, 0, 11982801258116], [0, 113420005789466, 0, -4407565253922], [0, -114504519785321, 0, -9366911780177], [1578084735756600, 0, -546440683794, 0], [-856304092012300, 0, 748943895280, 0], [434188852187698, 0, -1440303582760, 0], [0, -123660405120171, 0, 4226222014606], [250094622389490, 0, 81371754610, 0], [931216511785890, 0, -1677096277594, 0], [0, -107470812852967, 0, 15095664469969], [-2127329648936855, 0, -492928580597, 0], [0, -30895947974878, 0, -10227172723845], [-926208424334096, 0, -677922463788, 0], [865027586838803, 0, 1118411888663, 0], [-241984743150594, 0, -1702528344182, 0], [0, -220168491052987, 0, 5480347803397], [-1537353235657120, 0, -259226987760, 0], [-1026736006300422, 0, 1064483942032, 0], [0, 116522879607380, 0, -14641034017436], [-369548296192902, 0, 772055317464, 0], [0, -272601332829959, 0, 5616087876977], [-1326291000329832, 0, -1002461528308, 0], [0, 96925853787449, 0, 2311367980726], [0, -123820605142669, 0, 2506559190142], [0, -44261779942111, 0, 10994636971666], [0, 152380946531710, 0, -7356658838225], [-715182524589079, 0, 693310918573, 0], [778979156410140, 0, -2119791262284, 0], [-2089732449921044, 0, 400718172730, 0], [0, 27134168663799, 0, 18587535270199], [0, -3766949023156, 0, 21389690164096], [-1942701477173334, 0, 589803770222, 0], [0, 197685944300124, 0, -643118462163], [1855226477659294, 0, 1965176060050, 0], [0, -154726404562966, 0, -18057885594002], [-1158513907952059, 0, 591720171583, 0], [0, -147176138790280, 0, 10131310652167], [1429737319176238, 0, 1728133997658, 0], [0, 137765947018897, 0, 8752589881013], [-1477212796558654, 0, 1117355172890, 0], [-2566688770062954, 0, 815779807794, 0], [0, 448146223595094, 0, 831000595682], [0, 115144463166701, 0, -6292879045026], [-1015949217241242, 0, 1499077398250, 0], [607639280877305, 0, 248541026075, 0], [0, 4227996847404, 0, -12637862379615], [57308613299334, 0, 671686175096, 0], [1437921271333856, 0, -371206924736, 0], [0, 3814725718529, 0, -28637452691070], [0, 35655816861326, 0, 22020437717395], [0, -209321408228498, 0, -3344970913622], [91355700567358, 0, -3330165300512, 0], [2600636909250515, 0, 1941474350159, 0], [0, 252926900097899, 0, 21157828034671], [0, 255310236691693, 0, 11488550429789], [0, 268715206358423, 0, 18914003717410], [2892879438993747, 0, 1840874830089, 0], [611285956539615, 0, 3183967893153, 0], [3454132306680010, 0, -280353981730, 0], [1665980170670080, 0, -649458232480, 0], [0, 27861168574238, 0, 38366062475773], [-1157624756886618, 0, -2526758876558, 0], [0, 457097613383450, 0, 7270820243826], [0, -209891685347925, 0, 6224322404246], [0, 191242634961580, 0, -4398594902352], [3239894819610591, 0, -2076923237283, 0], [0, 84024951155176, 0, 15269827787977], [3585916201829292, 0, 2552565706580, 0], [0, 172999297650875, 0, 7123589295047], [0, -259893341241807, 0, -15555037616100], [0, -119315548066812, 0, 5104782382559], [-765444736444389, 0, -1257252897283, 0], [-1651653657311012, 0, 406354711172, 0], [0, 650023030136027, 0, -6268253254233], [0, 500406306318178, 0, -490795811734]];
    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_k();".
// 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_k(:prec:=4)
    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_k();".
// 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_k( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_98_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,10,sign)));
    Vf := Kernel([<3,R![387774864, 0, -47322, 0, 1]>],Snew);
    return Vf;
end function;