
// Make newform 3549.2.a.y in Magma, downloaded from the LMFDB on 17 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_3549_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_3549_2_a_y();".
// 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_3549_2_a_y();".
// 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 := [-728, -252, 224, 55, -25, -3, 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], [-10, -1, 1, 0, 0, 0], [0, -10, -1, 1, 0, 0], [76, 18, -17, -2, 1, 0], [-92, 72, 39, -17, -3, 1]];
    Rf_basisdens := [1, 1, 2, 2, 4, 4];
    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_3549_a();"
function MakeCharacter_3549_a()
    N := 3549;
    order := 1;
    char_gens := [1184, 1522, 3382];
    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_3549_a_Hecke(Kf)
    return MakeCharacter_3549_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, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [-1, 0, 0, 0, 0, 0], [1, -1, 1, 0, 0, -1], [0, 0, 0, 0, 0, 0], [-1, -1, 1, -1, 1, -1], [1, 0, -1, 0, 1, 1], [-3, 0, -2, 0, 1, 1], [-1, 1, 1, -1, -3, 0], [1, -1, -1, 1, 1, 1], [-4, -1, -1, -1, 2, 0], [-1, 1, 1, 0, -3, 1], [-2, 0, -2, 2, 0, 1], [7, -2, -1, -1, -1, -1], [0, 1, 3, 1, -4, 0], [-6, -1, -2, 0, -2, -2], [-5, 0, -3, 1, 1, -1], [1, 0, -2, 2, 3, 1], [2, -1, -1, -2, 0, 0], [1, 1, -5, 1, 3, 1], [-3, -1, -1, 2, 2, 1], [3, -1, 1, 0, -7, -1], [-2, 3, -2, 0, 6, 2], [4, -1, 2, -1, -4, 0], [-2, -2, 6, 0, 0, 0], [6, -2, 0, -1, 0, -2], [5, -1, 1, 0, -10, -1], [-5, 0, -3, -2, 2, -1], [-1, 2, 5, 1, 0, -1], [-3, 3, -3, -1, 5, 0], [-6, -1, 4, 1, -4, 2], [-10, 2, 2, 1, -1, 2], [-13, 3, -3, -1, 7, 1], [5, 2, -3, 2, 1, -2], [-8, 1, -4, 2, 0, 3], [-1, -1, -3, 0, 5, 1], [9, -1, 11, -2, -11, 0], [5, 0, 5, 2, -1, 1], [-2, -3, -4, 0, -2, -2], [-8, 0, 8, -1, -5, -2], [6, -1, 4, -1, 2, 2], [-13, 2, -3, 0, 3, 0], [-7, -1, -13, 1, 9, 0], [-1, 2, -1, -2, 5, 1], [-3, -2, 3, -3, 3, -1], [-13, -2, -4, 1, 1, -3], [1, -2, -3, 3, -5, -1], [-11, -1, -1, 1, 3, -1], [0, -1, 6, -1, 0, -2], [-11, 2, 3, 1, -3, 0], [-6, -1, 0, -5, 4, -1], [12, -1, 6, 1, -10, -2], [-11, -1, -5, 3, 5, -1], [-14, 0, -4, 1, 4, 0], [0, 2, -10, 0, 1, 0], [-2, 1, 0, 4, -4, 4], [-10, -2, -4, 0, 4, -2], [-1, 3, -9, 1, 0, -1], [4, -1, 6, -4, -4, 0], [-4, 4, -2, 1, 8, 6], [15, 0, 5, 0, 3, -1], [5, 1, 5, -1, 7, -1], [4, -5, 0, -1, 4, -4], [13, 0, -1, 2, -11, -1], [-14, 1, -4, 4, 7, 2], [9, -3, 12, -4, -15, -1], [-6, 3, 0, 2, 10, 3], [3, 5, -6, 1, 1, 3], [2, 5, -2, 3, -6, 2], [-17, 1, -7, 2, 1, 3], [-5, -3, 12, 0, -7, 1], [-7, 3, -1, 1, 7, 3], [0, -4, 7, 1, 0, 2], [-23, 2, -17, 2, 11, 2], [12, 0, -2, 2, -10, -2], [-3, -2, -9, 1, -8, -3], [-4, 2, -2, 3, 8, 4], [-2, -1, 0, 0, -8, 3], [-9, 5, 5, 1, 9, 3], [-8, 1, 8, -2, -14, -4], [-5, 0, 13, -1, 9, -1], [9, -2, 1, 4, 6, 1], [6, -2, 10, -4, -16, 0], [7, 1, -1, 4, 3, 1], [-4, -1, 0, -4, 10, -1], [-3, 1, -8, 3, 9, 1], [0, -1, 6, 1, 7, 4], [9, 4, 11, 0, -15, 3], [9, -2, 11, 2, -12, -1], [-7, 3, -9, -1, -3, 5], [9, -4, 13, -1, -15, -3], [6, 4, 8, 3, -7, 2], [5, -2, 12, -1, -15, -5], [-6, 8, 8, -1, -8, -1], [16, 0, 26, -1, -10, -2], [13, 4, 17, 0, -11, -1], [-5, 0, -11, 1, 5, -1], [9, -5, 5, -5, -9, -5], [1, -2, -4, -1, -3, -5], [9, -4, 3, 0, 0, -1], [-2, 2, -3, 2, 0, -2], [-2, 6, 4, 5, -10, 4], [-2, 4, 0, 0, 5, 4], [7, -4, 9, 0, -3, 0], [-4, 2, 16, -3, 2, -2], [14, 3, 8, -2, 0, 0], [-13, 1, -5, -2, 3, -1], [-25, 3, -7, 0, 5, 4], [2, -4, 0, 2, 4, 4], [19, -1, -1, 2, 5, -3], [6, 2, 10, -7, 0, 1], [5, 4, 9, -2, -1, -1], [0, 3, -10, 4, 10, 4], [-12, 1, -8, 0, 1, 0], [-6, -2, -23, -2, 12, -2], [-1, 3, -17, -1, 15, -1], [-4, 1, 14, -2, -4, -2], [-12, 6, 4, 1, 12, -1], [-8, -1, 6, 3, -14, 5], [-6, 3, -18, 2, 8, 0], [13, -1, -1, 0, -8, 3], [-7, 0, 17, 0, 3, -1], [18, -4, 14, 0, -6, -6], [6, 6, 12, 2, -10, -4], [-17, -1, 8, 0, -1, -3], [9, -2, 19, -5, -5, 0], [-8, -4, -8, 5, 2, 4], [5, -3, 3, -1, -11, -7], [11, -3, -9, -2, -3, 3], [9, 1, 1, -5, 11, -3], [-4, 2, 0, 0, -20, -1], [0, 2, 8, -2, -5, -6], [-26, 2, -14, -1, 4, 7], [-11, 1, -13, 4, 7, 1], [8, -2, 8, 6, -2, -2], [-20, 0, 4, -7, 6, -2], [0, -1, 6, 2, -2, -6], [5, 3, 3, 1, 13, 3], [-1, 0, 0, 3, 9, -3], [8, 4, 2, 1, 2, 6], [-19, 2, -8, -3, -5, -1], [32, -6, 11, 1, -10, -2], [15, 2, 16, 0, -25, -1], [4, 2, -12, 0, -10, -4], [9, 2, 17, 2, -21, 3], [4, -7, -8, -5, 12, -6], [-6, 7, 0, 1, 14, 6], [-28, 0, -4, -3, 6, 6], [0, -1, -12, -5, 13, -4], [6, -7, 2, 2, 15, -4], [2, -8, 4, 3, 6, 4], [-10, -8, 0, -5, 17, -6], [19, -3, 5, 1, -11, 3], [-16, -1, -23, 2, 0, 6], [-3, -1, 2, 0, 15, -1], [-21, 2, -10, -4, 5, 7], [0, 3, 2, -6, -14, 4], [2, 4, -8, 3, 4, 8], [18, -1, 10, -4, 4, -8], [9, -4, -6, -2, -7, -7], [9, 3, 24, -10, -3, -5], [-26, 9, -5, 1, 10, 6], [-38, 3, 0, -2, 20, 2], [-16, -7, -12, -1, -1, -6], [8, -2, -12, -2, -14, -4], [17, -5, -3, -3, 5, -6], [27, -2, 15, -4, -13, 1], [-5, -1, 5, -5, -1, 2], [29, -4, 27, -2, -21, -1], [-3, 2, -21, 12, 9, 5], [4, -5, 8, -3, -6, -2], [-24, 7, -14, -3, 14, 1], [15, -3, 8, 5, -23, -1], [-18, 2, -10, 1, 16, 0], [-7, 6, -15, 2, -7, 7], [3, 0, 17, -8, -11, -2], [4, -8, 6, 2, 5, -2], [-35, 8, -9, 0, 23, 5], [15, 4, 23, -6, -1, -5], [-10, -2, -18, 0, 17, 0], [-13, 3, -11, 2, -13, 3], [13, -1, 3, -5, -3, 0], [9, -4, 13, -7, -15, -7], [-1, 1, 0, 1, 5, 11], [11, 4, 9, 0, -9, 3], [-8, -1, 8, -2, 5, -6], [-27, 7, -15, -6, -1, -1], [2, -7, -4, -5, 19, -6], [-11, -3, -25, 0, 17, 1], [30, 1, -4, -3, 16, -4], [5, 5, -4, 6, 3, 7], [-14, -1, 9, 2, -6, 4], [1, 1, -17, 2, -9, -7], [-15, 3, -7, -3, -5, 1], [-15, 1, -17, -5, 9, -5], [-20, 4, 1, 2, 8, 4], [28, 4, 22, -1, -15, 2], [6, -2, -10, -5, 8, -2], [-27, 6, -31, 1, 11, 3], [3, -1, -1, 4, -19, -6], [16, 8, 14, -1, -12, 4], [-4, -6, 8, 0, -18, -2], [-6, 4, -18, 2, 10, 2], [1, -4, -19, -4, 17, 3], [23, -3, -3, 1, 13, -3], [17, -12, 13, -4, -15, -9], [-4, 1, -2, -1, 14, 4], [-6, -2, -6, -1, 25, -6], [-15, 1, 3, 8, -9, -1], [-8, 2, -3, 1, 12, 2], [-16, 7, 8, 3, 2, 2], [-10, -6, -28, 5, 15, 2], [-29, 2, -11, 2, 23, -1], [-12, 2, -22, 4, 24, 2], [31, -6, 25, -1, -5, -9], [-17, -4, -3, -2, -9, -1], [-19, -3, -15, -4, 9, 5], [8, 5, -20, 4, 14, 5], [-28, 0, -12, 5, 16, 1], [-13, -7, -9, -7, 22, -5], [0, 7, 14, 2, -4, 2], [36, 0, 30, -4, -12, 1], [-12, 2, -34, 1, 6, 3], [10, 5, 8, -4, -32, 0], [-3, -8, -16, 1, 1, 3], [20, -4, 12, -3, -12, -2], [6, -2, 20, -7, -10, -8], [-31, -3, -13, -3, 5, 1], [20, -1, -4, -6, -6, -1], [-11, -6, 8, -5, 21, -5], [3, 7, -5, -2, -3, 5], [-24, 0, -28, 2, 17, -2], [-18, -9, -4, -2, 0, -5], [3, -3, -19, -3, 9, 3], [13, -3, 21, -3, -3, -5], [2, -4, -2, -4, -14, -4], [-36, -4, -10, 6, -5, 6], [-9, 2, 1, 3, 10, -7], [-12, 0, 2, -3, 8, 2], [7, 1, 7, -5, -3, -1], [-3, 2, 11, 4, -5, -3], [14, 6, 16, -1, -16, 0], [16, -1, -14, -2, 4, -4], [-23, -3, -17, -11, 15, -5], [32, -12, 18, -2, -22, -6], [8, -1, 16, 8, 4, 0], [15, 1, -11, 5, -21, 1], [-27, 2, -15, -5, -1, 0], [18, 3, 18, 2, -28, 0], [-15, -5, 13, -7, 0, -7], [-26, 2, 14, -3, 24, 0], [29, 0, 5, 5, -7, 4], [8, 0, 26, -8, -4, -6], [22, 6, 2, 0, -22, 4], [-17, 6, 0, 2, 15, 3], [-35, -6, 6, -4, 25, -3], [14, 3, 30, -5, 0, 2], [12, -6, 32, -8, -28, -10], [-33, 5, -11, 0, 13, 1], [-24, 13, -7, 0, 28, 6], [-6, 7, -6, -4, 8, 0], [-12, 0, 4, 7, -8, 2], [39, -8, 11, 6, -19, -3], [3, -5, -13, 5, -21, -1], [-18, -3, -26, 5, -2, 0], [-16, 11, 6, 0, -10, 7], [31, 5, 15, 0, -39, 3], [-2, 12, -6, 4, -11, 8], [35, -14, 7, 0, -9, 0], [-30, 5, -22, -6, 6, 0], [17, 5, 23, -4, -10, -3], [11, -8, -17, -8, 9, -5], [-16, 8, 0, -10, 12, 0], [-20, -1, -26, -1, 36, 0], [19, 6, -25, 5, -15, 5], [-2, -9, -18, -9, 27, -10], [-19, -2, -21, 6, 14, -3], [6, 1, 6, -1, -6, -11], [-6, 3, 6, -8, 14, 0], [25, -2, -13, 8, -13, -1], [0, -6, 7, 4, 10, -4], [-10, 3, -4, -6, 0, -8], [-15, 0, -21, -1, 25, 5], [2, 0, 34, -14, -20, -10], [-16, -2, -6, 0, -23, 0], [6, 1, 0, 3, -9, -2], [10, -8, -8, 0, -11, -8], [-37, 6, 7, 3, 7, 5], [-20, 0, -12, -4, 6, 8], [-25, 9, 3, 6, 18, 3], [-36, 7, -42, 7, 38, 6], [18, -11, 3, -4, -10, -4], [16, 2, -12, 4, 2, 0], [34, -1, -5, -4, -8, 0], [36, 3, 20, -6, -22, 0], [-1, 0, -15, 4, -1, 1], [-23, -2, -9, -1, -13, -11], [15, 5, 11, -8, 3, -1], [29, 3, -5, 8, -13, -5], [10, -2, -18, 4, -6, -2], [5, 0, 25, 0, -27, 4], [-17, 2, 5, 0, 33, 0], [-2, -4, -3, 6, 6, -6], [-22, -12, 2, 2, -13, 0], [10, 2, 5, 3, 14, -4], [-13, 3, -35, 12, 25, 6], [-27, 5, -3, 4, 1, 5], [15, -1, 31, -3, 1, -6], [9, -5, 31, 4, 14, -1], [-10, -3, -2, 6, 22, 2], [-19, 4, -36, 4, 7, 9], [29, -8, 19, -9, -28, -7], [-8, 11, -4, 4, 2, 6], [5, -7, -3, -2, -18, 7], [22, -12, 20, -5, -36, -4], [40, 5, 6, 0, -6, 4], [9, -1, 3, 4, 7, 10], [-4, -2, 10, -8, 2, -2], [9, 7, -25, 7, -2, -5], [16, 6, 6, -5, 2, -2], [8, -7, 27, -3, -6, 4], [-16, 0, -44, 1, 28, 6], [-30, 0, 7, 1, -8, -4], [-35, -1, -29, -5, 46, -1], [-5, 9, 3, -7, -27, 3], [1, 4, -1, -4, 8, -1], [19, 6, 33, 1, -19, 5], [22, -10, 24, -1, -10, -8], [2, -1, -2, 5, 11, 0], [16, 0, 12, -1, 2, -4], [-13, -10, -6, 1, -3, 1], [9, 17, -7, -1, 3, 1], [1, 1, -9, -9, 25, -7], [-17, -7, -7, 6, -15, -3], [-21, 0, -7, 0, 1, 3], [-15, 6, 8, 8, -7, 1], [0, -19, 4, -1, -2, -10], [-15, -6, -35, 9, 9, 7], [18, -1, -18, -1, 24, -6], [-26, 12, -18, 5, 20, 11], [-6, 0, -44, 0, 2, 3], [36, -3, 34, -2, -14, -8], [13, 2, 0, -1, 7, -1], [-32, 11, -13, 1, 24, 0], [-3, 4, -21, -4, -3, -3], [-34, 1, -14, 0, 8, 6], [3, 10, -1, -3, 20, 3], [14, -4, -16, 6, 12, -4], [-10, 10, 6, -3, -20, 0], [20, 1, -8, 3, 16, -12], [-8, 11, 10, 1, 11, 8], [-23, -2, 4, 7, 11, 3], [24, -7, 28, -5, -18, 6], [-3, -2, -7, 1, 0, -1], [35, -4, 11, 8, -21, 3], [-31, 6, 1, -3, -7, 7], [-14, 14, -24, 2, 6, 2], [31, -17, 44, -13, -37, -17], [-21, 7, -20, -11, -3, -5], [0, -1, -12, 5, 8, 6], [-9, 7, -13, 1, -3, -9], [3, 3, 9, 2, -31, -6], [-21, 0, -9, 3, 7, 4], [-18, -4, -8, 0, 0, 8], [32, 4, 29, -5, -16, 2], [7, 0, -19, 3, -17, 3], [-24, 20, -10, 1, 25, 8], [2, 6, 11, 4, -26, 2], [-28, 12, -3, -6, 16, 0], [-42, -3, 18, -8, 14, -2], [-14, 3, -5, 10, 8, -4], [-4, 8, 20, -5, -19, -4], [-15, -11, -31, 9, 9, 5], [-23, 12, -9, 7, 7, 0], [32, 7, 0, -2, 24, -4], [28, -5, 2, -4, 7, 6], [17, 6, 1, 4, 1, -5], [14, 4, 2, -1, -20, 0], [13, -10, -23, 2, 23, 5], [-14, 12, -8, -5, 28, -2], [43, -13, 15, -4, -27, -2], [13, -4, 4, 15, -33, 3], [47, 4, 9, -5, -1, 2], [12, 10, 18, 6, -12, -6], [8, 2, 18, -5, -36, 8], [-13, -3, 7, 7, -10, 5], [28, -14, 24, -9, -28, -6], [-19, 0, -56, -1, 19, -1], [-23, -7, -45, -4, 21, -3], [36, -1, -20, 0, -27, 2], [7, 8, -13, 4, 3, -1], [17, -9, 11, 12, 7, 3], [-24, -16, 0, -1, 0, -6], [11, 4, -21, 1, 11, 13], [8, -3, 2, -13, 3, -4], [20, -5, -28, 1, 6, 0], [20, -8, 14, -3, 6, -2], [-3, -6, 16, 0, 7, -7], [34, -2, 14, -9, -13, -2], [14, -3, 40, 3, -36, 0], [-31, -2, 1, -2, 13, 8], [11, -15, 11, -1, 13, -1], [-6, -6, -18, -3, 22, 0], [-9, -2, 23, -8, 13, -9], [2, 9, -24, 3, -2, 12], [-25, 5, 11, 1, -18, 7], [15, 0, -3, 1, -2, -1], [-32, 1, -40, 5, 36, -2], [-19, 4, 21, 7, 11, 3], [16, -4, -12, -2, 12, -12], [-12, 9, -2, 2, -14, 15], [11, 10, 28, 9, -25, 5], [18, -5, -20, 5, 11, 4], [-6, 2, -17, 5, 6, 0], [29, 2, 23, 6, -13, 3], [47, -1, 15, -3, -23, 3], [-12, 7, -12, 8, 18, 2], [9, 8, -15, 4, 29, 13], [30, 4, 14, -7, -32, 2], [26, -14, -12, -2, -2, -5], [24, 3, -12, -2, -6, 10], [42, -3, 44, -1, -12, -13], [-19, -1, -7, -10, 19, -1], [-13, 5, -5, 10, -5, -1], [-13, -3, -7, -9, 13, 9], [9, -19, -1, -7, 4, -3], [35, -8, 11, 0, -3, 1], [-12, 0, -16, 8, 8, -2], [10, -15, -8, 0, 0, -8]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_3549_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_3549_2_a_y();".
// 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_3549_2_a_y(:prec:=6)
    chi := MakeCharacter_3549_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_3549_2_a_y();".
// 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_3549_2_a_y( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_3549_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<2,R![-1, -2, 1, 1]>,<5,R![-728, -252, 224, 55, -25, -3, 1]>],Snew);
    return Vf;
end function;