
// Make newform 1320.2.bw.d in Magma, downloaded from the LMFDB on 29 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_1320_bw();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_1320_bw_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_1320_2_bw_d();".
// 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_1320_2_bw_d();".
// 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 := [48605, -58005, 48735, -37160, 18896, -8123, 3863, -1281, 340, -116, 23, -3, 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], [148629889740569480, -21438013976399000, 137187804380815310, -44117521181472950, -10216214909903849, -8729904623480927, 359421482888551, 656731738766345, 228125750026430, 14014928374804, -1429663057448, -3243343421746], [145754816381803705, -130083551710049705, 119342658786784740, -50753263231590610, 25632517747205710, -16202327708776719, 4093379593644973, -1479504198038658, 566152741999402, -74483140494988, 21431890554381, -3798351690541], [162928161212412340, -68495867901181385, 134112736052186130, -85899327665546510, 23381644902942084, -20170742192165654, 7786877934603189, -1413801683664194, 866443686878156, -158166746004238, 17052179430690, -9239847942383], [184618883918745305, -74568573428027000, 55029117928465930, -21804090033718820, 21020390312872126, -5221493035058833, -1529295128216836, -772308921938048, -188064623254718, 125543945896646, 12878948387455, 10036835482758], [-252466659703437385, 262964803979142545, -146931972240281720, 106643164119889490, -39556628334842938, 16946378115143643, -8003530671695761, 1673004769335218, -577000135671742, 210681744287436, -3025721566645, 10209433762729], [449102809239525715, -373029218685513575, 381808121570854120, -209240013486766150, 88696839053722658, -51673639933035025, 15522790409259875, -4049367279589434, 1727746616746026, -205378674438272, 54349756670571, -10667364396459], [8249920794983145, -6188966060246800, 5000828761227390, -2709067184280100, 1041016092476074, -507821082061193, 191992482944764, -44640925348360, 15710845688030, -3916507590794, 284182512903, -173187173134], [2753468807734887005, -1152858558467776500, 1195898258652782910, -963508723031743800, 231021624443600606, -142302043539853397, 66075769317530816, -8777260755363320, 5724030213639390, -1232768449792866, 78640875403007, -66191816836426], [-496229528037443045, 339731545703658260, -234591950447455270, 232450586382727920, -86274296260637694, 43374602119804729, -22492664510278484, 5074753978360088, -1798202709992642, 607294180804822, -24135232255331, 27602579721542], [-1048932032756975245, 2047801702095846200, -1394713377107135040, 922198210856608750, -407330625503533864, 181718125293889133, -82688208114150534, 18868942809161610, -6362912716465280, 2043753848010484, -73424522833793, 92374526807454]];
    Rf_basisdens := [1, 1, 162630285534065525, 130104228427252420, 130104228427252420, 130104228427252420, 130104228427252420, 130104228427252420, 1812036607621900, 650521142136262100, 130104228427252420, 325260571068131050];
    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_1320_bw();"
function MakeCharacter_1320_bw()
    N := 1320;
    order := 5;
    char_gens := [991, 661, 881, 1057, 1201];
    v := [5, 5, 5, 5, 3];
    // 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_1320_bw_Hecke();"
function MakeCharacter_1320_bw_Hecke(Kf)
    N := 1320;
    order := 5;
    char_gens := [991, 661, 881, 1057, 1201];
    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], [1, 0, 0, 0, 0, 0, 0, 0, 0, 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 := true, 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+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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-1, 0, 0, 1, -1, 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, 0, -1, 0, -1, 0, 0], [0, -1, -1, 0, 0, -1, -2, 0, 0, 0, 0, 1], [-2, 1, 1, 1, -1, 0, 0, 0, 0, 0, -1, 1], [0, 0, 0, 0, 0, 1, 1, 0, 0, -1, 0, 0], [1, 1, 0, -1, -2, 0, 2, 1, 0, 0, 0, -1], [-3, 0, 1, 1, 0, -1, 1, 1, -1, -1, 0, 0], [-1, -1, -1, 0, 1, 1, 1, -2, 0, -1, 1, 0], [0, -1, 0, -2, 1, -1, 0, 0, 0, -2, -1, 1], [-1, 1, 1, 0, 4, -1, 1, -1, 0, -2, -1, 0], [3, -1, 0, -3, 2, 0, -2, -1, 0, 1, -1, 1], [3, -1, -2, -1, 0, 0, -1, 0, -1, 0, -2, 0], [3, 0, 1, -3, -2, 2, 2, 1, -2, 3, -3, -1], [-1, -1, 2, -2, -2, 3, 0, -3, -3, 0, 1, -1], [-3, -1, -1, 1, -4, -1, 2, 0, 0, 0, 1, 1], [0, -1, -1, -3, 3, 0, 3, 0, 1, 1, 1, 0], [-1, -3, -2, 2, 0, 2, -1, -2, 2, 2, 3, 3], [0, -1, -1, 5, -5, 3, 0, 0, 1, -2, 1, 0], [-2, 3, 3, -2, 3, 1, 4, -1, 0, -2, -3, -2], [2, 0, 2, -1, 3, 1, 0, -1, -1, -1, -1, 1], [2, 1, 1, -5, 3, 1, -4, 2, -3, 0, -3, -2], [3, 2, 0, -4, 0, -1, -5, 1, 2, -1, 0, 1], [1, -2, 3, -4, 2, 2, 0, -3, -3, -3, -1, 1], [1, -1, 1, 5, 0, 2, 0, 0, 0, 0, 1, -1], [-10, -1, -1, 2, -2, -3, 8, -2, 0, -3, 1, 2], [1, 1, 0, -1, 4, -1, -4, 1, 1, -3, 3, -1], [-3, -1, 0, 2, 0, 1, 1, -1, 1, 1, 2, 1], [6, 0, 1, -6, -2, 2, 2, 1, -2, 0, 0, -1], [-2, 1, 2, -1, 3, -1, 1, -3, 1, -2, 1, 2], [8, -2, 0, -7, 0, 0, -8, 0, -1, 0, 1, 1], [2, 2, 3, -1, -1, -1, 1, 1, -4, 1, -4, -2], [2, -2, -2, 3, 4, -4, -5, 0, 2, -1, 0, 3], [1, 1, 4, -5, 4, -1, -3, -2, -2, 1, -2, -1], [-3, -3, -3, 3, -4, -3, 4, -6, 3, -1, 1, 6], [-3, 2, -1, 3, -9, -1, 9, 1, 1, 1, -1, -1], [-6, 4, -2, -1, -7, -1, 0, 5, 5, 5, 1, -1], [1, 2, -2, 5, 0, -1, 0, 5, 5, 3, 1, -1], [-3, 1, 1, 3, 7, 1, -7, 2, -1, 0, 0, -2], [-5, 4, 1, 5, -10, -2, 10, 5, 2, 2, -2, -5], [-3, -2, -4, 9, -6, -4, -3, -1, 5, 3, 5, 3], [-7, 1, 1, 0, -3, -1, 7, 2, 0, 1, -1, 0], [-4, 2, 0, -2, 6, -1, 3, -2, 2, -5, 2, 4], [1, 2, -3, 1, 0, 2, -1, -2, 6, 2, 1, 2], [8, 2, 0, 7, 0, 0, 8, 0, 1, 0, -1, -1], [12, -3, 2, 0, 12, 2, 0, -2, -2, -3, 0, 0], [-7, 2, -4, 7, -4, -6, 4, -2, 6, -4, 4, 2], [0, -1, -1, 0, -4, 1, 0, 1, -1, 2, 2, 0], [-2, -1, 4, -7, -1, 3, 0, -1, -1, -2, -1, 1], [-8, 2, -2, 6, -9, -1, 0, 2, 2, 3, 1, -1], [-9, 0, -5, 9, 4, -5, -4, -5, 5, -4, 4, 5], [6, 5, 3, -3, 0, -3, -2, 3, 1, -3, -1, -1], [3, 0, -2, -12, 0, 1, 0, -1, -1, 3, 3, -3], [-1, -9, -9, 5, 6, -1, -4, -7, 1, -3, 8, 5], [-2, 8, 3, 4, 0, -3, 7, 3, 2, -3, -3, -3], [-3, -2, -3, 10, -7, 0, -5, -2, 5, -1, 5, 3], [0, -3, -3, 2, 10, -1, -2, 1, 5, 2, -2, 2], [0, 0, 1, 4, -1, 2, 0, 4, 4, 1, 1, -1], [0, -2, -2, 2, -2, -1, -9, 0, 2, 3, 2, 0], [-10, 5, 1, 10, -8, 0, 8, 6, 0, 5, -5, -6], [2, 5, 5, -6, -5, 7, 4, 4, 0, 5, -5, -6], [4, -4, 1, 5, 0, 1, 2, -1, 0, 1, 5, 3], [6, -5, 0, -6, 1, -1, -1, -5, 1, -4, 4, 5], [3, 1, -1, -4, 1, -1, 5, 5, -4, 3, -4, -3], [7, 2, 0, -1, 8, -1, 0, 1, 1, 1, -1, 1], [-5, 1, 0, 3, 0, 1, 2, -1, 3, 1, 2, 1], [-9, 5, 5, -3, -14, 1, 12, -1, -3, -3, -2, -3], [0, -2, -5, -5, 5, -2, -18, 3, 2, 4, 2, 0], [2, -4, -3, -2, 10, -2, -10, -7, 2, -8, 8, 7], [3, -7, -3, -16, 0, 3, -21, -3, 1, 3, 5, 5], [-5, 6, 6, -1, -4, -4, 6, 4, -2, -1, -4, -1], [3, -4, -4, 1, 10, 2, -4, 2, 4, 5, 0, 1], [-2, 0, 0, 2, 0, 0, 9, 0, -7, 0, -7, -7], [-2, -1, -6, -1, 3, -3, -18, 3, 3, 2, 3, 2], [-3, 1, 0, 4, -2, -1, 0, 3, 3, 0, -1, 1], [-3, 2, 2, 1, 1, -4, 2, 2, 3, -1, -5, 1], [20, -5, -2, -6, 0, -1, -6, 1, -6, -1, -3, 0], [-5, -7, -6, 10, -5, 2, -1, -6, 12, 0, 12, 5], [-3, -2, -2, -3, -4, -1, 0, -1, -1, -1, 1, -1], [5, 5, 2, 5, 0, -3, 8, 3, -1, -3, -4, -3], [-14, -1, 0, 14, -13, 1, 13, -1, -1, 2, -2, 1], [6, 0, 4, 7, 9, 1, 0, -5, -5, -3, -3, 3], [-1, 3, 3, -2, 2, 1, 3, 4, 3, 3, -6, -2], [9, 3, 0, -6, 0, 4, -7, -4, 8, 4, 5, 1], [10, 4, 0, -10, 5, 5, -5, 4, -5, 3, -3, -4], [3, -3, -6, -4, 2, -5, 0, 2, 2, -2, 1, -1], [-2, 1, -1, -7, 9, -3, -8, 0, 1, 0, 1, 2], [3, -5, -3, -1, 0, 6, -3, -6, 3, 6, 5, 2], [0, 0, 4, -7, 0, -2, -5, 2, -4, -2, 0, -2], [3, -1, 0, 5, -8, -1, -19, 2, -2, 5, -2, -3], [1, -2, -4, -13, 12, 1, -2, 3, 1, 2, 1, -1], [-12, 0, -2, 12, -7, -5, 7, -2, 5, -3, 3, 2], [0, 2, 2, -5, -2, 8, 5, 0, 1, 3, -3, -5], [-2, 1, 1, -1, 5, 1, 3, 1, -2, 1, 1, -1], [-7, -1, 3, 7, 5, 5, -5, 2, -5, 5, -5, -2], [-2, 1, -3, 2, -17, -1, 17, -2, 1, 0, 0, 2], [5, 5, 5, -1, 7, -3, -4, 4, -2, 0, -3, -1], [2, 1, 1, -7, 5, 2, -15, 2, -3, -1, -3, -2], [0, 0, -4, 16, -5, 1, 0, 2, 2, 5, 5, -5], [-7, 1, 5, 7, -10, 1, 10, 6, -1, 3, -3, -6], [-18, 0, 0, 4, -10, -8, 14, 1, -1, -3, 1, 4], [13, -2, 11, -14, 12, 12, 0, -7, -7, -1, 1, -1], [-17, 8, -3, 17, -22, -6, 22, 5, 6, 0, 0, -5], [4, 3, 3, -6, 0, -1, -2, 1, -2, -1, -2, -4], [-3, -4, -8, 7, -4, 3, -8, 1, 7, -2, 7, 3], [5, 10, 10, -7, -14, 4, 2, 2, -6, -1, -4, -7], [11, -5, 1, 1, 0, -2, 3, 2, -9, -2, -3, -2], [-1, -1, 3, 12, -11, 4, 2, -5, 2, -4, 2, 1], [-9, 1, 1, 1, 7, -3, 8, 4, -1, 2, 0, 1], [15, 3, -1, -11, 14, 0, 0, 2, 2, 4, 1, -1], [1, 0, -2, -1, 0, -3, 0, -2, 3, -4, 4, 2], [13, -3, -5, -9, 0, -1, -17, 1, 4, -1, 2, 8], [-17, 1, 5, 17, -21, 3, 21, 6, -3, 5, -5, -6], [-12, 1, 1, 2, 2, -5, 10, -7, -5, -10, 4, 2], [1, 2, -5, -1, -17, -3, 17, -3, 3, 0, 0, 3], [1, -9, -11, -14, 13, 2, -28, 3, 8, 8, 8, -1], [0, 3, 2, -5, 2, 0, 0, -1, -1, 1, -2, 2], [1, 0, 0, -2, -4, 4, 1, -4, -5, -2, 5, -2], [-16, 11, 1, 13, 0, -5, 12, 5, 7, -5, -3, 1], [10, -4, -4, -13, 0, -1, -22, 1, 4, -1, 4, 9], [-4, -1, 0, 5, -2, -2, 0, -1, -1, -3, -2, 2], [3, 2, 5, -10, 7, 7, -2, 0, -5, -6, -5, -3], [-1, -3, -3, -3, 0, 2, -5, -2, 1, 2, 1, 2], [-18, -3, 3, 10, -13, -2, 0, -4, -4, -8, -5, 5], [6, -1, -3, -6, 2, -6, -2, -4, 6, 1, -1, 4], [5, 3, 3, -6, 1, 1, -15, 5, -8, 1, -8, -5], [3, 2, 2, 4, -1, -10, -7, -1, 1, -7, -3, 4], [10, 5, 1, 6, 0, -4, 4, 4, 3, -4, -1, 2], [-7, -7, -7, 2, -27, 3, 5, -6, 6, -1, 1, 2], [9, -5, -6, -2, 10, -7, 0, -1, -1, -6, -1, 1], [0, -1, 3, -18, 18, -2, -3, -4, 1, 3, 1, 0], [-4, 1, -3, 4, -12, 0, 12, -2, 0, 3, -3, 2], [-1, -6, 0, -23, -6, 5, 0, -3, -3, -1, 5, -5], [-10, -1, 4, 12, -13, 7, 0, 4, 4, 2, 3, -3], [-1, 1, -1, -4, 0, -2, -4, 2, -1, -2, -3, 0], [14, -11, 4, -14, 5, 6, -5, -7, -6, -4, 4, 7], [-1, -2, -6, 7, -6, -4, -23, 3, 3, 5, 3, 1], [4, -9, 3, -6, 2, 9, -7, -8, 5, 4, 5, -4], [-4, -3, -5, 16, -12, 4, -8, -2, 7, -5, 7, 4], [-3, -1, -3, 3, -19, 3, 19, -4, -3, -4, 4, 4], [-16, 7, 7, -7, -1, 7, 23, -6, -6, -6, -1, -7], [-11, 4, -2, 14, -10, -3, 0, 2, 2, 3, -1, 1], [0, 1, 0, 7, 2, -2, 0, 3, 3, -1, -2, 2], [15, 7, 7, -4, 14, 1, -11, 8, -3, 5, -4, -4], [5, 9, -5, -5, -1, -4, 1, 4, 4, 4, -4, -4], [-6, 0, -1, 4, 2, -3, 25, -5, 6, -3, 6, 6], [-16, 2, 3, 8, 0, -4, 14, 4, -8, -4, -7, -6], [2, -1, -2, 3, 0, 2, -2, -2, 6, 2, 5, 5], [-3, 1, 4, 6, -3, 3, 10, -6, 2, -7, 2, 3], [19, 5, -2, -19, 11, 7, -11, 3, -7, 7, -7, -3], [-5, -8, -4, 5, 0, -1, 3, 1, -7, -1, -3, 2], [26, 6, 6, -26, 9, 5, -9, 12, -5, 7, -7, -12], [-19, 5, 5, -1, -4, -3, 20, 2, -3, -2, -2, -1], [2, 6, 8, -14, 12, 1, -19, 0, -8, -5, -8, -2], [-7, -3, 3, -15, -7, 3, 0, -2, -2, -3, 0, 0], [5, 0, 6, -23, 18, 7, -22, -1, -5, -2, -5, -5], [-2, 11, 9, -2, 4, -6, 13, 0, -9, -7, -9, 2], [7, 9, -5, 7, 6, -4, 0, 4, 4, 10, 1, -1], [-6, -2, -2, 4, 2, -1, -13, -6, 8, -3, 8, 6], [3, 7, 4, 9, 0, -2, 17, 2, -3, -2, -6, -8], [0, 1, 1, -1, -7, 1, 1, 6, -2, 6, 1, -1], [14, 12, 7, 5, 0, -5, 9, 5, 3, -5, -2, -4], [-2, 1, 3, 2, -10, 7, 10, 4, -7, -1, 1, -4], [24, 5, 2, -21, 29, -3, 0, 3, 3, 0, -5, 5], [0, -6, -6, 4, -22, -2, -4, -9, 2, -7, 4, 4], [-20, -6, -4, 1, 0, 2, 0, -2, -3, 2, -1, 1], [6, -4, -4, 2, -30, 0, -8, 0, 4, 2, 0, 2], [-2, 0, -5, 2, 11, -2, -11, -5, 2, 2, -2, 5], [2, -8, -5, -10, 0, 4, -14, -4, 0, 4, 3, 4], [-19, 1, 1, 4, -18, -9, 15, -5, 2, -10, -3, 4], [-15, 4, -5, 22, -20, 0, 0, 7, 7, 9, 5, -5], [18, 6, 1, -18, 7, -1, -7, 7, 1, -1, 1, -7], [-7, -11, -5, 15, 0, 12, 7, -12, 9, 12, 15, 8], [2, -1, -4, 0, -2, -3, -26, 5, -1, 6, -1, -2], [15, -2, -2, 6, 13, -10, -21, 6, 4, 2, -2, 6], [-9, 5, 3, 3, 6, -2, 1, -7, 4, -12, 4, 9], [11, 3, 11, -10, -1, 6, 2, 3, -14, 2, -14, -11], [21, -9, -9, 8, 5, -7, -29, 5, 10, 6, -1, 8], [-6, 9, -8, 18, -8, -6, 0, 10, 10, 11, 2, -2], [-10, -7, -4, 8, -12, -2, 0, -4, -4, -5, 2, -2], [4, -1, -1, 12, 3, 0, 0, -3, -3, 0, 1, -1], [-20, -3, -3, 3, -11, -3, 17, 4, 4, 4, -1, 3], [-9, -1, -3, 9, 11, -4, -11, -4, 4, -2, 2, 4], [37, -6, 0, -37, 19, -7, -19, -6, 7, -2, 2, 6], [10, 1, -4, 16, 10, -4, 0, 2, 2, 1, 0, 0], [3, 2, 1, -10, 7, -5, 22, 4, -5, 6, -5, -3], [5, -15, -2, -26, 0, 6, -31, -6, -4, 6, 9, 5], [2, 8, 8, -10, 8, 12, 8, 8, -2, 10, -6, -10], [-22, -1, -1, 1, -1, -1, 21, 0, -4, 0, 5, 1], [2, -1, 8, 8, 3, 7, 0, 2, 2, -2, -1, 1], [9, -7, 4, -9, 29, 6, -29, -3, -6, 2, -2, 3], [9, -5, -2, 8, -17, 8, -1, 6, -4, 6, -4, -9], [-17, 1, 1, -2, 10, 3, 19, -2, -1, -1, 0, -2], [7, 5, -2, 10, 0, -5, 3, 5, 7, -5, 0, 7], [3, -10, -3, 0, -3, 6, 9, -4, 7, 7, 7, -3], [-14, 6, 1, 9, -12, -1, 0, 10, 10, 4, -2, 2], [23, 1, -2, -23, 38, -5, -38, -1, 5, -3, 3, 1], [-13, -2, -2, -5, -11, 12, 18, 0, 1, 7, 1, -5], [-7, -4, -2, 30, -7, -2, 0, 5, 5, -4, 0, 0], [1, 4, 4, -1, 5, -4, -5, 8, 4, 5, -5, -8], [-18, 6, -3, 26, 0, -6, 24, 6, 2, -6, -7, 2], [5, 4, 14, -20, 15, 10, -10, -5, -9, -9, -9, -5], [7, 2, 10, -19, 12, 8, 13, -1, -9, -3, -9, -7], [-11, 0, -15, 28, -17, -11, 10, 4, 11, 0, 11, 11], [-4, 16, 11, -7, 0, -1, 3, 1, 5, -1, 0, -10], [-2, -7, -4, 2, -6, 6, 6, -11, -6, -7, 7, 11], [8, -16, -16, 7, 15, 2, -15, -7, 7, 2, 9, 7], [-21, -1, -10, 8, -22, -9, 0, 3, 3, 0, 1, -1], [-3, 8, 8, 3, 17, -14, 0, 2, -1, -9, -7, 3], [-44, 10, 2, 11, 0, -2, 8, 2, 11, -2, 3, 3], [7, 4, 5, -7, -3, -2, 3, 9, 2, 9, -9, -9], [5, -4, -6, -12, 7, -3, -6, 7, -1, 12, -1, -5], [-7, -1, 1, 16, -15, 9, 0, 5, 5, 7, 8, -8], [12, -6, 3, 1, 0, 0, 0, 0, -5, 0, 4, 1], [-8, 2, -1, -8, 0, 6, -3, -6, 3, 6, 0, -5], [14, 15, 15, -7, 16, -1, -7, 6, -9, -2, -6, -7], [3, 5, -5, -3, -15, -3, 15, 0, 3, -7, 7, 0], [0, 10, 9, 0, -19, 5, 19, 19, -5, 11, -11, -19], [4, -5, 6, 28, 3, 7, 0, -10, -10, -4, 1, -1], [6, 6, 5, -9, 3, 0, 0, 7, -12, 0, -12, -6], [13, -3, 11, -20, 6, 18, 0, -5, -5, 4, 7, -7], [-1, 8, 7, -15, 0, -4, -11, 4, 0, -4, -1, -4], [7, 1, 1, -5, -45, 9, -2, 0, -2, 4, 1, -5], [-4, -12, 2, 4, -3, 1, 3, -10, -1, -5, 5, 10], [12, 2, -6, -14, 0, -1, -12, 1, -1, -1, -9, -2], [34, 1, 3, -34, 8, 4, -8, 4, -4, 9, -9, -4], [8, -4, 2, 8, 9, 1, 0, 2, 2, -5, -1, 1], [-5, -6, -19, 15, -10, -6, -20, 8, 11, 7, 11, 5], [-15, -6, 2, -21, 0, -2, -21, 2, -8, -2, 0, 0], [12, -10, -4, -17, 0, 9, -25, -9, 7, 9, 13, 8], [-7, 1, 1, 1, 17, -3, 6, 0, 4, -2, -5, 1], [-25, 6, -2, 25, -7, -6, 7, 4, 6, 5, -5, -4], [-27, -4, -4, 9, 12, -14, 18, -7, -2, -12, 6, 9], [0, -3, 8, 29, -2, 10, 0, 1, 1, -1, 2, -2], [0, -2, -8, -19, 1, -9, 0, 1, 1, -3, -1, 1], [-13, 6, 6, 1, 6, -8, 12, -15, -5, -22, -1, 1], [25, 6, -5, -25, 35, -5, -35, 1, 5, 6, -6, -1], [-15, -8, -1, 15, 4, -5, -4, -9, 5, -2, 2, 9], [37, -1, -1, -6, -6, 13, -31, 4, -5, 11, 6, -6], [0, -3, 3, -7, 7, 2, 7, -6, 3, 1, 3, 0], [22, 2, 1, -23, 21, 2, 0, -1, -1, 3, 1, -1], [-2, -4, 0, 2, 9, 2, -9, -4, -2, -11, 11, 4], [-13, 9, 1, 3, -15, 3, 0, 14, 14, 11, 2, -2], [-21, -13, 3, 19, -25, 7, 0, -6, -6, -9, 4, -4], [5, 4, 4, -5, 5, 6, -5, 8, -6, -3, 3, -8], [-6, 3, 6, 1, 5, -1, -7, -9, 3, -8, 3, 6], [31, -6, 5, -33, 33, 3, 0, -8, -8, -8, -2, 2], [2, 1, 8, 8, -10, 3, 16, -5, -3, -2, -3, -2], [6, -3, -1, 14, 0, 1, 6, -1, 6, 1, 8, 8], [-4, -9, 7, 15, -5, 8, 0, -1, -1, -8, 1, -1], [12, 3, 8, -29, 17, 8, -12, 7, -15, 1, -15, -12], [29, -17, -9, -2, 0, 5, -4, -5, -10, 5, -2, 2], [41, 1, 6, -41, 14, 8, -14, 7, -8, 13, -13, -7], [-5, -1, -1, -5, -6, 11, 10, 12, -2, 18, 3, -5], [-19, 3, 2, 29, -9, -8, 0, -1, -1, -7, -10, 10], [15, -3, -3, -7, 8, 17, -8, 5, -5, 15, 8, -7], [23, -5, -7, -12, 0, 6, -13, -6, 2, 6, 0, 1], [18, -10, -3, -2, 13, 2, 0, -7, -7, -5, 5, -5], [15, -4, -4, -3, -1, 10, -12, -4, 5, 3, -1, -3], [-2, 7, -8, -11, -3, -7, 0, 13, 13, 8, 1, -1], [8, 4, 6, -20, 12, 3, -17, 6, -12, 1, -12, -8], [43, -1, -1, -43, 30, -5, -30, -2, 5, 7, -7, 2], [1, 10, 7, 25, 0, -3, 29, 3, 3, -3, 0, -4], [13, -3, 0, -13, -21, 4, 21, -3, -4, -2, 2, 3], [2, 5, 9, -16, 14, -6, 2, -2, -7, 3, -7, -2], [-10, 12, 12, -12, -12, 12, 22, -4, -12, -4, 0, -12], [-8, 0, -9, 6, 2, 0, 9, 1, 8, -8, 8, 8], [30, -4, -4, 6, 11, -8, -36, 12, 5, 10, -1, 6], [-9, -5, -7, 21, -12, 3, -2, -7, 14, -7, 14, 9], [-10, -2, -3, 10, 9, 1, -9, -5, -1, -3, 3, 5], [17, -12, 3, -21, 24, -4, 0, -18, -18, -19, -7, 7], [1, 2, 2, 6, 0, -14, -7, 1, 2, -7, -4, 6], [41, -9, -2, -28, 0, 4, -23, -4, -10, 4, -3, -5], [3, -10, -9, 14, -17, 6, 51, 2, 7, 7, 7, -3], [-9, 17, 14, -15, 0, -9, -2, 9, -5, -9, -8, -13], [3, 6, 15, -16, 13, 5, 6, -6, -9, -8, -9, -3], [20, -3, -3, 5, -5, -7, -25, 4, 4, 2, -1, 5], [19, 5, 5, -19, -18, 8, 18, 10, -8, 8, -8, -10], [-5, 3, 3, 2, 33, -7, 3, 2, -2, -3, -1, 2], [19, -16, 4, -19, 34, 2, -34, -12, -2, -10, 10, 12], [-2, 0, -2, 36, -34, 4, 16, 0, 2, -6, 2, 2], [18, -12, -4, -22, 0, 3, -33, -3, 2, 3, 10, 11], [5, -10, 1, -4, 14, -8, 0, -17, -17, -19, -9, 9], [-7, -5, 7, 7, -31, 8, 31, 2, -8, 4, -4, -2], [-21, 15, 3, 3, 0, -8, 3, 8, 7, -8, -5, 0], [12, -4, 1, -12, 17, -1, -17, -3, 1, 7, -7, 3], [5, -6, -6, 8, -19, -10, -13, 0, 6, -2, 0, 8], [25, 0, 7, -39, 25, 7, 0, -2, -2, 0, 0, 0], [7, -8, 9, -7, -3, 17, 3, 1, -17, 3, -3, -1], [4, 1, 0, 18, -2, 6, 0, 2, 2, 7, 6, -6], [5, -9, -9, 8, -3, -7, -13, 0, 10, 1, -1, 8], [9, -5, -12, 6, 0, -2, -15, 2, 14, -2, 7, 21], [8, -13, -7, -20, 12, 4, -33, 2, 5, 17, 5, -8], [-8, -5, 0, 8, -3, -10, 3, -5, 10, -12, 12, 5], [25, -8, -1, 12, 22, 2, 0, -5, -5, -5, 3, -3], [-5, 2, 2, -4, 17, 6, 9, 1, 7, 3, -9, -4], [-28, -5, -5, 4, -24, -3, 24, -2, -1, -1, 6, 4], [26, 0, 2, -24, 0, -3, -15, 3, -12, -3, -10, -9], [-2, 3, 3, 7, 26, -17, -5, 0, 1, -10, -4, 7], [-2, -8, 8, -18, 3, 3, 0, -14, -14, -13, -5, 5], [-10, 12, 10, 25, -15, -9, 11, -8, -2, -13, -2, 10], [16, -16, 4, -16, 20, 10, -20, -12, -10, -6, 6, 12]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_1320_bw_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_1320_2_bw_d();".
// 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_1320_2_bw_d(:prec:=12)
    chi := MakeCharacter_1320_bw();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 2));
    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_1320_2_bw_d();".
// 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_1320_2_bw_d( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_1320_bw();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<7,R![121, -1870, 11213, -3558, 7029, 1312, 1251, 214, 292, -46, 16, -4, 1]>],Snew);
    return Vf;
end function;