
// Make newform 8281.2.a.cc in Magma, downloaded from the LMFDB on 17 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_8281_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_8281_2_a_cc();".
// 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_8281_2_a_cc();".
// 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 := [-1, -6, 7, 8, -5, -2, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [-2, -1, 1, 0, 0, 0], [1, -3, -1, 1, 0, 0], [2, 2, -4, -1, 1, 0], [-2, 4, 6, -4, -2, 1]];
    Rf_basisdens := [1, 1, 1, 1, 1, 1];
    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_8281_a();"
function MakeCharacter_8281_a()
    N := 8281;
    order := 1;
    char_gens := [1522, 3382];
    v := [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;

function MakeCharacter_8281_a_Hecke(Kf)
    return MakeCharacter_8281_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 := 2;
    raw_aps := [[0, 0, 1, 0, 0, 0], [-1, -1, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 2], [0, 0, 0, 0, 0, 0], [-3, 2, 1, 1, 1, 1], [0, 0, -1, 1, -1, -1], [0, -1, 0, -1, 1, 2], [-1, 0, 0, 2, -2, 0], [1, 1, -2, 0, -3, 1], [0, -2, -2, 2, -1, -2], [0, -3, 2, 2, 0, 1], [1, -4, 0, 0, 2, -2], [6, 0, 3, -3, 1, 3], [-2, -1, -4, 1, -1, 0], [5, -1, 1, -3, 2, 2], [-2, 3, -1, 2, 1, -3], [-4, 1, -1, -1, -1, -3], [-2, -1, -4, 5, -5, -3], [-2, -2, -1, 1, -1, -5], [-3, -2, -3, 3, 3, 0], [7, 2, 0, 0, 1, -2], [4, -1, 1, -1, 3, -2], [-4, 3, 3, -5, -1, -2], [1, 0, 1, -3, 1, 1], [-4, 3, -3, -1, -3, -1], [-1, 1, 6, 3, -3, 2], [-2, -1, -3, -1, 0, -3], [-6, 3, 1, -2, -4, 0], [-7, 1, 0, -3, -3, -6], [-4, -6, 2, -4, 2, -2], [0, 3, 3, -1, 6, 5], [3, 3, 4, 2, -2, 2], [-2, 2, -7, 0, -4, -4], [-4, 1, 5, -5, 4, 3], [-1, 5, 2, 1, -6, 4], [0, 9, 3, 1, -3, -1], [8, -2, 1, 5, 1, 1], [-1, 1, 10, 2, 4, -2], [-7, 2, 4, -4, 6, 0], [9, -2, -1, 6, -5, -3], [-5, -7, -2, 5, -1, -4], [2, 0, 2, -8, 2, -4], [0, -2, -1, -4, -1, 2], [-3, 1, 2, 1, -8, 2], [4, -7, -1, -2, -4, 0], [1, -5, -6, 4, -3, 3], [10, 0, -4, 4, -4, 2], [-7, 3, -5, -5, 0, 2], [1, 2, -6, 0, 0, -4], [-4, -2, 1, 2, 1, 0], [-5, 13, 6, 6, -5, 1], [-13, -1, 0, -4, 2, 2], [1, -2, -7, -8, 3, -3], [5, -2, 3, -1, -3, 6], [0, 4, -6, -1, 0, 2], [-6, -6, -2, 0, 0, -2], [-3, 4, -3, 3, -1, 2], [-10, 4, 7, 0, 0, -2], [-10, -1, -7, -5, -1, -3], [-2, 8, -1, 3, -3, 1], [9, -5, 6, 2, 3, 5], [-9, 2, -3, -8, -1, -1], [-5, 0, -5, -2, -1, 1], [-6, 5, 4, 3, 4, 3], [-4, -5, -6, 1, 4, 5], [0, 3, -9, 4, 2, 0], [-4, 4, 7, -7, 5, 0], [-6, 2, -1, 9, -3, 3], [3, 7, -9, 1, 2, -2], [-16, 8, 1, -2, -4, 2], [15, -2, -3, -1, 7, 1], [-11, 1, 4, -3, 3, -2], [-6, 1, -2, -7, 3, -3], [14, -2, -6, 2, -2, 6], [-1, 5, 3, -14, 2, 2], [-4, -9, 3, -11, 3, 4], [0, -10, -3, 4, -11, -8], [0, -12, -1, 7, 3, -3], [-13, 0, -5, -10, 1, 1], [0, 5, 1, -1, 0, -9], [-12, 1, 10, 3, 8, 3], [6, -9, -1, -2, -5, 7], [10, -8, 2, -3, 4, -2], [-10, 9, -2, 5, -7, 0], [4, -7, -1, -13, 1, -5], [6, -1, -6, -3, 5, 1], [-8, 0, -12, -4, 0, -8], [-10, -5, -7, 11, -8, 1], [-9, 5, 6, 8, 0, 12], [-11, 8, -2, -4, 5, 0], [4, -10, -10, 2, -2, 8], [-11, 1, -7, 2, 0, 2], [2, 4, 17, -8, 10, 4], [-14, 11, 1, 10, -1, -3], [2, 6, -3, -15, -3, 1], [-4, -3, -5, 11, -5, -7], [6, -6, 0, 1, -6, -8], [-6, 13, 4, 5, 1, -1], [-4, 11, 13, -2, 4, 6], [8, 9, 7, -1, -3, 3], [-16, 1, 1, 4, -5, -5], [9, -10, 1, -5, 5, -2], [2, -9, -2, -1, 1, 4], [-14, 1, 4, 0, -6, -3], [15, -4, -6, 6, -7, -2], [-9, 5, 12, 2, 7, 1], [-17, 12, 0, 6, -8, -10], [4, -3, -11, -3, 5, -1], [-1, -5, -2, -11, 6, 0], [0, -6, -8, -4, 8, -2], [2, -4, -8, -10, -6, 8], [-12, -4, 10, 10, 2, 2], [2, -9, 6, -1, -8, 7], [1, 10, 12, 2, -2, 0], [4, 13, 12, -8, 4, 9], [7, -12, -3, -1, 5, 11], [-4, 12, -1, 1, -1, 6], [-4, -1, 0, 11, 1, -4], [-5, -2, 10, -10, -1, -2], [0, -11, -4, -9, -3, -6], [11, 3, 0, -16, -2, 2], [-2, -9, -4, 1, 10, -3], [-4, -2, 5, 5, -1, -7], [-13, -4, -5, 1, 1, 2], [6, 0, 8, -2, -3, 4], [5, -11, 4, 9, 4, 4], [4, -14, -2, 4, 4, 0], [3, 8, 10, -2, -13, -2], [0, -6, 4, 20, 3, -4], [-4, 17, 0, 9, -10, 1], [-5, 4, -2, -4, -10, -2], [-5, -4, -5, -5, -11, 2], [-11, -6, 6, 6, 13, -8], [-1, 13, 4, -4, 9, 9], [0, -5, -6, 12, 0, -7], [15, -8, -18, 0, -11, 0], [-10, -3, -11, -1, 3, 1], [-21, 4, -3, 5, -5, -10], [14, -9, 6, -8, 2, 5], [6, 10, 9, 18, -9, 0], [9, 1, 1, 4, 12, 4], [-8, 3, -3, -9, 3, -7], [5, -6, -13, 4, -11, -11], [4, 9, -2, -4, -2, 3], [11, 9, 0, 4, -1, -5], [-4, 7, 13, -8, 5, -9], [-4, 11, 5, 3, 3, 13], [-16, 2, 10, 20, 0, 6], [2, 10, 0, 0, -11, -4], [4, 8, 6, 7, -4, -16], [5, 7, -8, 15, -9, -10], [6, -9, -15, 3, -5, -7], [-14, 3, 6, 7, -1, -8], [-1, 14, 1, -1, -11, 4], [-4, -6, -5, 11, -1, 12], [-19, -5, -4, -12, 7, 11], [-15, -15, 2, -4, 6, -4], [1, 8, 0, 2, 1, -16], [8, 4, 1, 14, -11, 0], [11, -12, 4, -2, 10, 8], [18, -10, 8, 4, 1, -2], [-10, 9, 7, -4, 3, -13], [12, 9, -4, 7, -7, 7], [8, 6, -17, 13, -15, -1], [-11, -5, -15, -2, 0, -4], [6, -5, -3, 3, 7, -3], [14, -5, -2, -3, 15, -5], [1, 12, 7, 17, -9, 7], [-14, -4, -3, 6, -10, -6], [-2, -6, -10, 2, -8, -2], [-14, 9, 12, -13, -9, -8], [-8, -7, 4, -7, 17, -7], [20, -4, 4, -4, 0, -8], [-4, -6, 4, -7, 8, 4], [2, 12, 12, -4, -2, 2], [-10, 13, -1, 3, -3, -5], [21, 4, 13, -21, -1, 9], [-33, 6, -5, 3, -7, -11], [6, 12, 1, -24, 3, 4], [-5, 14, 15, -9, 1, 1], [-11, -3, -4, -7, -13, -22], [20, -4, -3, 19, 9, 3], [0, -9, 4, -11, -1, 1], [-9, -7, -8, 5, 8, -2], [-6, 1, -12, 5, -21, -4], [17, -14, -14, 4, -1, 4], [28, -10, 11, -4, 13, 14], [0, 1, 17, -9, 9, 10], [-1, -1, -16, 8, -6, -8], [-14, 1, 5, -11, 5, -5], [-12, -1, 19, -6, 14, 8], [-7, 4, 14, 4, -1, 4], [16, -1, 24, -3, 15, 20], [1, 0, -1, 4, 5, 9], [-8, -4, -3, -16, -6, 0], [13, -14, -5, -9, 5, 6], [-7, -5, -12, -20, 3, -9], [-14, -9, -1, -11, 5, -1], [2, -13, -5, -5, 4, -1], [15, 8, 1, -10, -3, 15], [20, -11, -7, 11, 5, -2], [-10, -8, 4, 20, -6, 6], [-8, 17, 15, -7, -5, -4], [-16, 3, 1, -19, -5, -5], [-15, 13, 0, -22, -1, -5], [-7, 26, 17, -19, -1, -2], [26, 2, 10, -2, -7, 8], [-2, 3, 11, -12, 19, 13], [-13, 6, 14, 18, 0, 0], [1, 5, 0, 12, 10, 12], [-4, 6, 8, -8, 10, 0], [20, 7, 0, 4, 12, -1], [-13, 0, 4, -14, 11, 8], [25, -2, 2, -8, -3, -12], [-11, 20, 16, 22, -6, 12], [20, 4, -12, 0, -10, -4], [22, -5, 7, 9, 5, 11], [-4, -16, -13, 2, 0, 6], [8, -7, 6, -13, 7, 12], [-15, 15, 1, 1, 14, 6], [-30, 2, -3, -6, -1, -14], [-20, -10, 0, -10, 2, -12], [-30, 15, -9, -11, -11, -5], [12, -11, -14, -5, -13, -22], [-6, -1, 23, 0, 1, -5], [-3, -10, -10, 12, -12, -12], [-3, -5, -6, -2, -12, -12], [-14, -11, 0, 11, -11, 5], [19, -3, -14, 15, -1, 2], [9, -13, 0, 7, 0, -8], [0, -13, -8, 3, -8, -13], [21, -9, -11, 4, 6, 10], [-18, -11, -9, -15, 11, -7], [2, 17, -15, 1, -11, 0], [28, 2, 0, -4, 0, 6], [26, -6, 7, -4, 9, 6], [-16, -5, 7, 4, 4, -10], [28, 1, -13, 17, -11, -5], [10, -1, 13, -5, -11, 3], [-14, -2, 0, 11, -6, 16], [6, -11, 3, 16, -1, 5], [-6, -24, -1, -16, 21, -10], [15, -24, 4, 10, -1, -6], [17, -19, -14, 7, 10, 6], [8, -8, -9, -19, 7, -19], [13, -6, 12, -10, -11, 2], [-16, 20, -20, -20, -3, 4], [14, 13, -7, 2, -2, -6], [22, -30, -16, 8, -4, 0], [-2, 12, 14, -18, 16, 8], [8, 15, 12, 3, -4, 5], [-24, 22, 14, 3, 8, 14], [2, 14, 0, 25, -16, -4], [-2, 19, -10, 3, 0, -3], [13, -4, -13, -21, 1, -20], [-8, -13, -24, 2, -2, -5], [-24, 10, 4, 0, 0, -18], [-3, -19, 6, -18, 19, -3], [36, 1, 8, -3, 5, 8], [-7, -8, 7, 13, 13, -4], [30, 2, 5, 15, 11, 15], [-17, 3, 16, 17, -2, 4], [8, 4, 16, 14, -10, -8], [16, -2, 18, -9, 12, 6], [-4, -4, 9, -4, 7, -12], [-2, -14, 5, -27, -3, -3], [18, 10, 21, -26, 22, 8], [7, -13, 8, -21, 17, 2], [-3, -8, -3, 11, -1, -15], [18, 3, -7, 17, 2, -1], [-6, -18, -4, 12, 4, -2], [-8, 29, 8, -13, 3, 14], [-31, 11, 8, -14, -6, -2], [-14, -23, 8, 14, -8, 3], [-12, 17, 6, 11, 13, 9], [0, -5, -2, -5, -21, -1], [16, -11, 2, -21, -2, 1], [2, -11, -9, 32, 5, 5], [0, 14, 10, -2, 10, -16], [14, 10, 15, -10, 5, 4], [24, -4, 4, 6, 20, 4], [-4, 11, -11, -11, -3, 0], [-29, 25, 11, 11, -14, 8], [1, -26, -5, -19, 9, 14], [-5, 8, 13, -17, 13, 2], [-38, -10, 6, -16, 8, 4], [-14, 2, 14, 0, 10, 2], [-23, -11, -4, -8, 12, 4], [-28, -3, 8, -3, 9, 8], [-36, 4, 2, 22, -8, 0], [4, 5, 2, 11, -10, -17], [-22, 25, 11, 15, 5, 4], [-36, -11, -14, 7, -7, -10], [-8, 3, -17, -20, -11, 5], [28, -12, 8, -4, 18, 2], [-16, 2, 28, -10, 18, 10], [-9, 16, 5, 0, 21, 27], [-7, -19, -10, -8, 7, 1], [-33, 0, 7, -12, 3, -11], [-8, -9, -3, -11, 2, 9], [24, -11, -3, -8, 0, -10], [26, 7, -13, 2, -2, 2], [4, -7, 6, -33, 9, 4], [-20, -8, -25, 16, -14, -16], [5, 15, 4, 1, -1, -12], [-15, -3, -8, 2, -4, -28], [-8, 9, -4, 5, 4, -17], [10, -1, 0, 21, -5, -14], [13, 15, 12, -17, -6, 16], [-4, 22, 5, 28, -10, 6], [-5, 1, -5, 24, -4, 4], [-1, 32, 17, -15, -1, 2], [-26, -2, -18, 2, 15, 0], [-32, -2, 0, 21, 6, -12], [1, -19, -12, 6, 5, -1], [8, -21, -13, -33, 14, -1], [-5, -6, 12, 2, 5, 0], [13, -22, 12, 2, 4, 8], [4, -8, -2, -5, 16, 18], [-30, -7, -6, 19, 0, 11], [25, 2, 1, -7, 17, 3], [-30, -1, -6, 15, -2, -11], [22, -1, 24, 5, 18, 17], [23, 9, 20, -7, -8, 8], [-6, -20, 15, -10, 1, 0], [-3, 4, -8, 4, 19, -4], [-33, 7, 7, -8, -6, -4], [-5, -19, -5, -18, 14, 6], [2, -17, 9, 15, 0, -7], [18, 17, -7, -16, 12, -10], [17, -18, -23, 4, -19, 1], [6, 9, -23, -19, 3, -14], [14, -1, -13, 21, 10, 21], [32, -11, -7, -7, -7, -10], [16, -6, 1, 8, -2, -16], [-4, 7, -8, -14, 6, -1], [-19, 9, 1, 27, -10, -4], [14, 1, 35, 6, -5, -1], [-16, 25, -3, 23, -18, -5], [-17, 3, -19, -4, -2, -16], [7, 3, 11, -17, 10, 2], [-9, 11, -15, 0, -16, -4], [-4, -12, -11, -38, 2, -2], [-11, -3, -22, -19, -7, -4], [31, 1, -16, 4, 8, 8], [-30, 7, -7, -5, 2, -5], [-36, -24, -13, 7, 5, -13], [13, 5, 4, 3, -4, 12], [-24, 12, -5, -25, 7, 13], [12, 26, 14, 10, -17, 8], [16, 10, 24, 20, -11, 6], [4, 13, -15, 12, -7, 13], [19, -19, -11, -4, -16, 8], [19, 4, -1, -2, -27, 1], [9, -4, -14, 24, -5, 16], [1, 7, 8, -22, -3, 19], [1, -11, -7, 28, 4, 4], [8, 16, 6, -4, -15, 6], [12, -26, -14, 10, -8, -12], [14, 6, 12, -15, 2, 20], [9, 2, 1, -11, -11, 2], [-12, 13, -5, -1, -22, -1], [13, -19, 6, 2, 4, 2], [-17, -18, 0, 18, -8, 2], [27, 14, 4, 4, -3, -6], [34, -12, -12, 8, 15, 8], [-18, 15, 38, 23, -5, 12], [3, 17, 12, -7, 11, 22], [3, 12, 5, 18, -7, -7], [-28, 22, 1, 10, 16, -4], [19, 2, 10, 16, 14, -10], [5, 4, 25, -8, -15, -11], [-25, 34, -4, 8, -4, -10], [-10, -17, 4, 10, -18, 9], [-37, 17, -4, -27, 5, 16], [-33, 17, 7, 21, 6, -8], [-6, -7, -7, 19, 9, -9], [-16, -12, -4, 21, -4, -12], [-1, 17, -8, -4, -17, 3], [6, -13, -20, 11, 10, 7], [-12, -1, -35, -9, 4, -11], [12, -1, 2, 1, 7, -9], [-20, -28, -9, 23, 1, -9], [9, -12, 12, -14, 27, 8], [-28, 5, 0, -1, -13, 17], [-18, 1, 1, 14, 19, 5], [16, 8, 3, 18, 10, -6], [-3, -27, -10, 1, -14, -6], [18, -12, -6, -14, 0, 20], [-47, 29, -14, 0, -21, -17], [20, -5, -9, -5, 3, -15], [-24, -6, -2, 10, -22, 6], [-12, 8, 2, 20, -14, 4], [-26, 5, -4, 23, -11, 2], [-28, -8, -4, -2, -12, -8], [-28, 9, 11, -10, 5, 9], [-27, -12, 1, 29, -17, 12], [4, -1, -8, 7, -18, -5], [20, -3, -1, -5, 1, -20], [-12, -31, -15, 34, -20, -8], [22, 10, 23, 10, -6, 0], [1, 7, 34, 14, -3, 19], [-36, 11, -9, -5, -17, -16], [1, 17, -12, 7, -14, -26], [-18, 19, -11, 5, -23, -13], [20, 23, 18, -11, 1, 27], [20, 11, 23, -5, -1, -8], [4, 25, -5, 21, -19, 0], [16, 5, -17, -8, 9, -9], [26, -7, -14, 23, 19, 22], [0, 7, 3, 14, -32, -2], [-9, -17, -28, 1, 13, -6], [12, 27, 18, 1, 7, 22], [-23, 4, -9, -28, -15, -19], [-26, -22, -5, 2, -7, 6], [10, 6, 6, -10, 0, -20], [2, 3, -18, 26, -28, -5], [-21, 18, 15, 33, -23, 11], [12, -7, -3, -6, 2, 24], [-17, -13, -15, 23, -16, -14], [8, 18, 12, 12, -11, 6], [-29, -5, 32, -12, 24, 0], [22, 4, 12, -6, -4, -8], [-8, 3, -21, 13, -11, 6], [-11, -16, 8, -14, 0, -20], [-32, -4, 6, -14, 10, -16], [16, 19, 27, -5, -13, 4], [-28, -35, 5, -8, 7, -7]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_8281_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_8281_2_a_cc();".
// 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_8281_2_a_cc(:prec:=6)
    chi := MakeCharacter_8281_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 2));
    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_8281_2_a_cc();".
// 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_8281_2_a_cc( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_8281_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<2,R![-2, -4, 14, 0, -8, 0, 1]>,<3,R![2, -8, -12, 12, 20, 8, 1]>,<5,R![31, -26, -31, 24, 5, -6, 1]>,<11,R![-562, 692, 186, -156, -38, 4, 1]>,<17,R![-5294, -6792, -2792, -324, 56, 16, 1]>],Snew);
    return Vf;
end function;