
// Make newform 8470.2.a.cv in Magma, downloaded from the LMFDB on 16 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_8470_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_8470_2_a_cv();".
// 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_8470_2_a_cv();".
// 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, -9, 14, 5, -8, -1, 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], [-1, 6, -4, -2, 1, 0], [0, -1, 6, -4, -2, 1], [-2, -5, -1, 6, 1, -1], [2, -4, -7, 5, 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_8470_a();"
function MakeCharacter_8470_a()
    N := 8470;
    order := 1;
    char_gens := [6777, 6051, 7141];
    v := [1, 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_8470_a_Hecke(Kf)
    return MakeCharacter_8470_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 := [[-1, 0, 0, 0, 0, 0], [0, -1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [2, -1, 1, 0, -1, 1], [3, -1, 0, 1, 2, -1], [-1, -2, -1, -1, 1, -2], [-2, 0, -2, -2, 0, 0], [2, 0, -2, -2, 1, 2], [0, 0, 0, -2, -1, 0], [-1, 1, -1, -1, 2, -1], [4, -2, 3, -3, -2, 0], [2, -1, 0, 2, 1, -2], [2, -2, 0, 0, 2, 0], [-3, 0, 0, 0, -3, -1], [-3, 1, -2, 3, -1, -1], [-5, 3, -5, 6, 0, 4], [-2, -2, 3, 0, 1, 2], [-1, -2, -2, 3, -2, 0], [2, 2, -3, -2, -1, 3], [2, -5, 1, -1, 0, -6], [7, 0, 1, 3, 1, -3], [0, -3, 4, 5, 4, -3], [1, -1, 0, 3, 4, 2], [6, -3, 1, -1, -2, 0], [-1, 0, 2, -2, 1, 1], [1, 5, 0, 3, -2, 4], [10, 4, 4, -3, -2, 1], [5, 3, 6, 2, -3, 4], [1, 1, -5, -2, -3, -2], [1, 2, 1, -7, -1, -2], [-6, 1, -2, -2, -2, -4], [-11, 3, -9, -1, -1, 1], [8, 6, 2, 2, -4, 4], [-5, 1, -3, 6, 2, 4], [1, 2, -8, 4, 2, -1], [-3, 6, -1, -3, 0, -2], [-2, 7, -5, 3, -3, 4], [5, -3, 5, -2, 1, -4], [-2, -8, -1, -1, 1, -1], [0, -7, 1, 3, 4, 2], [-7, -1, -7, 4, -2, 2], [1, 2, -2, -1, -7, 0], [6, -12, 6, -2, 2, -8], [2, 2, 12, 1, 0, 3], [7, -8, 7, -4, 1, -4], [-1, 2, -4, -4, -3, -7], [2, 10, -5, -1, -2, 5], [-1, -3, -7, -2, -4, 2], [10, -1, -8, -6, -2, 2], [7, 0, -2, -7, 0, 4], [7, 4, 9, 0, 4, 7], [10, -1, -1, -4, 2, 5], [8, -9, 8, -6, -3, -2], [8, 5, -1, 0, -3, 1], [8, 5, 3, 1, 0, 2], [-16, -2, -6, 4, 3, -4], [8, 3, 7, 1, 3, -6], [8, -3, -2, -1, 3, -3], [0, 8, -8, -4, -2, 0], [9, -7, -3, -2, 3, -2], [10, 0, 17, 0, -2, 1], [6, 0, 0, -6, -2, -6], [-5, 0, 3, 1, -4, -2], [5, -5, 3, -3, 2, -3], [0, -5, 4, -3, -2, -1], [5, 3, -4, 6, 1, 8], [3, 3, 4, -3, 8, 3], [-6, 8, -4, -4, -6, 0], [0, 12, -13, -6, -7, 0], [-4, 12, -12, 8, 0, 4], [-5, 7, -1, -5, -4, 5], [0, -9, 1, -3, 5, -6], [1, -7, 4, -2, -3, 5], [-5, -1, -7, 9, 0, 9], [-4, 4, -2, 3, 3, 3], [5, 11, 3, 6, -5, 4], [12, -4, 9, -13, 1, -4], [-9, -3, 9, 7, 3, -3], [-15, 3, 2, 0, -2, -1], [8, 0, -4, 4, 4, 4], [2, -6, 8, 8, 6, -4], [-3, 1, 4, -3, -6, -1], [10, -8, 14, -1, 4, -9], [9, -1, 12, -1, 2, 8], [-12, 2, -11, -4, -8, -2], [2, 4, -19, 0, -4, -1], [-6, -1, 9, 13, 8, 2], [-9, -7, -5, 8, -1, 0], [6, 3, 1, 2, -2, 3], [-2, 0, 0, 2, -1, -14], [1, -10, -16, -6, 2, -3], [10, -2, -13, -1, -2, 2], [-4, 1, 8, 11, 4, -7], [14, -8, 10, 4, 6, -8], [3, 2, -12, -15, -10, -6], [-1, 2, -7, 10, 6, 3], [7, 2, -9, 4, 5, 3], [0, 6, -12, -2, -1, 10], [1, -1, -10, -3, -2, 1], [17, 10, 6, -8, 1, -3], [12, 7, -2, 4, 2, 2], [1, 5, 18, 1, 3, 1], [13, -7, 17, 1, 1, -5], [5, 11, -8, -1, -2, -5], [-9, -8, -1, 12, 5, -3], [19, 2, 5, 3, -2, 14], [4, -3, 19, 1, 2, 4], [-11, 2, -17, -2, -5, -2], [1, -9, 11, -9, -4, -7], [-11, 0, -2, 4, -3, -3], [12, -1, -2, -11, -4, 6], [-17, 2, -15, -9, -5, 6], [-6, 0, -10, 16, 2, 8], [0, 7, -16, 3, -3, -9], [-9, -1, 6, -1, 3, -8], [5, 12, -4, 2, -3, 1], [2, 13, -17, 3, -3, 6], [-11, 7, -14, 8, 2, -2], [11, 7, 13, -6, 2, -8], [19, -6, 11, 2, -1, -3], [-14, 5, -7, 8, -3, -5], [0, -2, -10, 6, 0, 4], [7, -1, 6, -5, 3, -9], [12, 2, 4, 9, 7, -3], [-2, 4, 20, 3, 2, 1], [4, 18, -6, -1, -1, 13], [2, -16, 12, 2, 12, -8], [4, 6, 4, 10, -6, 8], [-9, 20, 3, 2, -16, 9], [28, 6, 18, -10, -10, 12], [-3, 12, 0, 1, -16, 12], [3, 3, 11, 7, -2, 1], [2, -6, 13, -11, -3, 7], [-13, 13, -7, -1, -17, 5], [25, -3, 21, 2, 7, -6], [19, 4, 3, 4, -5, 5], [15, 10, 2, -2, -12, 7], [1, 2, 11, -1, -7, 8], [3, 8, 7, 6, 0, 12], [-20, -4, -28, 3, 4, -11], [-10, 5, -9, 14, 1, 13], [17, 4, 11, 7, -8, 2], [13, 6, 6, 1, -2, -6], [-20, 14, -8, 2, 5, 4], [5, 0, -2, -16, -2, 1], [1, -10, -19, -9, 2, -3], [-5, 10, 1, -13, -13, 2], [0, 3, 11, -6, -1, -13], [9, 7, 29, -1, 0, 1], [20, 3, 2, -1, -10, 9], [1, -3, 8, -9, 2, 4], [2, 13, 3, -1, -3, 10], [1, 4, 5, -11, -10, 12], [21, -1, 35, 4, 0, -6], [8, 5, 21, 5, 0, 4], [21, -8, 11, -4, 4, -7], [0, 4, 13, 4, 5, 10], [-7, -4, -8, 1, 10, -12], [-8, 16, -15, 0, -7, 6], [23, -16, 5, -5, -11, -1], [17, 1, 1, -10, -1, 16], [-1, 13, -11, 5, 5, 11], [-16, -7, -1, 4, 0, -13], [38, 1, 7, 3, -5, 4], [27, -5, 11, -20, -6, -2], [-3, -2, -16, 2, 8, -11], [-3, 1, -4, -10, -10, -3], [13, 4, -6, -2, 8, 1], [13, 9, -8, -6, -3, 9], [18, 15, -5, -11, -10, 4], [-13, -6, -2, 7, -2, -10], [7, -11, -10, 0, 1, 2], [-12, 6, -6, -8, -3, -8], [3, 0, -6, -11, -5, 4], [5, -24, 1, 2, 9, -6], [12, 6, -6, 6, 5, 12], [10, -4, 14, -16, 0, -10], [-7, -3, 9, 6, 14, -2], [-3, 1, 9, -8, -5, 8], [-25, -1, 15, 3, -9, -9], [12, 3, -1, 3, -1, 6], [-16, 17, -15, -2, 6, 3], [-4, -10, -6, 4, -6, 0], [19, 2, 16, 1, 8, -8], [-30, 1, -13, -7, 3, -4], [-12, -10, -17, -4, 2, 5], [5, 11, -4, 7, -11, 9], [4, 8, 14, 1, 1, -1], [-10, 8, -9, -12, 1, -8], [2, -12, -11, -4, -3, 8], [-16, 22, 1, 5, -11, 9], [-1, -18, -2, 1, -2, -14], [-7, -3, -9, 9, 1, -7], [22, 6, 6, 8, -12, 6], [9, 5, 18, -12, -18, 5], [-15, 0, 8, 0, 5, -11], [25, 3, 1, -15, 3, 13], [13, -2, 6, 4, -5, 1], [20, -6, -14, 9, 20, 3], [-32, 6, -8, 0, 10, -10], [3, -18, -8, 8, 2, 7], [7, -4, 17, 20, 11, 12], [-29, 3, -12, -2, 6, -7], [3, 0, -6, 2, 18, -5], [-2, 2, -6, 9, 1, 15], [0, -13, 8, 6, 3, 5], [23, -15, 17, 9, 9, -7], [1, 24, 7, 2, -10, 6], [-16, -9, -6, 5, 16, -10], [-4, 0, 14, 16, 0, -10], [-23, -14, -6, 4, 14, -7], [1, -11, 8, -17, 7, -8], [12, 10, -6, -5, 3, 21], [1, -9, -14, 10, 3, 9], [-14, -9, 3, -4, 9, -11], [-16, 21, -16, -5, -6, -1], [-43, -6, -16, 16, 14, -15], [-15, 4, 6, 0, 7, -1], [-20, 4, -18, 15, 1, 17], [-32, 18, -6, 8, 6, 8], [-16, 19, -21, -12, -12, -3], [10, 12, 6, -8, 6, 0], [-3, -4, 24, -7, -11, -10], [-16, 14, -18, 6, 1, 8], [24, 22, -7, 4, -9, 0], [-16, 0, 6, 10, 14, 0], [-21, 13, -13, 13, 2, -1], [-25, -16, 15, -6, 9, -2], [2, 2, -24, -12, -18, -10], [1, -15, 14, -14, 6, -7], [-24, -2, -20, 10, 10, -14], [-5, -27, 1, -9, 7, -13], [-3, -13, 0, -3, -1, -22], [17, 5, 27, -7, 4, -11], [38, 13, 22, -7, -4, 9], [-7, 1, -1, 15, 6, 7], [-51, -1, -8, -8, 3, -9], [0, 10, -20, -5, 2, 11], [4, -1, 10, -4, 5, -1], [-20, -12, 13, 19, 11, -6], [4, 22, -8, 12, -2, 12], [-12, 12, -8, 1, -4, -3], [18, 5, -10, 16, -3, 3], [-26, 2, -20, 11, -13, 7], [-21, -6, -16, 10, 17, -19], [2, 6, -13, -17, -1, 14], [-19, -12, -6, -13, 9, -22], [38, 3, 1, -18, -5, 1], [2, 0, 6, -18, -8, -20], [-26, 14, -10, 6, 6, -4], [7, -1, 23, 4, -1, 16], [-25, 9, -12, 2, 0, -4], [5, 27, 17, -4, -7, 0], [-37, -12, -9, 0, 4, -13], [20, 8, -8, -9, 3, 13], [34, 1, 16, -21, -8, 4], [6, -4, 16, -16, -12, 0], [-37, 4, 13, -3, -2, -6], [-25, 21, -17, 14, -5, 24], [-25, -5, 1, -13, -1, -9], [-34, 3, -31, -1, 0, 0], [-21, 8, -26, -12, -10, 1], [0, -4, -16, -16, -8, -2], [-39, 7, -16, -16, -10, 1], [-24, -2, -20, 2, 9, -6], [34, -12, -1, 1, 5, -3], [-15, 2, -5, 5, 14, -10], [17, -18, 32, 0, -1, -1], [20, -6, 22, 12, 0, 2], [-18, -6, -15, 10, 13, -7], [42, 3, 18, 2, -5, -1], [-25, -6, -10, 11, 8, 6], [-21, -16, -13, 9, 4, -14], [-2, -12, 8, -14, 16, 2], [7, -26, 21, 11, 0, -10], [-8, -6, 26, -4, -4, -6], [16, -4, 39, -20, -6, -12], [-29, -6, 6, -5, 7, 6], [-11, -11, -41, 1, 2, 3], [30, -13, 9, 5, 2, -8], [-45, 2, -30, 6, -7, 19], [-18, 8, -4, 12, 2, -8], [-26, 7, -32, -1, 10, -10], [-8, -1, 31, 15, 16, 8], [7, 10, 1, -6, -3, -3], [25, -5, 25, -1, -6, 19], [-22, 4, 6, 10, 7, 2], [9, -5, 3, 9, 3, 3], [26, -6, 24, 4, 6, 0], [6, 12, -5, -8, -8, -1], [-17, -4, 7, 5, -5, 11], [-2, 25, -18, -4, -6, 15], [16, -13, 3, -7, 9, -22], [31, -9, 17, -10, -10, -4], [20, -2, 16, -6, 8, -12], [-10, -8, -26, 6, 10, -20], [11, 8, 11, -12, -10, -2], [-22, 15, 2, 16, -4, 8], [21, -11, -12, -9, 6, -14], [38, 12, 26, -4, -10, 14], [-14, -1, -5, -13, -6, -12], [4, 14, 11, 6, 11, 13], [-10, -8, -7, -9, -13, -13], [-32, 10, -3, -8, -12, -7], [0, 8, 5, 0, 13, 17], [-19, 19, -27, -16, -18, 0], [-25, 16, -26, -7, -10, 6], [23, 2, 22, -16, -13, 1], [-7, 10, 2, 8, 11, 3], [38, -12, 34, -8, 6, -8], [12, 16, -11, 8, 6, 4], [21, 11, 2, 13, -4, -11], [0, 13, -9, 12, -17, 11], [17, 1, -8, -2, -21, 3], [19, 8, 35, -2, 2, 0], [10, -9, 27, -13, -8, -8], [-17, 30, -35, -1, 6, 19], [-14, 15, -8, 23, -3, 1], [5, 7, -6, -20, -14, -1], [18, -10, 1, 0, -6, 15], [-8, 3, -13, -5, -2, 0], [22, -29, 33, 16, 15, -7], [-1, 6, -29, 6, 11, 1], [-17, -2, -29, 6, -1, -12], [6, 26, -18, 0, 4, 16], [25, -20, 16, -7, 3, -18], [-3, -6, -12, 14, 14, 9], [34, -10, -2, 18, 0, 20], [-2, -10, 38, -10, -5, -4], [-1, 20, -14, 26, 3, 11], [-2, -18, -22, -12, 5, -4], [21, 13, -4, 1, -7, 6], [-23, 18, -11, 12, 0, 23], [-11, -4, -12, 21, 23, -2], [18, -8, 10, -32, 8, -2], [-17, 17, -16, -15, -12, -15], [-2, -9, 12, 3, 9, -12], [38, -10, 42, 0, 12, -20], [24, 8, 8, 12, 4, -6], [-20, 13, 22, 12, 6, 4], [12, -4, 4, -6, 10, -12], [4, 17, 5, -9, -6, -6], [-22, 0, -4, 4, 18, -12], [19, -9, -5, -13, 1, -19], [6, -6, -8, 16, 16, 4], [-12, 5, 21, 26, 14, 13], [6, 6, 12, -14, 1, -2], [-19, -20, -32, -6, 6, 3], [-28, 16, -3, 16, 14, 8], [-18, -10, 9, 12, 16, -17], [-16, 16, -32, 2, 3, -6], [-16, 5, 3, -17, -1, -12], [0, 8, -6, -21, -5, 11], [22, -1, -6, 22, 13, 14], [22, -22, 22, 16, 10, -2], [17, -2, -5, 23, 7, -4], [-34, 15, -6, 3, -16, 2], [-22, -28, 2, 0, 4, -8], [-14, -1, -13, -5, 3, 6], [-21, 22, -4, 9, 15, -6], [-15, -8, -4, 10, -14, -19], [25, -3, 22, 6, 16, -22], [4, 23, -7, 18, -16, 9], [-21, 6, 15, 1, 7, -13], [44, -15, 15, -2, -1, 3], [-29, -10, 8, -10, 12, 1], [-28, -5, 18, -11, -17, -13], [29, -5, 54, 10, 1, -9], [11, 26, -6, -9, -11, -6], [-36, 13, -5, 10, 13, -13], [2, 8, 16, 3, 3, -9], [0, -10, -2, 16, 15, 0], [-11, -16, 12, 2, -3, -13], [5, 3, -14, 1, 5, 23], [7, -9, 3, -8, -24, 0], [-5, -14, 1, -5, 4, 10], [3, 18, 13, -10, 11, 2], [-10, 14, -21, 28, 11, -9], [3, -14, 44, -7, 2, 12], [-52, 1, -14, 12, -2, 4], [5, -6, 2, 6, 10, -17], [7, -6, 14, -7, 3, 8], [-29, -11, -4, -2, 4, -27], [29, -30, 42, 10, 3, -9], [-2, 5, -43, -5, -16, 0], [35, -11, 25, 16, -11, 6], [-25, 12, -25, 21, -12, 10], [5, -8, 34, -14, 17, 1], [1, -24, -23, -1, 1, 10], [12, 16, 4, 6, 10, 10], [-35, -5, -16, 14, -1, -3], [-13, 4, 20, 13, -5, 4], [-29, 38, -4, 7, -6, 16], [-14, -7, 11, 18, 16, -9], [-8, -2, 24, -13, -17, 3], [-30, -1, -10, -7, -7, -14], [-15, 4, -23, -26, 1, 6], [22, -10, -10, -4, 4, -10], [1, -9, -11, 14, 10, 2], [-47, 9, 6, -17, -17, -12], [9, -9, 3, 26, 15, 2], [-4, -22, -9, -4, 5, 0], [-26, 14, -48, -2, 0, 14], [-12, 26, -30, -14, 0, 24], [2, 10, -8, -8, -6, -26], [-4, 36, -31, 10, 2, 6], [23, 4, -8, -1, 5, 14], [6, -12, -23, -16, -2, -22], [29, 24, -1, -15, -22, 20], [-11, 43, 9, 11, -14, 21], [22, -23, 33, -4, 0, -15], [-7, 5, -24, 22, 8, 6], [-2, -26, 21, 30, 24, -11], [25, -29, 37, -12, -8, -8], [16, 0, 18, -24, -2, -8], [2, -14, 28, 10, 2, -8], [-22, -16, -23, 10, -3, -14], [41, -11, 13, 5, 0, -13], [12, -12, -18, -12, 10, 18], [8, -10, -6, 16, 0, 18], [-21, 36, -26, -4, -8, 3], [44, -24, 23, -7, 7, -18], [-16, 20, 7, -6, -17, 11], [51, -29, 19, -16, 1, -18], [-14, 24, -23, -8, 13, 15], [-17, 38, -27, -3, -13, 12], [-6, -14, 29, 23, 1, -8], [-2, -10, -10, 7, 0, 13], [-8, 1, -12, 17, 9, 18], [23, 2, 12, -5, 13, 18], [23, -2, 24, -3, 9, -20], [-22, 18, -20, 6, -18, 24], [-32, 22, -22, 4, -22, 30], [-22, 5, -60, -11, -1, 8], [43, -18, 21, 9, 29, -12], [0, -24, 36, -5, -3, -23], [-61, 5, -32, -11, 6, -16], [-10, 4, 6, 5, 7, 5], [7, 24, -13, 13, -11, 1], [5, -12, -1, 34, 24, 8], [8, -4, 26, -18, 14, -4], [-21, 28, -8, -9, -2, 16], [44, -15, 32, -5, 13, -16], [-10, 15, -7, -2, -18, 9], [34, -14, 34, -32, -6, -8], [-12, 6, -44, 2, -10, -16], [2, 16, -7, -3, 1, 17]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_8470_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_8470_2_a_cv();".
// 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_8470_2_a_cv(:prec:=6)
    chi := MakeCharacter_8470_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(3169) - 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_8470_2_a_cv();".
// 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_8470_2_a_cv( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_8470_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<3,R![-1, 9, 14, -5, -8, 1, 1]>,<13,R![1516, -1208, -68, 214, -28, -6, 1]>,<17,R![4609, 1937, -1274, -151, 138, -21, 1]>,<19,R![-941, 891, 652, -149, -56, 3, 1]>],Snew);
    return Vf;
end function;