
// Make newform 1008.3.f.j in Magma, downloaded from the LMFDB on 11 September 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_1008_f();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_1008_f_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_1008_3_f_j();".
// 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_1008_3_f_j();".
// 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 := [10609, -3502, -1007, -302, 270, 26, -17, -2, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0], [-1063218, -19570, 29944, 18236, -1292, -1748, -370, 114], [-62320871, 17084819, 7533918, 2989140, -234962, -147028, 21473, 16713], [11807817, -613920, -929726, -628474, 40698, 41552, -1855, -2626], [-823434427, -28252225, 54719766, 47714004, -2698858, -3351792, 121235, 222581], [-44448208, -3110440, 3718904, 2513896, -162792, -166208, 7420, 10504], [392734777, 16136895, -24785646, -23098276, 996498, 1532416, -37173, -99915], [1532022, 83870, -126368, -85636, 6964, 5604, -298, -366]];
    Rf_basisdens := [1, 155365, 6401038, 695765, 32005190, 695765, 6401038, 16583];
    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_1008_f();"
function MakeCharacter_1008_f()
    N := 1008;
    order := 2;
    char_gens := [127, 757, 785, 577];
    v := [2, 2, 2, 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_1008_f_Hecke();"
function MakeCharacter_1008_f_Hecke( : Kf := false)
    N := 1008;
    order := 2;
    char_gens := [127, 757, 785, 577];
    char_values := [[1, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0], [-1, 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 := 3;
    raw_aps := [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, -1, 1, 0, 0, 0], [-3, -2, -1, 1, -1, 0, -1, 0], [0, 0, 0, 0, -2, -1, 0, -1], [0, 0, 0, 0, 3, 1, 2, 0], [0, 0, 0, 0, 1, 1, -1, -1], [11, 1, -3, -1, -1, 0, -1, 0], [6, -1, 0, 4, -2, 0, -2, 0], [0, 0, 0, 0, -2, -2, -6, -1], [-4, 4, 6, 4, 1, 0, 1, 0], [0, 0, 0, 0, -1, -1, 2, 2], [-18, 2, -4, -2, -1, 0, -1, 0], [0, 0, 0, 0, 10, 0, 2, 6], [-18, 1, 0, 8, -4, 0, -4, 0], [0, 0, 0, 0, 0, 5, -12, 2], [0, 0, 0, 0, 0, 5, 0, 7], [-4, -10, -6, 4, -5, 0, -5, 0], [-3, 1, -1, 9, -5, 0, -5, 0], [0, 0, 0, 0, 10, -8, 4, 2], [-12, 6, 2, 0, 1, 0, 1, 0], [0, 0, 0, 0, -10, -1, -10, -10], [0, 0, 0, 0, -3, -3, -10, -10], [0, 0, 0, 0, -6, 2, 4, -6], [0, 0, 0, 0, 15, 10, -4, -4], [0, 0, 0, 0, 6, 8, 2, -11], [-5, 2, 13, 15, -1, 0, -1, 0], [38, 14, -12, 0, -6, 0, -6, 0], [-34, -6, 8, 4, 2, 0, 2, 0], [-36, 18, 10, 16, -3, 0, -3, 0], [0, 0, 0, 0, -22, -17, -14, 4], [18, 2, -4, -8, 2, 0, 2, 0], [0, 0, 0, 0, 4, -1, 20, 8], [42, 3, 4, 16, -6, 0, -6, 0], [78, -12, 12, 2, 5, 0, 5, 0], [0, 0, 0, 0, 24, -11, -8, 3], [108, 2, -6, 12, -9, 0, -9, 0], [0, 0, 0, 0, 22, 18, 10, 6], [0, 0, 0, 0, -1, -32, -4, -10], [97, 0, 19, 13, 3, 0, 3, 0], [0, 0, 0, 0, -10, -15, -20, -5], [151, -3, -7, 3, -5, 0, -5, 0], [-68, 30, 14, -12, 13, 0, 13, 0], [-86, -29, -36, -4, -16, 0, -16, 0], [0, 0, 0, 0, -23, -28, 7, -10], [26, 46, 8, 2, 3, 0, 3, 0], [0, 0, 0, 0, -29, -2, -11, 0], [0, 0, 0, 0, 40, 27, 24, 2], [0, 0, 0, 0, -6, 29, -8, -13], [66, -34, -12, -36, 12, 0, 12, 0], [-265, 11, -7, -13, 3, 0, 3, 0], [0, 0, 0, 0, -50, -30, -16, -4], [0, 0, 0, 0, -22, -7, 30, 4], [0, 0, 0, 0, -1, 17, 62, 18], [61, -35, -17, -31, 7, 0, 7, 0], [0, 0, 0, 0, -9, 16, -36, 2], [0, 0, 0, 0, 42, 22, -10, 21], [32, 38, 18, -12, 15, 0, 15, 0], [-122, 2, 32, -44, 38, 0, 38, 0], [0, 0, 0, 0, 19, -13, -27, 11], [0, 0, 0, 0, 23, 18, 24, -14], [0, 0, 0, 0, 5, -19, -29, -27], [0, 0, 0, 0, -64, 6, -20, -10], [0, 0, 0, 0, 8, -18, 60, -16], [330, 21, 4, 0, 2, 0, 2, 0], [150, 10, 4, -42, 23, 0, 23, 0], [14, -32, 20, -24, 22, 0, 22, 0], [137, -20, -37, -67, 15, 0, 15, 0], [0, 0, 0, 0, 60, -15, 68, 17], [0, 0, 0, 0, -31, 15, 50, 2], [265, 23, 43, -11, 27, 0, 27, 0], [0, 0, 0, 0, -57, -2, 33, 18], [306, 20, 24, 24, 0, 0, 0, 0], [-130, 14, -20, 14, -17, 0, -17, 0], [0, 0, 0, 0, -2, 0, -42, -32], [10, -11, -4, 36, -20, 0, -20, 0], [0, 0, 0, 0, 68, 57, 0, -11], [482, 2, 12, -24, 18, 0, 18, 0], [0, 0, 0, 0, 70, 20, 88, 14], [0, 0, 0, 0, 64, 19, -20, 8], [-200, -46, -6, -28, 11, 0, 11, 0], [-17, 31, 65, 51, 7, 0, 7, 0], [0, 0, 0, 0, 64, 28, 20, 2], [0, 0, 0, 0, 29, -16, 35, 38], [279, -12, 9, -29, 19, 0, 19, 0], [-154, -52, -64, -60, -2, 0, -2, 0], [222, -20, -12, -72, 30, 0, 30, 0], [0, 0, 0, 0, 25, 30, -36, -20], [-372, -2, -22, 32, -27, 0, -27, 0], [0, 0, 0, 0, 82, 15, 70, -4], [0, 0, 0, 0, -72, -12, -52, -4], [126, -76, 12, 74, -31, 0, -31, 0], [107, -20, -51, -17, -17, 0, -17, 0], [314, 62, 24, 10, 7, 0, 7, 0], [0, 0, 0, 0, -54, 10, 26, -14], [0, 0, 0, 0, -49, -44, -32, -12], [0, 0, 0, 0, 69, 9, -14, 0], [0, 0, 0, 0, 4, 3, -12, 6], [-56, -10, -54, 12, -33, 0, -33, 0], [-64, 66, 78, -16, 47, 0, 47, 0], [-142, -5, -36, -8, -14, 0, -14, 0], [0, 0, 0, 0, 18, -57, -46, 6], [178, 88, 36, -20, 28, 0, 28, 0], [-76, 34, 82, 68, 7, 0, 7, 0], [0, 0, 0, 0, -92, -12, -108, -50], [0, 0, 0, 0, 70, -15, 34, 42], [0, 0, 0, 0, 75, 89, -14, -12], [321, -7, -29, -35, 3, 0, 3, 0], [0, 0, 0, 0, 20, 70, 28, -10], [0, 0, 0, 0, 7, -58, -7, -60], [-26, 4, 36, 56, -10, 0, -10, 0], [162, 8, -68, -32, -18, 0, -18, 0], [0, 0, 0, 0, 28, 23, 76, -32], [-272, 50, 62, 84, -11, 0, -11, 0], [-122, -6, -24, 56, -40, 0, -40, 0], [0, 0, 0, 0, 75, -27, 13, 29], [0, 0, 0, 0, 44, -42, 76, 10], [366, -65, 32, 104, -36, 0, -36, 0], [39, 110, 41, 27, 7, 0, 7, 0], [0, 0, 0, 0, 32, 67, -52, 3], [-132, -14, 46, 12, 17, 0, 17, 0], [0, 0, 0, 0, 61, -20, 60, -22], [11, 76, 29, -41, 35, 0, 35, 0], [0, 0, 0, 0, -72, -47, 24, -46], [-790, 37, 20, 72, -26, 0, -26, 0], [138, -66, -16, -8, -4, 0, -4, 0], [0, 0, 0, 0, 72, 32, -68, 20], [0, 0, 0, 0, -182, -40, -26, -9], [0, 0, 0, 0, 90, 51, 60, 35], [248, 66, -74, 48, -61, 0, -61, 0], [-577, -43, -31, -53, 11, 0, 11, 0], [178, -76, 16, 126, -55, 0, -55, 0], [18, 146, 24, -48, 36, 0, 36, 0], [0, 0, 0, 0, -69, 71, -34, -80], [0, 0, 0, 0, -40, 100, -44, -40], [0, 0, 0, 0, -51, -92, -40, -28], [0, 0, 0, 0, 92, 89, -28, 22], [0, 0, 0, 0, -23, 66, -8, 2], [266, 64, 76, -4, 40, 0, 40, 0], [0, 0, 0, 0, 52, 67, 28, 62], [182, 73, -40, 8, -24, 0, -24, 0], [-776, 34, -10, -44, 17, 0, 17, 0], [-63, -128, 3, -67, 35, 0, 35, 0], [0, 0, 0, 0, 46, 71, 24, 41], [0, 0, 0, 0, -70, 30, 22, -72], [0, 0, 0, 0, -84, -105, 128, -43], [0, 0, 0, 0, 3, -1, -50, 44], [0, 0, 0, 0, 69, -1, 43, 11], [-69, 93, -99, -41, -29, 0, -29, 0], [-122, -120, 4, 112, -54, 0, -54, 0], [0, 0, 0, 0, -95, -85, -42, -12], [382, -66, -116, -42, -37, 0, -37, 0], [0, 0, 0, 0, -82, 62, 66, 82], [314, 30, 8, -134, 71, 0, 71, 0], [-867, 21, -17, 97, -57, 0, -57, 0], [78, 92, 28, -62, 45, 0, 45, 0], [0, 0, 0, 0, 63, 193, 38, 22], [0, 0, 0, 0, -144, 22, -64, 16], [0, 0, 0, 0, 29, -6, -40, 2], [661, -148, -25, -31, 3, 0, 3, 0], [-198, 106, 52, 88, -18, 0, -18, 0], [-216, 22, 86, -124, 105, 0, 105, 0], [0, 0, 0, 0, 60, 5, -68, 10], [-282, -156, 0, 52, -26, 0, -26, 0], [0, 0, 0, 0, -2, -74, 26, 62], [158, 48, -4, 130, -67, 0, -67, 0], [0, 0, 0, 0, -56, 55, 48, -79], [64, 86, -54, 148, -101, 0, -101, 0], [0, 0, 0, 0, -185, -106, 52, 36], [-305, 26, 1, -157, 79, 0, 79, 0], [0, 0, 0, 0, -88, -23, -44, -33], [35, -1, 37, -17, 27, 0, 27, 0], [176, -58, 74, -36, 55, 0, 55, 0], [0, 0, 0, 0, 1, -74, -33, -64], [0, 0, 0, 0, -23, -63, -94, 44], [680, -194, 6, 8, -1, 0, -1, 0], [-74, -209, -24, 8, -16, 0, -16, 0], [0, 0, 0, 0, -170, -120, -110, -35], [0, 0, 0, 0, 44, 29, 44, -51], [160, 6, 46, -60, 53, 0, 53, 0], [0, 0, 0, 0, 154, 99, 62, -8], [-392, 102, 74, 92, -9, 0, -9, 0], [0, 0, 0, 0, 235, 91, 102, 16], [931, 43, 37, 79, -21, 0, -21, 0], [0, 0, 0, 0, -65, -10, 124, -88], [-274, -106, -36, -136, 50, 0, 50, 0], [0, 0, 0, 0, -68, 57, -12, 20], [584, 86, 18, -148, 83, 0, 83, 0], [0, 0, 0, 0, 148, 128, -56, -14], [0, 0, 0, 0, -86, -30, -80, -88], [1021, -36, -65, -151, 43, 0, 43, 0], [-230, 10, 136, 162, -13, 0, -13, 0], [0, 0, 0, 0, -73, -148, -32, 52], [-1221, -44, -83, 31, -57, 0, -57, 0], [0, 0, 0, 0, 205, 73, 122, 56], [-364, -226, -138, -12, -63, 0, -63, 0], [-152, 174, 42, -148, 95, 0, 95, 0], [0, 0, 0, 0, 167, -7, 58, -60], [0, 0, 0, 0, 60, -54, 48, -86], [-318, 77, -12, -252, 120, 0, 120, 0], [0, 0, 0, 0, -27, 18, 107, -34], [0, 0, 0, 0, -134, 105, -52, -3], [0, 0, 0, 0, -186, -126, 0, -6], [0, 0, 0, 0, -186, -131, 42, 16], [0, 0, 0, 0, 87, 84, 212, 82], [0, 0, 0, 0, 141, 46, 139, 70], [-213, 174, 125, 103, 11, 0, 11, 0], [18, -224, -4, 88, -46, 0, -46, 0], [0, 0, 0, 0, -251, -141, 43, 3], [-730, -140, -180, 80, -130, 0, -130, 0], [0, 0, 0, 0, 11, 26, -160, -2], [-870, -24, 56, -130, 93, 0, 93, 0], [0, 0, 0, 0, -108, -147, 180, -84], [0, 0, 0, 0, -316, -26, 88, -56], [0, 0, 0, 0, 136, 26, -128, -94], [122, 188, 56, -2, 29, 0, 29, 0], [0, 0, 0, 0, -109, 41, -234, -46], [-599, 177, -5, -211, 103, 0, 103, 0], [-158, 113, -28, -212, 92, 0, 92, 0], [354, 150, -88, -16, -36, 0, -36, 0], [0, 0, 0, 0, 210, 20, 70, 161], [510, 36, -56, -76, 10, 0, 10, 0], [-850, -168, -52, 90, -71, 0, -71, 0], [0, 0, 0, 0, -102, 119, 106, 122], [-812, -72, -34, 60, -47, 0, -47, 0], [0, 0, 0, 0, 29, -163, -6, -36], [83, 27, 37, 71, -17, 0, -17, 0], [0, 0, 0, 0, 150, 160, 218, 69], [99, -222, -11, -9, -1, 0, -1, 0], [-1134, 70, 136, 64, 36, 0, 36, 0], [0, 0, 0, 0, -203, -23, -45, -9], [-446, -100, -144, 142, -143, 0, -143, 0], [-574, -218, -204, 124, -164, 0, -164, 0], [0, 0, 0, 0, 113, 51, 47, 15], [0, 0, 0, 0, -186, 40, -198, -172], [0, 0, 0, 0, 118, -2, 248, 18], [-562, -11, 168, -68, 118, 0, 118, 0], [1343, -56, 113, 75, 19, 0, 19, 0], [0, 0, 0, 0, 26, 206, -174, -22], [-261, 40, -3, -9, 3, 0, 3, 0], [0, 0, 0, 0, -60, 75, -100, -32], [0, 0, 0, 0, 27, -96, 53, -30], [-444, 84, 158, -100, 129, 0, 129, 0], [0, 0, 0, 0, -147, -49, -286, -114], [0, 0, 0, 0, -158, 162, -122, -76], [0, 0, 0, 0, 334, 158, 34, -101], [0, 0, 0, 0, 286, 31, -38, 86], [-908, 2, 18, -92, 55, 0, 55, 0], [-1139, -97, -65, 49, -57, 0, -57, 0], [430, 74, 60, 120, -30, 0, -30, 0], [0, 0, 0, 0, 161, -169, -2, 44], [403, 43, 133, -73, 103, 0, 103, 0], [0, 0, 0, 0, -82, 88, -100, -160], [0, 0, 0, 0, -61, 28, 48, 76], [-511, 142, -189, -131, -29, 0, -29, 0], [1024, 50, 66, -148, 107, 0, 107, 0], [0, 0, 0, 0, -341, -229, -91, 19], [0, 0, 0, 0, -143, 16, 4, -182], [0, 0, 0, 0, 232, 6, -56, -42], [428, -174, -118, -8, -55, 0, -55, 0], [1363, 88, -91, 167, -129, 0, -129, 0], [0, 0, 0, 0, -282, -187, -88, 81], [0, 0, 0, 0, -292, -75, 0, -151], [0, 0, 0, 0, 1, 135, -54, 46], [0, 0, 0, 0, 64, -111, -208, -44], [478, 161, -72, 52, -62, 0, -62, 0], [0, 0, 0, 0, 225, 145, 22, 58], [-8, -22, -106, -152, 23, 0, 23, 0], [1118, 155, 80, -48, 64, 0, 64, 0], [0, 0, 0, 0, 344, 69, -156, 31], [-1390, -198, 144, -30, 87, 0, 87, 0], [0, 0, 0, 0, -106, -136, 32, 8], [-334, 220, 64, 38, 13, 0, 13, 0], [0, 0, 0, 0, 166, -22, 320, 108], [0, 0, 0, 0, -314, -44, -254, -99], [311, -84, -215, -61, -77, 0, -77, 0], [-180, 208, 182, 172, 5, 0, 5, 0], [-1548, 82, 134, 260, -63, 0, -63, 0], [0, 0, 0, 0, 282, 67, -122, 122], [0, 0, 0, 0, 148, 196, 116, 122], [880, 138, -114, -180, 33, 0, 33, 0], [0, 0, 0, 0, -304, 10, 168, 122], [0, 0, 0, 0, 252, 7, -148, -15], [0, 0, 0, 0, 300, 235, -44, -42], [-1411, 289, 111, 321, -105, 0, -105, 0], [-562, 12, -124, 232, -178, 0, -178, 0], [370, -91, 36, -20, 28, 0, 28, 0], [0, 0, 0, 0, 22, 152, -70, -77], [0, 0, 0, 0, 51, -19, 22, 302], [-622, 225, -108, -36, -36, 0, -36, 0], [0, 0, 0, 0, -42, -93, 22, -100], [-1542, -92, -108, -8, -50, 0, -50, 0], [0, 0, 0, 0, -108, -103, 216, -78], [434, -48, 40, 56, -8, 0, -8, 0], [0, 0, 0, 0, -37, 48, 20, -138], [0, 0, 0, 0, 1, 86, -209, 70], [0, 0, 0, 0, -19, 72, -28, 134], [0, 0, 0, 0, 116, 121, 68, 166], [0, 0, 0, 0, 160, -163, 112, 26], [0, 0, 0, 0, 120, 306, 60, 60], [166, -251, 176, 4, 86, 0, 86, 0], [264, 18, 214, -44, 129, 0, 129, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_1008_f_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_1008_3_f_j();".
// 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_1008_3_f_j(:prec:=8)
    chi := MakeCharacter_1008_f();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 3));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(1999) - 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_1008_3_f_j();".
// 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_1008_3_f_j( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_1008_f();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,3,sign)));
    Vf := Kernel([<5,R![50176, 0, 18560, 0, 2276, 0, 100, 0, 1]>,<11,R![-12152, -3896, -298, 8, 1]>],Snew);
    return Vf;
end function;