
// Make newform 140.5.h.c in Magma, downloaded from the LMFDB on 15 April 2026.
// To make the character of type GrpDrchElt, type "MakeCharacter_140_h();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_140_h_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_140_5_h_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_140_5_h_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 := [37564835672250000, 0, 172600636071304, 0, 652472238169, 0, 1068594118, 0, 1715866, 0, 1342, 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], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-801912363928785615612609975, 0, -835159255300968452940848, 0, -2543402242205511867984, 0, 383029773732579001, 0, 74116474532460, 0, 3048135891721, 0], [273261348219692147053147425, 0, 1214668472224955251138832, 0, 4949758610906487238086, 0, 10199917678778723186, 0, 15636559026549045, 0, 10911111877826, 0], [2441503844879797908645234398100, 0, 18205537198812867808408637125, 0, -13542712150370781343446369, 0, -4494717378943868339015, 0, -23441614055598716397, 0, 28575000492808156, 0], [0, -273741646322801857767650491949544, 0, -968068386020306713465347240109, 0, -1083567796442006388126019098, 0, -1793230134800793912361726, 0, -1037745432671269453362, 0, -932361611789372461], [0, 4374300081786160593169455592244852, 0, 11948986417219132520357933874397, 0, 26920745818217747041869725834, 0, 28592946965929194383033758, 0, 19030724661309434205446, 0, -1152052514861745887], [0, -58225360115133661549097991141504204, 0, -1040655039847373267385425409886769, 0, -1791384901163360239746143775018, 0, -4230361350371107457953020566, 0, -3312642143558239026118542, 0, -3545114662017541449701], [114865770754194665415280556209081200, -642640069907254065739701192545892, 668516564069613786258196728105844, -9091283182749408717997018927435, 1242957059659639298451353579754, -15990080368092168331351603848, 2160428938919026079165878222, -33729599337107740533426112, 1806442737692712522599946, -28577923440329184803076, 1141012689874593341434, -23908707154067810437], [-2874554899921551629149561439353985760, -4498480489350778460177908347821244, -22051131571774204797000280844555624, -63638982279245861025979132492045, -44096922590663345523686539645266, -111930562576645178319461226936, -88938547391386516569027781622, -236107195359754183733982784, -75096210210013652287799682, -200045464082304293621532, -71441830855828749725246, -167360950078474673059], [0, 642640069907254065739701192545892, 0, 9091283182749408717997018927435, 0, 15990080368092168331351603848, 0, 33729599337107740533426112, 0, 28577923440329184803076, 0, 23908707154067810437], [30872174122889557590226716747414000, 26062619034797123811103602617424684, 32373528761008030431881973278400, 68869866488020188849493957748899, 98590664135284918192224187200, 151762689334609173314819671428, -14847498028128079589463300, 196325863641125945369468536, -2872999137244106718000, 192286852133596570947432, -118155806011548639300, 110166348885771116821]];
    Rf_basisdens := [1, 1, 5484450854058809839450395, 16453352562176429518351185, 24416775202269821405233158540, 212595413791137863449567496503500, 141730275860758575633044997669000, 315491594066048589359158164811194000, 1802809108948849082052332370349680, 12619663762641943574366326592447760, 901404554474424541026166185174840, 425190827582275726899134993007000];
    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_140_h();"
function MakeCharacter_140_h()
    N := 140;
    order := 2;
    char_gens := [71, 57, 101];
    v := [2, 1, 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_140_h_Hecke();"
function MakeCharacter_140_h_Hecke( : Kf := false)
    N := 140;
    order := 2;
    char_gens := [71, 57, 101];
    char_values := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-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 := 5;
    raw_aps := [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, -1, 0, 0, 0, -1, 0, 0, -1, 0, -1, 0], [-1, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -1, 0, 0, -5, 0], [0, -1, 0, 0, 0, -1, 0, -17, 0, 0, -11, 0], [0, 3, 0, 0, 0, -3, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [-156, 0, -18, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 2, 1, 0, 0, -2, 1, 0, 0, 0, 0, 2], [0, 0, 0, 0, 3, 0, 0, 0, 10, 0, 5, 0], [2, -4, 2, 0, 0, 4, 1, 0, 0, 0, 0, 4], [5, 0, 5, 0, -1, 0, 0, 0, -14, 10, -2, 0], [0, 1, 0, 0, 0, 1, 0, 35, 0, 0, 12, 0], [-5, 0, -5, 0, 2, 0, 0, 0, -42, -10, -26, 0], [-1, 17, -1, 0, 0, -17, -8, 0, 0, 0, 0, -2], [3, -57, 3, 0, 0, 57, -3, 0, 0, 0, 0, 6], [-10, 0, -10, 0, -4, 0, 0, 0, 14, -20, -3, 0], [2252, 0, -68, 38, 0, 0, 0, 0, 0, 0, 0, 0], [0, 26, 0, 0, 0, 26, 0, -182, 0, 0, -6, 0], [-706, 0, -38, 93, 0, 0, 0, 0, 0, 0, 0, 0], [0, 149, 0, 0, 0, 149, 0, 196, 0, 0, 403, 0], [-3, -88, -3, 0, 0, 88, 3, 0, 0, 0, 0, -6], [0, -145, 0, 0, 0, -145, 0, 199, 0, 0, -291, 0], [-2, 229, -2, 0, 0, -229, -1, 0, 0, 0, 0, -4], [0, 447, 0, 0, 0, 447, 0, 491, 0, 0, 232, 0], [10, 0, 10, 0, -20, 0, 0, 0, 114, 20, 67, 0], [3599, 0, -75, -159, 0, 0, 0, 0, 0, 0, 0, 0], [10, 0, 10, 0, 7, 0, 0, 0, -306, 20, -143, 0], [-15, 0, -15, 0, 24, 0, 0, 0, 260, -30, 115, 0], [-16, -147, -16, 0, 0, 147, 19, 0, 0, 0, 0, -32], [25, 0, 25, 0, 29, 0, 0, 0, 204, 50, 127, 0], [15, 93, 15, 0, 0, -93, 16, 0, 0, 0, 0, 30], [-10493, 0, 17, 156, 0, 0, 0, 0, 0, 0, 0, 0], [-11491, 0, -217, 135, 0, 0, 0, 0, 0, 0, 0, 0], [0, -915, 0, 0, 0, -915, 0, -3238, 0, 0, -1376, 0], [0, 0, 0, 0, 30, 0, 0, 0, -654, 0, -327, 0], [0, -473, 0, 0, 0, -473, 0, 1271, 0, 0, 78, 0], [0, 1358, 0, 0, 0, 1358, 0, 3487, 0, 0, 475, 0], [10887, 0, 249, -212, 0, 0, 0, 0, 0, 0, 0, 0], [13, 437, 13, 0, 0, -437, 40, 0, 0, 0, 0, 26], [13614, 0, 114, -107, 0, 0, 0, 0, 0, 0, 0, 0], [90, 0, 90, 0, 33, 0, 0, 0, -366, 180, -93, 0], [-40, 0, -40, 0, -61, 0, 0, 0, -270, -80, -175, 0], [10, 1154, 10, 0, 0, -1154, 8, 0, 0, 0, 0, 20], [1289, 0, 599, -69, 0, 0, 0, 0, 0, 0, 0, 0], [0, 337, 0, 0, 0, 337, 0, -1389, 0, 0, -268, 0], [0, -1856, 0, 0, 0, -1856, 0, -2317, 0, 0, 1146, 0], [-52, -797, -52, 0, 0, 797, 47, 0, 0, 0, 0, -104], [-100, 0, -100, 0, -42, 0, 0, 0, -300, -200, -250, 0], [-6461, 0, 41, 339, 0, 0, 0, 0, 0, 0, 0, 0], [52, 998, 52, 0, 0, -998, -5, 0, 0, 0, 0, 104], [19, -457, 19, 0, 0, 457, -106, 0, 0, 0, 0, 38], [0, 2336, 0, 0, 0, 2336, 0, -4862, 0, 0, 2074, 0], [-130, 0, -130, 0, 16, 0, 0, 0, -174, -260, -217, 0], [-78, 1217, -78, 0, 0, -1217, -162, 0, 0, 0, 0, -156], [63, -474, 63, 0, 0, 474, 83, 0, 0, 0, 0, 126], [75, 0, 75, 0, -36, 0, 0, 0, -678, 150, -264, 0], [68149, 0, -289, -603, 0, 0, 0, 0, 0, 0, 0, 0], [0, -1756, 0, 0, 0, -1756, 0, -4817, 0, 0, -3384, 0], [0, -1696, 0, 0, 0, -1696, 0, -2657, 0, 0, 2935, 0], [0, -988, 0, 0, 0, -988, 0, 2971, 0, 0, -5118, 0], [23, 1632, 23, 0, 0, -1632, 145, 0, 0, 0, 0, 46], [0, -499, 0, 0, 0, -499, 0, 1735, 0, 0, -5403, 0], [-15, 0, -15, 0, -192, 0, 0, 0, -2562, -30, -1296, 0], [-4273, 0, -1527, -228, 0, 0, 0, 0, 0, 0, 0, 0], [295, 0, 295, 0, 178, 0, 0, 0, -954, 590, -182, 0], [-345, 0, -345, 0, 255, 0, 0, 0, -198, -690, -444, 0], [6, 1359, 6, 0, 0, -1359, 25, 0, 0, 0, 0, 12], [0, -3241, 0, 0, 0, -3241, 0, 2623, 0, 0, -1847, 0], [-29563, 0, -1121, 164, 0, 0, 0, 0, 0, 0, 0, 0], [0, -715, 0, 0, 0, -715, 0, -8201, 0, 0, -3078, 0], [-90, 0, -90, 0, 33, 0, 0, 0, 2898, -180, 1359, 0], [-23893, 0, -2387, 108, 0, 0, 0, 0, 0, 0, 0, 0], [0, -4736, 0, 0, 0, -4736, 0, 3236, 0, 0, -1767, 0], [37429, 0, 359, 1173, 0, 0, 0, 0, 0, 0, 0, 0], [0, 3376, 0, 0, 0, 3376, 0, -12345, 0, 0, 3539, 0], [-51861, 0, 1743, 1255, 0, 0, 0, 0, 0, 0, 0, 0], [13, -1738, 13, 0, 0, 1738, 320, 0, 0, 0, 0, 26], [-101, -1783, -101, 0, 0, 1783, 92, 0, 0, 0, 0, -202], [153839, 0, -795, 753, 0, 0, 0, 0, 0, 0, 0, 0], [-52641, 0, 1917, -1181, 0, 0, 0, 0, 0, 0, 0, 0], [0, -6484, 0, 0, 0, -6484, 0, -15662, 0, 0, -4050, 0], [-112, 4462, -112, 0, 0, -4462, -210, 0, 0, 0, 0, -224], [-115, 0, -115, 0, -167, 0, 0, 0, 2238, -230, 1004, 0], [-39481, 0, 469, -967, 0, 0, 0, 0, 0, 0, 0, 0], [-480, 0, -480, 0, 315, 0, 0, 0, -3126, -960, -2043, 0], [-85, -1201, -85, 0, 0, 1201, -572, 0, 0, 0, 0, -170], [65, 0, 65, 0, -391, 0, 0, 0, 294, 130, 212, 0], [0, -5034, 0, 0, 0, -5034, 0, -32025, 0, 0, 452, 0], [-253, -1998, -253, 0, 0, 1998, 43, 0, 0, 0, 0, -506], [155, 0, 155, 0, -292, 0, 0, 0, 3528, 310, 1919, 0], [114149, 0, -653, 3371, 0, 0, 0, 0, 0, 0, 0, 0], [-99001, 0, 1097, 3015, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2923, 0, 0, 0, 2923, 0, 8927, 0, 0, -738, 0], [-57, -117, -57, 0, 0, 117, -108, 0, 0, 0, 0, -114], [231, -5568, 231, 0, 0, 5568, 441, 0, 0, 0, 0, 462], [0, -6807, 0, 0, 0, -6807, 0, -3340, 0, 0, 7027, 0], [64394, 0, 1776, -795, 0, 0, 0, 0, 0, 0, 0, 0], [-225, 0, -225, 0, -117, 0, 0, 0, 4770, -450, 2160, 0], [165, 0, 165, 0, 110, 0, 0, 0, -5934, 330, -2802, 0], [0, 5395, 0, 0, 0, 5395, 0, -4168, 0, 0, -6207, 0], [-175708, 0, 1828, 314, 0, 0, 0, 0, 0, 0, 0, 0], [-109603, 0, -589, -552, 0, 0, 0, 0, 0, 0, 0, 0], [0, 11751, 0, 0, 0, 11751, 0, -1945, 0, 0, -12791, 0], [0, 5799, 0, 0, 0, 5799, 0, 12036, 0, 0, 743, 0], [0, -1649, 0, 0, 0, -1649, 0, -12265, 0, 0, -16623, 0], [156344, 0, -4352, -1591, 0, 0, 0, 0, 0, 0, 0, 0], [325, 5114, 325, 0, 0, -5114, 438, 0, 0, 0, 0, 650], [0, -19907, 0, 0, 0, -19907, 0, -1053, 0, 0, 7316, 0], [-5, 0, -5, 0, -62, 0, 0, 0, -5114, -10, -2562, 0], [155, 0, 155, 0, 684, 0, 0, 0, -7710, 310, -3700, 0], [-310, -6569, -310, 0, 0, 6569, -473, 0, 0, 0, 0, -620], [474584, 0, 1064, 1401, 0, 0, 0, 0, 0, 0, 0, 0], [-373378, 0, 3778, -1834, 0, 0, 0, 0, 0, 0, 0, 0], [0, 11736, 0, 0, 0, 11736, 0, 41615, 0, 0, 11608, 0], [0, 2942, 0, 0, 0, 2942, 0, 5824, 0, 0, -11201, 0], [520, 0, 520, 0, -273, 0, 0, 0, -4902, 1040, -1931, 0], [-27911, 0, -4297, -2565, 0, 0, 0, 0, 0, 0, 0, 0], [-248, -8959, -248, 0, 0, 8959, 66, 0, 0, 0, 0, -496], [665, 0, 665, 0, -73, 0, 0, 0, -2176, 1330, -423, 0], [0, 12574, 0, 0, 0, 12574, 0, 30143, 0, 0, 8367, 0], [-15, 0, -15, 0, 71, 0, 0, 0, -5046, -30, -2538, 0], [-577, 11107, -577, 0, 0, -11107, -830, 0, 0, 0, 0, -1154], [585479, 0, 1885, -127, 0, 0, 0, 0, 0, 0, 0, 0], [50324, 0, -4742, 2853, 0, 0, 0, 0, 0, 0, 0, 0], [-281, 11542, -281, 0, 0, -11542, 167, 0, 0, 0, 0, -562], [0, -13918, 0, 0, 0, -13918, 0, -16376, 0, 0, 17535, 0], [0, 14738, 0, 0, 0, 14738, 0, -13913, 0, 0, 20043, 0], [303299, 0, 9269, -81, 0, 0, 0, 0, 0, 0, 0, 0], [1245, 0, 1245, 0, -168, 0, 0, 0, -4992, 2490, -1251, 0], [280589, 0, 7103, 1887, 0, 0, 0, 0, 0, 0, 0, 0], [595, 0, 595, 0, -998, 0, 0, 0, 4270, 1190, 2730, 0], [-475, -5712, -475, 0, 0, 5712, 451, 0, 0, 0, 0, -950], [-242, 11732, -242, 0, 0, -11732, -810, 0, 0, 0, 0, -484], [0, 4614, 0, 0, 0, 4614, 0, 24183, 0, 0, 839, 0], [0, -15418, 0, 0, 0, -15418, 0, 22651, 0, 0, 8934, 0], [0, 9018, 0, 0, 0, 9018, 0, -26073, 0, 0, 5807, 0], [-153691, 0, 4093, 5867, 0, 0, 0, 0, 0, 0, 0, 0], [-1023, 4233, -1023, 0, 0, -4233, -250, 0, 0, 0, 0, -2046], [333129, 0, -6477, 1861, 0, 0, 0, 0, 0, 0, 0, 0], [25, 0, 25, 0, -533, 0, 0, 0, -11618, 50, -5784, 0], [1460, 0, 1460, 0, 260, 0, 0, 0, -1074, 2920, 923, 0], [-383, -1267, -383, 0, 0, 1267, 195, 0, 0, 0, 0, -766], [453, -5876, 453, 0, 0, 5876, 939, 0, 0, 0, 0, 906], [0, -6603, 0, 0, 0, -6603, 0, -69046, 0, 0, -3044, 0], [0, 5190, 0, 0, 0, 5190, 0, -9558, 0, 0, 19142, 0], [339, 639, 339, 0, 0, -639, -1174, 0, 0, 0, 0, 678], [-1255, 0, -1255, 0, 1997, 0, 0, 0, -150, -2510, -1330, 0], [800, 0, 800, 0, 185, 0, 0, 0, 7758, 1600, 4679, 0], [189, 4768, 189, 0, 0, -4768, 324, 0, 0, 0, 0, 378], [655, 0, 655, 0, 403, 0, 0, 0, -1962, 1310, -326, 0], [0, 2350, 0, 0, 0, 2350, 0, 35612, 0, 0, -36315, 0], [275, 0, 275, 0, 239, 0, 0, 0, 16086, 550, 8318, 0], [1063697, 0, -2429, -2140, 0, 0, 0, 0, 0, 0, 0, 0], [-172756, 0, -4884, -3231, 0, 0, 0, 0, 0, 0, 0, 0], [-541, -19404, -541, 0, 0, 19404, 10, 0, 0, 0, 0, -1082], [0, -28867, 0, 0, 0, -28867, 0, -92633, 0, 0, -14511, 0], [390, 13833, 390, 0, 0, -13833, -69, 0, 0, 0, 0, 780], [-645, 0, -645, 0, 1245, 0, 0, 0, -18570, -1290, -9930, 0], [425, 0, 425, 0, -199, 0, 0, 0, 13428, 850, 7139, 0], [-675, 0, -675, 0, 642, 0, 0, 0, 6648, -1350, 2649, 0], [242, 1965, 242, 0, 0, -1965, 1789, 0, 0, 0, 0, 484], [425, 0, 425, 0, -1465, 0, 0, 0, -25824, 850, -12487, 0], [0, -40709, 0, 0, 0, -40709, 0, -62725, 0, 0, -11160, 0], [-648058, 0, 1178, -3558, 0, 0, 0, 0, 0, 0, 0, 0], [0, -7408, 0, 0, 0, -7408, 0, -28409, 0, 0, -13437, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_140_h_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_140_5_h_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_140_5_h_c(:prec:=12)
    chi := MakeCharacter_140_h();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 5));
    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_140_5_h_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_140_5_h_c( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_140_h();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,5,sign)));
    Vf := Kernel([<3,R![-142884, 0, 23400, 0, -317, 0, 1]>],Snew);
    return Vf;
end function;