
// Make newform 98.10.a.i 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_i();".
// 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_i();".
// 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 := [2100, -1115, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0], [-1515, 68, 2], [20715, 308, -28]];
    Rf_basisdens := [1, 15, 15];
    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], [-78, -1, 0], [-246, -6, 1], [0, 0, 0], [-2475, -35, -51], [-32789, 224, -73], [-101526, 2232, -145], [-125285, 1793, 343], [758040, 7021, -156], [-2185725, -17584, 3387], [-2210729, 21601, 729], [7425827, -14490, 4002], [-11338167, 29120, 4477], [-20962888, -50288, -14236], [-17543715, 67943, 3931], [3866913, -487886, -2500], [-4156638, 382899, 97084], [-53318603, 318998, -22654], [160205648, -284095, 10814], [-12174294, 623840, 63998], [83252491, -1464324, -160486], [-95137612, 927073, 154876], [-382307766, 742000, -74126], [-300776163, -1327780, 243136], [-102649241, 6520304, 385911], [-540122718, -4403498, -19575], [-389094854, -2702405, -858766], [151086489, 572131, -63463], [-188472568, 432782, 673097], [-481262631, 8780464, -1169351], [-1807576978, -5531680, 460722], [4724284836, 2506001, -1094242], [-1473019170, -390796, -4441539], [1919976886, -35957712, 126734], [780142326, 4705246, -223849], [-3225787819, -19783925, 6774639], [1891786237, -14360550, -2382726], [2417270618, -45386369, 3435764], [7033912059, -20189960, 5813301], [3293394507, -74664386, -5902860], [1196675877, 3807713, -2271335], [1987832890, -16377200, -14188416], [4618550691, 35584241, -3333827], [-6380016304, -162886864, -9429905], [-15057348801, -10456208, -1841721], [-6847146623, 155502269, -3561869], [-6808337350, 293141968, -3731638], [-42755774294, -64757952, -6030282], [-5163338271, 44910151, 1263545], [-17847673148, 250509722, -678777], [-16144975440, 108751244, 40082027], [-868804497, -325746792, 9792249], [-30627440435, -233071672, 12455980], [-59979402531, -211365336, -28968657], [-56223491274, 3213568, 13031963], [12759410574, -172150517, -60322522], [-23394740403, 122286562, -76069470], [35631757618, 583287839, 39121694], [-39347283715, -562563134, 102612176], [-12109888539, -312260592, 56669173], [-2365994873, -1061321605, 73510911], [-62349433422, -234301088, -22671448], [138839224168, -106122576, -21779020], [-88979419848, 558426973, -29048532], [-80822243033, -107746820, -151103690], [20824782021, -261769606, -103779404], [46144515560, -1396197509, 91576994], [181064049731, -89528992, -146166081], [23362731366, 309253245, 227809164], [148907528773, 202952624, -160091139], [-72764044944, -1150253280, 162169281], [-15549534603, -1596512659, -169714713], [79346033134, 1764173361, -91729854], [-215830881103, 1671202414, 36592572], [262769509313, 1350304200, 333127651], [40517778423, 1417338959, -177074199], [633010853718, -249637094, 69997519], [-396938164352, -1089229154, 400643535], [-193017383766, 3318396536, 100531261], [-23446335698, -2122213500, -59658945], [195940582656, 1555575056, -40568948], [210176994617, 2436353696, -56304003], [474242236167, 3545536295, -458050751], [-878119618205, -576103024, -153245237], [100498125463, -1640059749, -36135659], [285922925295, 4025895643, 219702843], [-111198338373, 9175696544, -173918025], [117103945817, -1009141700, 84784578], [-949195118703, 2028898928, -179377279], [75488212904, 4295977504, 226145736], [548208725118, -1892139591, 252400300], [102273041688, -8231999399, -166725776], [-1015511132326, -1244186405, -421663030], [18677966121, -3824114616, 226914411], [1100106679274, 2543898903, 360051964], [1447251726282, -4163655328, 135704542], [602703224658, -2961080282, 193213733], [609773997117, 2780139564, 669859320], [-299819962157, -6558384083, 1371700811], [-449070688810, 8388318890, 781515459], [1618687655075, -10105089512, -681748679], [-118056413616, -8884359442, 574267617], [2433837944496, 2257007367, -1146585094], [388763612001, 16219725284, 553947298], [-1691920312255, 14297935925, -32062455], [-2200300290239, -6872698400, -892702688], [3233394274452, 9296646800, -195516912], [2505871836408, 5270451320, 2766676849], [-2286364473792, 7232387827, -141946228], [-3084744824105, 15110187568, -1227922801], [-3186550900997, 6375121663, -550204587], [376400576000, -21593302598, -2165256059], [-1034239949289, -11595304224, 2120877379], [-4891711933868, -4518983813, 928621762], [5360990997098, 6439162912, 1563938222], [93947728875, -23715424320, -3729170540], [-3120735939488, -17822761488, 14996460], [-909759796152, -4150535691, -2569543356], [-2193676133127, -21549330894, 1271418744], [-1273121582154, -27288067184, -2998430706], [-4096595052047, 22571212782, -513646126], [495057231419, 38326417024, -1066849609], [-2464487083896, 17333169722, -4507309853], [-370094917113, 323751757, 3131297003], [-5546144333504, 4328515241, 1335371866], [-678167369886, -1777864480, 516049692], [-4259945386717, 37859215702, -575100142], [7139149011402, 19648832127, 822923622], [-1769093912438, -56210892192, -6200009218], [-3300795099401, -19567512362, -1390967328], [-2435928426013, -15667906471, -2297128797], [665521890990, 10894240448, -5334704198], [-7397730605305, 9439895801, -1972598367], [-1358709437617, -70562122736, -5773368761], [3745721822766, 20970926796, 8030643695], [2149090905649, 459827648, 2417148285], [8848907380206, 43106185478, -2051071795], [-1860749952482, 32504481239, -6552489412], [-478596039111, -90408211824, 1210003113], [5158521465045, -44429019180, 6532237622], [4475511550780, -16661261904, 3402745064], [3897291060264, 89356196286, -3300153371], [-11864071806784, -7851821789, -6938593956], [-773615902956, 57585737776, -1069530184], [-8535098532740, -91762085206, 9472717563], [1621912265952, 19376367584, -4446522888], [-1069817833397, 17276407008, 9768285519], [5999619234915, 68799446036, -3950306006], [-5662045781111, -110463858091, 9418920637], [2297639464404, -140593592615, -653838380], [8769381680162, 16069379746, -889430097], [968174719590, -136506669488, -10666048264], [-11938871680618, -5751373712, -6153386962], [450424205169, -3252173637, 14728723611], [4988071434386, -5829965099, -5473695608], [1019610489240, -137903726688, -9197438760], [-7220860736311, -28543185867, 14997071707], [-9587173419465, -92518967008, -11889099254], [-6895195568414, 216768256320, -11927378124], [17188291966419, 129365301218, -8277605284], [-18013047394968, 6350180375, 5788598334], [-3196966377351, 91987344848, 12785091137], [3069563352494, 97927831232, 5082396634], [-17251922240088, 151151320517, -4690913522], [18036448822632, 197784857816, -8935083281], [29776596752463, 46464967093, -1807244755], [-8213203936084, -90369950713, 19404664492], [-24382961542655, 56191019814, 834226698], [5849615902973, 52431844976, -15585280043], [-2830531467819, -202269533598, 35124817518], [26695215547770, 205913930957, -21714029208], [2525376558283, -287298277056, -3805374649], [-29145493722120, 74504107125, 22021440972], [-5336272031689, 81700855124, -7102342956], [2338236537091, 316379011241, -4547481691], [-14953343651571, 1242489248, -7528228759], [-3920187901405, -128077144552, 33579532977], [-33304498254171, 3945602122, 15560587488], [-1684425865142, -54953785600, -48959722802], [19871017461214, 106108375934, 14754538609], [33600272853140, 43595753033, 12225400260], [5183919555726, 330965205424, 15384185662], [-8725799912626, 222850319664, -19042312376], [-22966124782467, -29385398412, -1167741512], [10028211904818, -287893987073, 22283415982], [8351637459129, 69831876974, 8091202378], [-46773446164576, 58106789734, 27814416793], [-3449721759389, -4711691993, -39325885801], [26366588989832, 255443591116, -25967282093], [36101690756637, -283073065199, 28401096803], [38334600292225, -545892023872, -11637832128], [-22128520669890, -159958954736, -6828810562], [-22709147714359, -377436655169, 59353966917], [5745488712960, -165960196954, -36449240745], [-16201901110263, 170439742361, -11344646915], [13612992798204, -509425505044, 3923638665], [29367147275348, 351459956680, -26275507693], [48834951032864, -153735860054, -15145543527], [-24377714352399, -465692023552, -25166014019], [44595253366338, 417980173451, 55927379962], [27001117369722, 152648780270, 50871722167], [-27302290821182, -399599063584, 103208210318], [49826795462395, 358741310306, -58340632472], [17077831430182, 99541359056, 30984257819], [-48341731357518, 49694340976, -35669139406], [-23114574691335, 541731579626, 4624337326], [15960886375552, 539976016343, -12581918264], [-23983698910341, -53417956697, -30185330437], [-34677101970882, -25249921536, 59701415628], [1024988922718, -101552363221, -15846433592], [28629958821164, -181605567864, 39366004971], [27015575224785, 682430278544, -33724019623], [-168870009142132, -165724947584, -21265448180], [-14008824454782, 105357469197, 52157008444], [3253220537499, -106497883507, -19213474103], [100221219933034, -15252114716, 48242727563], [72553810226987, -222070904601, -73474253219], [110645132578134, -335744240840, 7479894019], [-68545090047705, -78090192075, -100639466051], [55302877457478, -646768682784, -15221668328], [55076344175414, 757529654518, -23498443281], [-57781027451681, -887783155560, 25996327841], [39977410511997, -831493601008, -68360300558], [-78090872615161, -207191112471, 6125466385], [-17552119025322, -594292057296, 41388724902], [19591062108185, 1107993448576, -66263509651], [-22424701691838, -92345545956, 96888168107], [-163545774690414, -310440819801, -60992803930], [101505812881069, 116038062547, 4674974391], [-200531424601152, -383492148277, -36990811046], [-64087640342533, -39849142354, -190087654266], [-66732826577474, -101928824985, 179387901644], [109252133074820, -648784434368, 78510023484], [52971928374306, 981930434324, 64408635481], [-2033166925808, 856305724848, -153472777932], [-23947577468988, 277297305249, -193401459396], [33719167877440, -1617775480264, 111540974313], [36214487517588, 1097925852142, 181488154409], [48401681937540, 733139766128, 61108183336], [304261576657029, -563260079928, 10976295163], [-80019944937108, 474192857593, 79191315882], [72170728804483, -446180732955, 99916031187], [-84380912772662, 741714381813, 149507363394], [167201849044271, -42385578494, 78341460274], [64341098154450, 1203513083136, 128236136540], [73027674692652, 975725881523, -7391048], [-6750565998518, 767944831808, 252374114198], [146030275240125, 143589009703, 185743744765], [-237579280188325, -261921777075, 27578953047], [87325160917413, -1982907036152, -12493025869], [-133388755477183, 147091391328, 145245422797], [-79675903797195, -735962562432, -165304536180], [180920359708107, -1079920645629, -3063047487], [-185266803235541, -431496909872, -123296398229], [-122027153027217, 145916741970, 104975775056], [122282925674307, 1430893229311, 15767085579], [262964332605227, 182841836114, -101077559150], [-302288061839441, -599905606469, -186837546729], [-106595503472145, 2648192334368, -33222592549], [-275934166580738, 1271099995404, 80879358687], [-49344486524770, 2363232270679, 151697993322], [46393133065620, 2073290111984, -185981468160], [-69787823211752, 1761008885782, -70295538029], [-100490657662043, 2350612660368, 128233273853], [-9926823934734, 1448233821264, 182356320975], [48653304768913, 1900704229705, -143110691159], [104987370580857, 2177636704992, 16092606789], [-92688620379255, -626905278720, 124305898093], [185699376745004, -636290900784, 124885430848], [226679459962506, 32325254010, -44311773957], [49481054191090, -874209503474, -109859313555], [-278164302421381, 1099135158961, 78564347507], [120373790368234, 249104495716, 196625309091], [-132060303440923, 2617805564801, 166965425611], [-379474464385577, 698444285616, -3605101321], [-169532065405478, -1688781619069, 238199354330], [255616795946484, -1697515763965, 4058402078], [155675007261563, -2153731937098, 324044884926], [-206094490165699, -2239543844804, 362264823582], [349955180978331, -36165496639, 256145139031], [58131138756825, 136547918849, -326284629833], [-113474151444955, -908164574317, -439592637033], [88216734865236, 637420365344, -272972876588], [398259351451705, -2149173610640, -44902694047], [163956612771367, -676583207635, 143667961079], [4360157349741, 300658678985, 413742728267], [-395509771928149, -274712027576, -269735189684], [-654572938837857, -1437798980240, -289537526793], [211477375674598, 196365852493, 358655033678], [81235394601207, 1249490408432, 156231384295], [509308035310638, -2384855875682, 78739973075], [-84012791554293, 1506663469695, 548217395799], [-223382393414193, -1430385790988, 359735864228], [-10550611691793, -4768772707272, 96715463389], [-142817819939047, 1501027795008, 487288612389], [-29521178397756, 689541291578, -607531496669], [815075632579957, -1602389855905, -195595359557], [-150288239931417, -3426076938144, -211957947117], [319809604472808, 4100141275581, -508990305786], [-219869133377879, -1002440754616, 390130497851], [-458960773036169, -2257312632700, 383196812526], [340120425051666, -4253178771310, 326802714031], [-272186741254453, -2434090975113, -383803611347], [-433039921775718, -2541718161584, 445442291882], [-433656661636045, 1088915277387, -70989988377], [419253392336639, -131423395936, -636638228141], [76991606032284, -3933461972027, 711632782], [-362171967887927, 4133797934448, -282770365335], [-644048894631249, -418562701627, 357269385029], [-622348990946338, 1270247645254, -269305228393], [316475593677780, 2779682446143, 729294819804], [-9787672493889, -5488939300558, -27199965666], [-731977320092442, 1720435232208, -281654163751], [-358742278381714, -2798330955791, -79785726544], [-585543031274784, -5666142638464, 1052888093448], [-888239999516384, -391516221748, 447671280901], [-419904003554766, 4503210308688, 260399664138], [597952194919215, -4891908535857, 448103475377], [-663509605965059, 5208596022560, 61334009233], [-710696473202511, 9102865554384, 61786747617], [-153254656376867, 201622237263, -510297783435], [217652880006824, -770557369484, 528328690587], [-335673406421355, -2491067919760, -335473916819], [705444249464831, -6155582791400, -229136142375], [-251983588318065, 7610944255012, 112923163756], [-962061734778245, 745599053256, -259522682130], [626926188764726, 2969280199599, 111583327752], [-795657611469032, 1096821372333, -27008411578], [260956952958186, 1820380542617, 161965538366], [899093183494065, -2051163606688, -179369222395], [178477730519549, 2511715152002, 917223103300], [-298577121291090, -2502685880954, -1146919278741], [141083347597462, 7419187064800, -554369519286], [-206307407993256, 10064160339743, -412970523846], [-1040337648692839, 3953509267869, -62024202167], [-1084402788011724, 3185684041232, 424230943328], [418456906458473, 1213870897120, 910871036485], [472930011368742, 6802656148016, -1229853134053], [1486617105506938, 3193844424512, 123232569436], [-777474992284586, 8115147294255, 470499540554], [-143833851227392, 10444090302562, -468019899811], [316485269037501, -1123393205200, 484247341213], [1322942005052127, -1231210563072, -327371086293], [1238406224057954, 1198700732096, -399743328858], [722338061062203, 4361072781338, 1530922411582], [-216124867994490, 1140752815440, -624169762866], [1418817878816185, 6437272414278, -662498817870], [-546863899484005, -11579514916221, -350316324489], [1310126120877831, -5332848934504, -196480708031], [22099460843079, -9626103917870, -152452057588], [-78073087330802, -5130066735247, 1315516592788], [430048936355222, 6553934796724, 634741064645], [1423717441481187, -42390447120, 458073539691], [1403120702381632, -3562374846591, 710610077728], [161441133333953, -13376399081794, 167903626556], [1139706363129270, -2540351096752, -863856963840], [309269129816880, -3472089509657, -1500926981208], [-1265918276934519, -3275148843597, -564706424763], [1837999778474586, 5394552255624, -873721435811], [-482298176042244, 1947874261536, -1611429850532], [-1386349060391809, 2309604934672, -254782493337], [29948450989740, -4297604287164, 744310071497], [-692374699296639, 84056812567, -1140306460457], [2150737668493710, 3443211857491, 1141062746196], [-2029020407754356, 6919316905871, -357494437674], [509988999745226, 3439843698844, 871971092033], [-684148024823889, 16067668078112, -102825362285], [1068218116759415, -9850640175677, -256911857195], [-246907478364334, 7717409273392, -246916812552], [311375241941454, 2485952624785, 230955361200], [-626069360210651, 3360446393949, -845435154007], [-1038165898510521, 3744391899353, -1311513787775], [-371660117330370, -14874333209680, 245438076168], [1980674652501535, -3647327678779, -290734829811], [-828257370655003, -9466355369030, -419075325420], [-2266042410746841, -2236930437617, -253168364821], [-1512005920863096, -208984470688, 1455791704568], [1317255102965176, 6212058175616, 239805848409], [854561066622831, 10316996820040, 1590277348282], [-151050787324625, 4521467678448, -737746549929], [80957587332042, 14388883241018, 476752760413], [135991126763919, 13703051148864, 1600665807371], [656275364832224, 16760443436800, -2329747311816], [-704643232093491, -10525503849504, -2229109895598], [552447205794052, 10282137749072, -829651071096], [1692913264744905, -1025584148947, -1638589829125], [2776641073370594, -10046723427153, -226873412082], [351084009107185, -24994841856706, -1167388538238], [1296564102784094, 9119766481987, -1529284882572], [-34088581473000, -1556884436576, 1094000344072], [-1567377337318522, 4224895002496, -830422366660], [159650468851368, -21098850319126, -325905931661], [-527165677476318, -680070723339, 2414810933464], [376281902228734, 20049863231385, -1482158110260], [105942904775931, 8050732454709, 220690332905], [1481089162588589, -278814329780, -421635258458], [1870692309987280, 1838323938905, -174651616008], [1213961765290749, 7048512754080, 1711203242921], [-2338015294927660, -6739429126864, -2465901104856], [-2433081425162232, -10130445264702, -9470959307], [1328828857368163, 2067700604838, -1593850986684], [-299641506645618, -9897191500672, -1070071868063], [-1201714917563239, 5850529397097, -1781170180289], [-140321012865951, 13895945974044, -473790039428], [-2251840631261808, 9847527391078, 89744741771], [-1495620685285328, -19335495223141, -2568567401060], [137483228951741, 17941268316958, 1322312916756], [3149152020684843, -20152011177088, 447731434327], [-201646030292771, 15715902769951, 935021223269], [-1676057578373988, -8273185905935, 63434964358], [5579845428748363, -2790200027208, -36163119154], [-1393253457674595, 22788543385566, 383331972736], [-2427921066758292, 1326305261232, 1795741562560], [1443609329747879, 13095623822743, -1380639185153], [-1158704833641409, -371150581536, -1371165013029], [-2615300837542311, -912156945202, 105130779990], [6127012916205, -18539131648079, -1606646786829], [2305865894271421, -2473248719971, -3094325384745], [-2209437986116239, -20128278342816, 2968685427213], [2032498391096301, -2460602651541, 1288951076815], [-1385824355909949, 22341537530886, -369620318426], [-516407972849507, 27049495923290, 2542986995422], [415747563739392, 4572837720640, -443472660432], [548307371523186, 12607740674928, -78919825566], [416289396047065, 1082662993440, 793000075629], [-1207082153494101, -2083774171886, 1664781789588], [1536985557033561, -5828471975809, -1146307772235], [2835104226485937, -11400525901744, -2790869882135], [-2808789976145000, 11949002558499, 1141457298646], [-546479540581209, -41569713941883, 2433525749765]];
    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_i();".
// 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_i(: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_i();".
// 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_i( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_98_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,10,sign)));
    Vf := Kernel([<3,R![90243, -9909, 233, 1]>],Snew);
    return Vf;
end function;