
// Make newform 162.7.b.c in Magma, downloaded from the LMFDB on 03 September 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_162_b();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_162_b_Hecke();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_162_7_b_c();".
// 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_162_7_b_c();".
// 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 := [10453017600, 0, 1832032512, 0, 117603792, 0, 3491832, 0, 51793, 0, 370, 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, 0, 0], [-10233017042400, 0, -1247487287112, 0, -48532556637, 0, -773457883, 0, -5302927, 0, -13081, 0], [0, -806248446336, 0, 410789456208, 0, 28995600888, 0, 735955987, 0, 7658854, 0, 26659], [66081730824000, 0, 8756856645192, 0, 391082105466, 0, 7678096429, 0, 67295716, 0, 210097, 0], [98574178616640, 0, 11025749885544, 0, 451736622819, 0, 8515647236, 0, 73086479, 0, 225662, 0], [59476995947520, 0, 17476432457616, 0, 1265226360660, 0, 31261162145, 0, 306190910, 0, 1009529, 0], [2459838034713600, 0, 279754337012400, 0, 10303228617156, 0, 166433693269, 0, 1216138966, 0, 3267469, 0], [0, 37729052485757568, 0, 3617974672064304, 0, 97465949305360, 0, 982609562195, 0, 3076022942, 0, -1385069], [0, 4695274771908480, 0, 578696810407632, 0, 23127582217656, 0, 405374895019, 0, 3200148886, 0, 9191227], [0, -21101455040250240, 0, -2633148078796944, 0, -107709393330888, 0, -1900173246107, 0, -14985851078, 0, -42893003], [0, 101244861147611520, 0, 12321432128900304, 0, 483226339488384, 0, 8325664614761, 0, 65156440394, 0, 186692297], [0, -280984712354722944, 0, -31933855280617200, 0, -1239699467732400, 0, -21610924592375, 0, -172073646566, 0, -500693495]];
    Rf_basisdens := [1, 3086858160, 1753335434880, 3086858160, 3086858160, 4115810880, 12347432640, 2337780579840, 7013341739520, 3506670869760, 14026683479040, 14026683479040];
    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_162_b();"
function MakeCharacter_162_b()
    N := 162;
    order := 2;
    char_gens := [83];
    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;

// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_162_b_Hecke();"
function MakeCharacter_162_b_Hecke( : Kf := false)
    N := 162;
    order := 2;
    char_gens := [83];
    char_values := [[-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    values := ConvertToHeckeField(char_values : pass_field := ISA(Type(Kf), Fld), Kf := Kf); // the value of chi on the gens as elements in the Hecke field
    F := Universe(values);// the Hecke field
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),values);
    return chi;
end function;


function ExtendMultiplicatively(weight, aps, character)
    prec := NextPrime(NthPrime(#aps)) - 1; // we will able to figure out a_0 ... a_prec
    primes := PrimesUpTo(prec);
    prime_powers := primes;
    assert #primes eq #aps;
    log_prec := Floor(Log(prec)/Log(2)); // prec < 2^(log_prec+1)
    F := Universe(aps);
    FXY<X, Y> := PolynomialRing(F, 2);
    // 1/(1 - a_p T + p^(weight - 1) * char(p) T^2) = 1 + a_p T + a_{p^2} T^2 + ...
    R<T> := PowerSeriesRing(FXY : Precision := log_prec + 1);
    recursion := Coefficients(1/(1 - X*T + Y*T^2));
    coeffs := [F!0: i in [1..prec]];
    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 := 7;
    raw_aps := [[0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [-40, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, -19, 0, 0, 0, 0, 0, -3, 0, -1, 0], [-280, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, -143, 0, 0, 0, 0, -1, 15, -1, -2, 1], [-235, 4, 0, -1, -4, -1, 0, 0, 0, 0, 0, 0], [0, 0, 352, 0, 0, 0, 0, -3, 9, 6, 10, -6], [0, 0, 833, 0, 0, 0, 0, 0, -102, -2, 7, 7], [-3580, 0, 0, 5, 1, 5, -1, 0, 0, 0, 0, 0], [-2128, -61, 0, -7, -3, 9, -5, 0, 0, 0, 0, 0], [0, 0, -2789, 0, 0, 0, 0, -5, -274, -3, 8, 19], [-11905, 157, 0, -55, 2, 7, -8, 0, 0, 0, 0, 0], [0, 0, -3835, 0, 0, 0, 0, -11, 608, 34, 11, 11], [0, 0, 799, 0, 0, 0, 0, 0, -373, 68, -37, -37], [0, 0, -2728, 0, 0, 0, 0, -8, -128, -70, -44, -27], [-22624, 200, 0, 22, 11, 22, 0, 0, 0, 0, 0, 0], [48323, 18, 0, 122, 39, 44, -41, 0, 0, 0, 0, 0], [0, 0, 14139, 0, 0, 0, 0, 4, 1115, -158, 21, 59], [-81475, -60, 0, 242, -129, 40, -8, 0, 0, 0, 0, 0], [127466, -260, 0, -143, -61, 85, -17, 0, 0, 0, 0, 0], [0, 0, 30117, 0, 0, 0, 0, -23, -2880, -120, -113, -89], [0, 0, -61311, 0, 0, 0, 0, -60, -739, -16, 133, 53], [6479, -945, 0, -755, -173, 25, 11, 0, 0, 0, 0, 0], [0, 0, -45236, 0, 0, 0, 0, -140, -1209, 408, -136, -56], [235118, -293, 0, -308, -158, -48, -80, 0, 0, 0, 0, 0], [0, 0, 16075, 0, 0, 0, 0, -47, 656, 400, 199, 272], [-89998, -1373, 0, -1081, 113, -1, 91, 0, 0, 0, 0, 0], [0, 0, -79392, 0, 0, 0, 0, -150, -6021, -226, 28, 374], [-513448, -1302, 0, 1286, 934, -126, 80, 0, 0, 0, 0, 0], [0, 0, 137605, 0, 0, 0, 0, -381, -8410, -16, -217, 191], [0, 0, 225227, 0, 0, 0, 0, -401, -624, 373, -316, 287], [-81175, 1157, 0, -1523, -276, -381, -148, 0, 0, 0, 0, 0], [0, 0, -72539, 0, 0, 0, 0, -330, 10950, 374, 1835, -55], [1986068, 2004, 0, 23, 603, -201, 223, 0, 0, 0, 0, 0], [61166, 3639, 0, 2657, 1450, 49, 155, 0, 0, 0, 0, 0], [-917662, 258, 0, -2512, -758, -596, -60, 0, 0, 0, 0, 0], [0, 0, -151373, 0, 0, 0, 0, -291, -4214, 2226, 13, -1977], [0, 0, -237164, 0, 0, 0, 0, 756, 8725, -274, -2962, 1490], [0, 0, 104338, 0, 0, 0, 0, 840, 16964, 98, -2044, 2240], [-1598350, -6765, 0, 2677, -2033, -263, -437, 0, 0, 0, 0, 0], [0, 0, 86531, 0, 0, 0, 0, 563, -26558, 1096, 1467, 33], [-3398983, 8123, 0, 2197, -7, 149, 831, 0, 0, 0, 0, 0], [0, 0, -582440, 0, 0, 0, 0, -340, -45132, 1024, 788, -1788], [3471092, 10203, 0, -5067, 1585, -47, 867, 0, 0, 0, 0, 0], [1205486, -5616, 0, -5093, -3005, -531, 599, 0, 0, 0, 0, 0], [-3832198, 16823, 0, -5596, -3318, 252, -780, 0, 0, 0, 0, 0], [0, 0, -707209, 0, 0, 0, 0, -1168, 42593, 634, 1707, -2712], [5416328, 8479, 0, -13267, -2284, 309, -65, 0, 0, 0, 0, 0], [0, 0, 372934, 0, 0, 0, 0, -1157, 4532, 3471, 815, -3626], [0, 0, -377366, 0, 0, 0, 0, -15, 2275, -862, -11260, -1180], [8303, 5338, 0, 2108, 1556, 1288, -970, 0, 0, 0, 0, 0], [0, 0, -1211453, 0, 0, 0, 0, 725, -5866, -2482, -5063, 3538], [0, 0, -896394, 0, 0, 0, 0, -2293, 70197, 3725, -189, -2558], [0, 0, 1279422, 0, 0, 0, 0, 845, 20981, -2508, -7438, 968], [0, 0, -87373, 0, 0, 0, 0, -64, 56823, 384, 2323, 5159], [1846172, 23008, 0, 16634, -6062, -6, 270, 0, 0, 0, 0, 0], [-5830990, -14137, 0, -16501, -348, 2439, -1137, 0, 0, 0, 0, 0], [0, 0, -1268429, 0, 0, 0, 0, 1790, -47260, 838, -4237, 81], [8988428, 13421, 0, -20794, 4644, 840, 1974, 0, 0, 0, 0, 0], [0, 0, -1575392, 0, 0, 0, 0, 4172, -89205, 4738, 8510, 1902], [13273355, -49150, 0, 1401, -6520, -699, -206, 0, 0, 0, 0, 0], [0, 0, -2699252, 0, 0, 0, 0, 5059, 158285, -2404, 4200, 1626], [9789791, 16022, 0, 10446, -2370, -3022, 2262, 0, 0, 0, 0, 0], [0, 0, 3381899, 0, 0, 0, 0, 1770, -4754, 8810, 7197, 2843], [-21602998, -31190, 0, -16179, 11369, -5081, 3173, 0, 0, 0, 0, 0], [14255177, -60850, 0, 26834, -13680, -834, -1094, 0, 0, 0, 0, 0], [0, 0, -4620801, 0, 0, 0, 0, 4042, 36021, -11224, -10567, 7002], [-9016906, 35527, 0, 18309, -1942, -1911, 1315, 0, 0, 0, 0, 0], [0, 0, -3991853, 0, 0, 0, 0, -4045, 242876, -7575, 5124, 8195], [0, 0, -3526004, 0, 0, 0, 0, 4874, 38446, -2336, -24796, -11442], [21090242, 53406, 0, -20717, 7569, -3617, -3247, 0, 0, 0, 0, 0], [2706812, -51802, 0, -7054, -4437, -3562, 6554, 0, 0, 0, 0, 0], [-2939413, 16241, 0, -10676, -9693, -996, -1273, 0, 0, 0, 0, 0], [0, 0, 8765457, 0, 0, 0, 0, 11185, -74144, -12002, 7419, 13757], [0, 0, -6080704, 0, 0, 0, 0, -10704, -209255, 10130, 3690, -19258], [-19140928, 94257, 0, 38183, -11837, -2377, 7685, 0, 0, 0, 0, 0], [0, 0, -1583991, 0, 0, 0, 0, -19319, 197002, 21237, 29578, -23129], [-8816359, -68002, 0, -52254, 7272, -1614, -9282, 0, 0, 0, 0, 0], [0, 0, -6622738, 0, 0, 0, 0, 3981, 9263, 13836, 33656, -8412], [18434822, -190246, 0, 4462, 7305, 3050, 1022, 0, 0, 0, 0, 0], [0, 0, 3645296, 0, 0, 0, 0, 1642, -386306, -25524, -17532, 23494], [-36858247, 24282, 0, -72028, 20881, -4086, -2698, 0, 0, 0, 0, 0], [15068432, -28296, 0, 54069, 14421, 6073, -6693, 0, 0, 0, 0, 0], [0, 0, -13752478, 0, 0, 0, 0, 5284, 3662, -3722, -16006, 22793], [0, 0, 3978307, 0, 0, 0, 0, -6859, 389269, 12049, -39442, 20763], [11697851, 176677, 0, -32515, 16115, 8609, 9373, 0, 0, 0, 0, 0], [0, 0, 2203975, 0, 0, 0, 0, -19986, -72382, 26146, 705, -32057], [18485846, -58466, 0, -57661, -2203, 7351, 5337, 0, 0, 0, 0, 0], [0, 0, -17290445, 0, 0, 0, 0, 5297, 67004, -22608, -9153, 2276], [0, 0, 12128042, 0, 0, 0, 0, 4193, 416621, -12560, -41898, -13608], [6232886, 80394, 0, -98006, -7436, 15818, 2792, 0, 0, 0, 0, 0], [0, 0, 10739298, 0, 0, 0, 0, 13266, 830954, -14780, -33004, 15859], [-15080983, 22805, 0, 53817, -42328, 13139, 12208, 0, 0, 0, 0, 0], [0, 0, 15253681, 0, 0, 0, 0, 6062, 127993, 66868, 56609, -45411], [0, 0, 302371, 0, 0, 0, 0, 4290, 479498, -52476, 16831, 47793], [0, 0, -26287492, 0, 0, 0, 0, -2999, -270416, -1517, -26791, 23234], [-37431016, -64159, 0, -76195, 45725, 15045, 1277, 0, 0, 0, 0, 0], [16460654, -171492, 0, 57798, -60326, 738, 2348, 0, 0, 0, 0, 0], [32634641, 131446, 0, -106590, 3745, 11188, 24623, 0, 0, 0, 0, 0], [0, 0, 14350593, 0, 0, 0, 0, -33802, -799843, -21858, -13885, 15257], [0, 0, -656657, 0, 0, 0, 0, 21330, -680777, 23902, -78681, -42272], [0, 0, 5204650, 0, 0, 0, 0, 31165, 574899, 10091, 57849, 81390], [21739775, 47848, 0, 6416, -8947, -15402, -15223, 0, 0, 0, 0, 0], [16840289, 189804, 0, -68172, -55755, -33770, -12504, 0, 0, 0, 0, 0], [0, 0, 28495450, 0, 0, 0, 0, 12218, -749736, -36374, 28502, 39771], [0, 0, 18704567, 0, 0, 0, 0, -11548, -226361, 91584, 30067, -10633], [0, 0, 27317943, 0, 0, 0, 0, -4099, 1383674, -7154, -12515, -15537], [105451895, 28283, 0, -150703, 53775, -8399, 19563, 0, 0, 0, 0, 0], [15070802, 203619, 0, -189914, -16928, -24014, -18140, 0, 0, 0, 0, 0], [115172912, 68839, 0, 179233, 50689, 3289, -1109, 0, 0, 0, 0, 0], [0, 0, -15741359, 0, 0, 0, 0, -60867, 25730, 120513, 79018, -60609], [75773567, -439592, 0, 30900, -19595, -8194, 12929, 0, 0, 0, 0, 0], [-71953870, 159402, 0, 36688, -34730, -15204, 24184, 0, 0, 0, 0, 0], [0, 0, 30172162, 0, 0, 0, 0, -14905, -504583, 177435, 124749, -58156], [-104825203, -652190, 0, -106014, -21359, -11720, 15419, 0, 0, 0, 0, 0], [0, 0, 24557844, 0, 0, 0, 0, 3082, -155898, 41560, 32772, 66470], [0, 0, 36972444, 0, 0, 0, 0, 41392, -1060417, -141050, -4830, 107906], [0, 0, -32463440, 0, 0, 0, 0, 27247, 1184079, -73484, 1522, -26398], [-95612164, -183413, 0, -191969, 60106, -44925, 37123, 0, 0, 0, 0, 0], [18974654, 350546, 0, 328566, -75069, -31392, 24070, 0, 0, 0, 0, 0], [0, 0, 17103624, 0, 0, 0, 0, -56878, 1182533, 31324, 78760, -109986], [0, 0, -22126239, 0, 0, 0, 0, 98003, 700764, 1628, 106977, 35716], [-206503360, 53507, 0, 174356, 61878, 1622, -22392, 0, 0, 0, 0, 0], [0, 0, 17568671, 0, 0, 0, 0, -5372, 382053, -57970, 43033, -49335], [109422602, -181989, 0, -473723, -14594, -28187, -10261, 0, 0, 0, 0, 0], [0, 0, 13365214, 0, 0, 0, 0, 103242, -610466, -113942, -18612, 44818], [76513268, -550830, 0, 123837, -41667, -4635, 38541, 0, 0, 0, 0, 0], [79809806, 437370, 0, -252292, 10771, -42836, 50762, 0, 0, 0, 0, 0], [120228401, 289203, 0, -5134, -23969, 9214, 23393, 0, 0, 0, 0, 0], [0, 0, -41165685, 0, 0, 0, 0, 84645, 131172, 93256, -191929, -50627], [-317673868, -177863, 0, 141428, 58388, -16988, -1642, 0, 0, 0, 0, 0], [-193785838, -598312, 0, 428916, -104092, 5212, -2768, 0, 0, 0, 0, 0], [0, 0, 50804973, 0, 0, 0, 0, 19282, 128472, 110406, 79609, 9427], [27563408, -580419, 0, -157115, 70882, 70643, -20047, 0, 0, 0, 0, 0], [0, 0, -16471217, 0, 0, 0, 0, -20592, 3014953, -43466, 80841, -80003], [200099756, -89351, 0, 297306, 188920, 28448, -50362, 0, 0, 0, 0, 0], [0, 0, 7939887, 0, 0, 0, 0, -53644, 380784, 52932, 335075, -63289], [0, 0, 27701591, 0, 0, 0, 0, 101941, -121673, -163513, -353300, 108561], [-25272655, 1114906, 0, -131983, -99838, 32233, -77006, 0, 0, 0, 0, 0], [0, 0, 18338931, 0, 0, 0, 0, 11788, 597092, 15990, -18923, -92063], [180808226, 611554, 0, 631247, -142339, 26679, -13695, 0, 0, 0, 0, 0], [0, 0, 1955744, 0, 0, 0, 0, -27748, -391502, 213234, -131342, 35366], [86809472, 1170771, 0, -346541, -18617, 32903, -33445, 0, 0, 0, 0, 0], [0, 0, -15153611, 0, 0, 0, 0, 21985, -3467498, -9804, 74501, 227653], [-288721132, -110108, 0, -430920, -186047, -16944, 12872, 0, 0, 0, 0, 0], [0, 0, 4080931, 0, 0, 0, 0, -68318, -765788, -44514, 365891, 165097], [8732093, 912810, 0, -124828, -165365, 52922, -27489, 0, 0, 0, 0, 0], [0, 0, 43470528, 0, 0, 0, 0, -53570, -1440916, -64710, 2782, -161360], [316426028, -519894, 0, 541072, -142271, -21340, 46642, 0, 0, 0, 0, 0], [0, 0, 6567329, 0, 0, 0, 0, -56664, 1542981, 188028, 313937, -56235], [-177748579, -640920, 0, 381337, 52846, 43325, -67036, 0, 0, 0, 0, 0], [0, 0, -30821176, 0, 0, 0, 0, -155149, -4052661, -15342, 170326, 168356], [-235587349, 424507, 0, 265101, 389498, 6127, -74374, 0, 0, 0, 0, 0], [0, 0, 37985534, 0, 0, 0, 0, -132121, 2822063, -147056, -332670, 8970], [-246035320, -892102, 0, 5934, -670, 43866, 52444, 0, 0, 0, 0, 0], [0, 0, -1649501, 0, 0, 0, 0, 47178, 454168, 190670, 471047, -66451], [-415622776, 1076725, 0, 317477, 147893, -76311, -931, 0, 0, 0, 0, 0], [0, 0, -22517706, 0, 0, 0, 0, 141150, 1057121, 123136, -186694, 96208], [0, 0, -10590909, 0, 0, 0, 0, -25928, -3237933, -41612, 100509, -21058], [0, 0, 4381379, 0, 0, 0, 0, 129711, -1408417, -214023, -180970, 286245], [-345123286, -1605624, 0, -347145, 116721, -3973, 31119, 0, 0, 0, 0, 0], [0, 0, -40430537, 0, 0, 0, 0, -24934, -1592135, 74334, 137865, -108607], [0, 0, -42446134, 0, 0, 0, 0, -153611, -4461437, -53571, -15993, -260000], [0, 0, 63197020, 0, 0, 0, 0, -16295, -2602071, -62390, -232166, 184808], [-297438784, -666998, 0, 193360, -104924, -20680, 114028, 0, 0, 0, 0, 0], [329378402, 517255, 0, 961977, -122882, -63895, 96347, 0, 0, 0, 0, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_162_b_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_162_7_b_c();".
// 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_162_7_b_c(:prec:=12)
    chi := MakeCharacter_162_b();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 7));
    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_162_7_b_c();".
// 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_162_7_b_c( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_162_b();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,7,sign)));
    Vf := Kernel([<5,R![18327410507756250000, 0, 5551794796611375000, 0, 49170069564710625, 0, 28287732473100, 0, 3082099734, 0, 101844, 0, 1]>],Snew);
    return Vf;
end function;