
// Make newform 1764.3.z.n in Magma, downloaded from the LMFDB on 25 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_1764_z();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_1764_z_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_1764_3_z_n();".
// 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_1764_3_z_n();".
// 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, 0, -12, 0, 114, 0, -336, 0, 755, 0, -336, 0, 114, 0, -12, 0, 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, 0, 0, 0], [-481239, 0, 4563258, 0, -62719633, 0, 29348105, 0, -10999257, 0, 1132373, 0, -96474, 0, -473, 0], [21780, 0, -955212, 0, 2379102, 0, -6333624, 0, 2836231, 0, -984456, 0, 103818, 0, -8724, 0], [0, 24592, 0, -234744, 0, -5856677, 0, -1669588, 0, 1014272, 0, -686249, 0, 75216, 0, -7388], [0, -3968033, 0, -156013, 0, 1479396, 0, -20532779, 0, 9517884, 0, -3575207, 0, 379529, 0, -32730], [3033171, 0, 599742, 0, -5687064, 0, 78586038, 0, -36588456, 0, 13743738, 0, -1459483, 0, 125820, 0], [2310, 0, 1001, 0, -9492, 0, 131117, 0, -61068, 0, 22939, 0, -2436, 0, 210, 0], [0, 92422, 0, -163735, 0, 1552620, 0, -21394552, 0, 9988980, 0, -3752165, 0, 398539, 0, -34350], [2454270, 0, -23312730, 0, 85598856, 0, -154104811, 0, 67895142, 0, -22169357, 0, 2326128, 0, -191009, 0], [0, -4213215, 0, -890461, 0, 8443812, 0, -116648235, 0, 54324348, 0, -20405879, 0, 2166991, 0, -186810], [-206391, 0, 1306877, 0, -12392484, 0, 170614699, 0, -79728636, 0, 29948503, 0, -3181229, 0, 274170, 0], [4215021, 0, -40041792, 0, 123410351, 0, -265095942, 0, 117756687, 0, -39675882, 0, 4174002, 0, -346926, 0], [0, -28950, 0, 1198319, 0, -3162305, 0, 8418660, 0, -3771965, 0, 1308540, 0, -137995, 0, 11593], [0, 98490, 0, -3342383, 0, 10758391, 0, -28640892, 0, 12864843, 0, -4451748, 0, 469469, 0, -39393], [0, -52231323, 0, -16448003, 0, 155968476, 0, -2153783649, 0, 1003443204, 0, -376923817, 0, 40028431, 0, -3450630], [0, 495319, 0, -4705218, 0, 15713328, 0, -31129685, 0, 13778057, 0, -4579212, 0, 481194, 0, -39787]];
    Rf_basisdens := [1, 157522, 78761, 78761, 315044, 157522, 226, 78761, 157522, 315044, 157522, 157522, 7684, 18532, 315044, 1921];
    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_1764_z();"
function MakeCharacter_1764_z()
    N := 1764;
    order := 6;
    char_gens := [883, 785, 1081];
    v := [6, 6, 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_1764_z_Hecke();"
function MakeCharacter_1764_z_Hecke(Kf)
    N := 1764;
    order := 6;
    char_gens := [883, 785, 1081];
    char_values := [[1, 0, 0, 0, 0, 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], [0, 0, -1, 0, 0, 0, 0, 0, 0, 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 := 3;
    raw_aps := [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [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, 0, 0, 1, 0, 0], [0, 0, 0, 0, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, -2, 0, 0, 0, 2, 0, 0], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -5, 0, -4, 0, 0, 0, 0, 0, 0], [0, 0, 16, 0, 0, 0, -3, 0, 3, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 1, 1], [22, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, -1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0], [0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 12, 0, 0, 0, 0, 0, -13, 0, 0, 0, 13, 0, 0], [32, 0, 32, 0, 0, 0, 0, 0, -6, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -22, 0, -21, 0, 0, 0, 0, 0, 0], [0, 0, 54, 0, 0, 0, -8, 0, 8, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, -2, 0, -2, -2], [0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 2], [0, 0, 0, -2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 27, 0, 0], [0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3, 0], [0, 0, 0, 13, 0, 0, 0, 0, 0, -40, 0, 0, 0, 40, 0, 0], [0, -5, 0, 0, 0, -3, 0, 0, 0, 0, -5, 3, 0, 0, 0, 0], [10, 0, 10, 0, 0, 0, 0, 0, -11, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, -10, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0], [76, 0, 0, 0, 0, 0, -10, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -6, 0, 0, 0, 0, 0, 0, 0, -6, 0, 0, 2], [0, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3, 0, 0, 0, 0], [0, 0, 0, 12, 0, 0, 0, -12, 0, 0, 0, 0, 0, 54, 0, 0], [0, -2, 0, 0, 0, 4, 0, 0, 0, 0, -2, -4, 0, 0, 0, 0], [106, 0, 106, 0, 0, 0, 0, 0, -14, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -39, 0, -61, 0, 0, 0, 0, 0, 0], [0, 0, 144, 0, 0, 0, -10, 0, 10, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -20, 0, 1, 1], [0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, -4], [0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, -7, 0, 0, 0, 0], [0, 0, 0, -21, 0, 0, 0, 21, 0, 0, 0, 0, 0, 41, 0, 0], [0, 8, 0, 0, 0, -13, 0, 0, 0, 0, 8, 13, 0, 0, 0, 0], [10, 0, 10, 0, 0, 0, 0, 0, -4, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 12, 0, 0, 0, 0, -5, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -46, 0, 2, 0, 0, 0, 0, 0, 0], [40, 0, 0, 0, 0, 0, -20, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 26, 0, 0, 0, -26, 0, 0, 0, 0, 0, 48, 0, 0], [0, 0, 0, 0, -21, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0], [0, 0, 0, 49, 0, 0, 0, 0, 0, -23, 0, 0, 0, 23, 0, 0], [0, 5, 0, 0, 0, 23, 0, 0, 0, 0, 5, -23, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, -5, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -23, 0, -55, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 24, 0, 5, 5], [0, 0, 0, 0, -21, 0, 0, 0, 0, 0, 0, 0, -21, 0, 0, 1], [0, -14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, 0, 0, 0], [0, 0, 0, 0, -56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, -37, 0, 0, 0, 0, 0, -34, 0, 0, 0, 34, 0, 0], [-80, 0, -80, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, -13, 0, 0, 0, 0, -3, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 20, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -3, 0, 0, 0, 0, 0, 0, 0, 23, 0, -3, -3], [0, 0, 0, -19, 0, 0, 0, 19, 0, 0, 0, 0, 0, 84, 0, 0], [0, 0, 0, 0, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, -5, 0], [0, 0, 0, 50, 0, 0, 0, 0, 0, 57, 0, 0, 0, -57, 0, 0], [0, 3, 0, 0, 0, -16, 0, 0, 0, 0, 3, 16, 0, 0, 0, 0], [0, 0, 44, 0, 0, 0, 28, 0, -28, 0, 0, 0, 0, 0, 0, 0], [64, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, -25, 0, 0, 0, 0], [0, 0, 0, -25, 0, 0, 0, 25, 0, 0, 0, 0, 0, -93, 0, 0], [0, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, -9, 0, 0, 0, 3, 0, 0, 0, 0, -9, -3, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 56, 0, 74, 0, 0, 0, 0, 0, 0], [0, 0, -268, 0, 0, 0, -14, 0, 14, 0, 0, 0, 0, 0, 0, 0], [-356, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, -4], [0, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, -21, 0, 0, 0, 0], [0, 0, 0, 18, 0, 0, 0, 0, 0, 161, 0, 0, 0, -161, 0, 0], [0, -15, 0, 0, 0, -37, 0, 0, 0, 0, -15, 37, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 94, 0, -57, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 98, 0, 1, 1], [-92, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, -10, 0, 0, 0, 0, 0, 0, 0, 0, 0, -37, 0, 0, 0, 0], [0, 0, 0, -121, 0, 0, 0, 121, 0, 0, 0, 0, 0, -119, 0, 0], [0, 0, 0, -118, 0, 0, 0, 0, 0, -46, 0, 0, 0, 46, 0, 0], [0, -8, 0, 0, 0, 37, 0, 0, 0, 0, -8, -37, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0], [0, 0, -376, 0, 0, 0, 18, 0, -18, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -79, 0, 0, 0], [-204, 0, 0, 0, 0, 0, -28, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 62, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 11], [0, 0, 0, 0, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, -9, 0], [66, 0, 66, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 23, 0, 0, 0, 0, -15, 0, 0, 0, 0, 0], [0, 0, -222, 0, 0, 0, 64, 0, -64, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -4, 0, 0, 0, 0, 0, 0, 0, 46, 0, -4, -4], [0, 0, 0, 0, -49, 0, 0, 0, 0, 0, 0, 0, -49, 0, 0, 1], [0, 0, 0, 0, -66, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0], [0, 0, 0, -114, 0, 0, 0, 0, 0, 206, 0, 0, 0, -206, 0, 0], [0, 0, 26, 0, 0, 0, 38, 0, -38, 0, 0, 0, 0, 0, 0, 0], [-530, 0, 0, 0, 0, 0, -12, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 0, 0, 0, 0], [0, 0, 0, 0, -151, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 15, 0, 0, 0, 7, 0, 0, 0, 0, 15, -7, 0, 0, 0, 0], [214, 0, 214, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 45, 0, 111, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 54, 0, 13, 13], [0, 0, 0, 0, -59, 0, 0, 0, 0, 0, 0, 0, -59, 0, 0, -6], [0, -20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0], [0, 0, 0, -12, 0, 0, 0, 12, 0, 0, 0, 0, 0, -189, 0, 0], [0, 0, 0, -166, 0, 0, 0, 0, 0, -150, 0, 0, 0, 150, 0, 0], [-666, 0, -666, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 35, 0, 0, 0, 0, -9, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 56, 0, 206, 0, 0, 0, 0, 0, 0], [-712, 0, 0, 0, 0, 0, -24, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, -23, 0, 0, 0, 0], [0, 0, 0, 47, 0, 0, 0, -47, 0, 0, 0, 0, 0, -126, 0, 0], [0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, -7, 0], [0, 13, 0, 0, 0, 45, 0, 0, 0, 0, 13, -45, 0, 0, 0, 0], [0, 0, 0, 0, 0, 29, 0, 0, 0, 0, -18, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 133, 0, -73, 0, 0, 0, 0, 0, 0], [134, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 85, 0, 0, 0, 0, 0, 0, 0, 85, 0, 0, -2], [0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, -57, 0, 0, 0, 0], [0, 0, 0, -172, 0, 0, 0, 0, 0, -24, 0, 0, 0, 24, 0, 0], [0, 0, 0, 0, 0, -23, 0, 0, 0, 0, -21, 0, 0, 0, 0, 0], [0, 0, -298, 0, 0, 0, 5, 0, -5, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 108, 0, 0, 0, 0, 0, 0, 0, 108, 0, 0, -10], [0, 0, 0, 173, 0, 0, 0, -173, 0, 0, 0, 0, 0, -28, 0, 0], [0, 0, 0, 149, 0, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0], [-388, 0, -388, 0, 0, 0, 0, 0, -96, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, -13, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0], [0, 0, -656, 0, 0, 0, 34, 0, -34, 0, 0, 0, 0, 0, 0, 0], [-2, 0, 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 137, 0, 0, 0, 0, 0, 0, 0, 137, 0, 0, 2], [0, 0, 0, 79, 0, 0, 0, -79, 0, 0, 0, 0, 0, -145, 0, 0], [0, 0, 0, 0, 107, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4, 0], [0, 0, 0, 0, 0, 0, 0, 46, 0, 138, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -3, 0, 0, 0, 0, 0, 0, 0, 87, 0, -3, -3], [0, -30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0], [0, 0, 0, -178, 0, 0, 0, 178, 0, 0, 0, 0, 0, 380, 0, 0], [0, -37, 0, 0, 0, 48, 0, 0, 0, 0, -37, -48, 0, 0, 0, 0], [426, 0, 426, 0, 0, 0, 0, 0, 94, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, -29, 0, 0, 0, 0, 27, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -130, 0, 27, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -15, 0, 0, 0, 0, 0, 0, 0, -8, 0, -15, -15], [0, 0, 0, -67, 0, 0, 0, 67, 0, 0, 0, 0, 0, -185, 0, 0], [0, 0, 0, 0, -159, 0, 0, 0, 0, 0, 0, 0, 0, 0, -14, 0], [0, 0, 0, -69, 0, 0, 0, 0, 0, -102, 0, 0, 0, 102, 0, 0], [0, -19, 0, 0, 0, -73, 0, 0, 0, 0, -19, 73, 0, 0, 0, 0], [0, 0, -178, 0, 0, 0, -83, 0, 83, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -14, 0, 0, 0, 0, 0, 0, 0, 89, 0, -14, -14], [-258, 0, 0, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -122, 0, 0, 0, 0, 0, 0, 0, -122, 0, 0, 9], [486, 0, 486, 0, 0, 0, 0, 0, -78, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 39, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0], [0, 0, 282, 0, 0, 0, -6, 0, 6, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 173, 0, 0, 0, 0, 0, 0, 0, 173, 0, 0, 14], [0, 0, 0, -196, 0, 0, 0, 196, 0, 0, 0, 0, 0, 223, 0, 0], [0, 0, 0, 0, 182, 0, 0, 0, 0, 0, 0, 0, 0, 0, -7, 0], [0, -31, 0, 0, 0, 29, 0, 0, 0, 0, -31, -29, 0, 0, 0, 0], [0, 0, 0, 0, 0, 2, 0, 0, 0, 0, -38, 0, 0, 0, 0, 0], [300, 0, 0, 0, 0, 0, -144, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 182, 0, 0, 0, 0, 0, 0, 0, 182, 0, 0, -6], [0, -27, 0, 0, 0, 0, 0, 0, 0, 0, 0, -77, 0, 0, 0, 0], [0, 0, 0, 0, -162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0], [738, 0, 738, 0, 0, 0, 0, 0, -92, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -67, 0, -93, 0, 0, 0, 0, 0, 0], [384, 0, 0, 0, 0, 0, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 203, 0, 0, 0, 0, 0, 0, 0, 203, 0, 0, 17], [0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, -69, 0, 0, 0, 0], [0, 0, 0, 214, 0, 0, 0, -214, 0, 0, 0, 0, 0, 191, 0, 0], [0, 28, 0, 0, 0, 83, 0, 0, 0, 0, 28, -83, 0, 0, 0, 0], [-486, 0, -486, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 74, 0, -342, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, -165, 0, 19, 19], [510, 0, 0, 0, 0, 0, -42, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, -37, 0, 0, 0, 0, 0, 0, 0, 0, 0, -11, 0, 0, 0, 0], [0, 0, 0, -125, 0, 0, 0, 125, 0, 0, 0, 0, 0, 172, 0, 0], [0, 0, 0, 95, 0, 0, 0, 0, 0, -221, 0, 0, 0, 221, 0, 0], [0, 0, -30, 0, 0, 0, -88, 0, 88, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 290, 0, 2, 2], [1448, 0, 0, 0, 0, 0, -13, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -101, 0, 0, 0, 0, 0, 0, 0, -101, 0, 0, -33], [0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0], [0, 0, 0, 0, -21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0], [-160, 0, -160, 0, 0, 0, 0, 0, -170, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -306, 0, -236, 0, 0, 0, 0, 0, 0], [0, 0, 334, 0, 0, 0, -115, 0, 115, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0], [0, 0, 0, 295, 0, 0, 0, 0, 0, 197, 0, 0, 0, -197, 0, 0], [0, 0, 0, 0, 0, 59, 0, 0, 0, 0, -8, 0, 0, 0, 0, 0], [0, 0, 1536, 0, 0, 0, 44, 0, -44, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -193, 0, 0, 0, 0, 0, 0, 0, -193, 0, 0, 1], [0, -35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, 0, 0, 0, 0], [0, 0, 0, 0, -67, 0, 0, 0, 0, 0, 0, 0, 0, 0, -14, 0], [1494, 0, 1494, 0, 0, 0, 0, 0, -29, 0, 0, 0, 0, 0, 0, 0], [0, 0, -332, 0, 0, 0, -137, 0, 137, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -4, 0, 0, 0, 0, 0, 0, 0, 127, 0, -4, -4], [0, 0, 0, 0, -24, 0, 0, 0, 0, 0, 0, 0, -24, 0, 0, 11], [0, -10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, 0, 0], [0, 0, 0, 332, 0, 0, 0, -332, 0, 0, 0, 0, 0, 214, 0, 0], [0, 0, 0, 46, 0, 0, 0, 0, 0, -471, 0, 0, 0, 471, 0, 0], [0, 0, 0, 0, 0, 0, 0, -129, 0, -107, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -20, 0, 0, 0, 0, 0, 0, 0, -128, 0, -20, -20], [0, 0, 0, 0, -343, 0, 0, 0, 0, 0, 0, 0, 0, 0, -8, 0], [0, 0, 0, 86, 0, 0, 0, 0, 0, -92, 0, 0, 0, 92, 0, 0], [0, 26, 0, 0, 0, -23, 0, 0, 0, 0, 26, 23, 0, 0, 0, 0], [0, 0, 0, 0, 0, 2, 0, 0, 0, 0, -21, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -91, 0, 56, 0, 0, 0, 0, 0, 0], [0, 0, 1524, 0, 0, 0, -3, 0, 3, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -19, 0, 0, 0, 0, 0, 0, 0, 273, 0, -19, -19], [1622, 0, 0, 0, 0, 0, -32, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 298, 0, 0, 0, 0, 0, 0, 0, 298, 0, 0, 2], [0, 0, 0, 0, -301, 0, 0, 0, 0, 0, 0, 0, 0, 0, -9, 0], [0, 0, 0, -165, 0, 0, 0, 0, 0, -189, 0, 0, 0, 189, 0, 0], [694, 0, 694, 0, 0, 0, 0, 0, 126, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, -41, 0, 0, 0, 23, 0, 0, 0, 0, -41, -23, 0, 0, 0, 0], [0, 0, 0, 0, 0, 39, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0], [0, 0, 2, 0, 0, 0, 11, 0, -11, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 389, 0, 0, 0, -389, 0, 0, 0, 0, 0, -426, 0, 0], [0, -62, 0, 0, 0, 6, 0, 0, 0, 0, -62, -6, 0, 0, 0, 0], [0, 0, 528, 0, 0, 0, -142, 0, 142, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -4, 0, 0, 0, 0, 0, 0, 0, -222, 0, -4, -4], [-324, 0, 0, 0, 0, 0, -31, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -327, 0, 0, 0, 0, 0, 0, 0, -327, 0, 0, 6], [0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, -141, 0, 0, 0, 0], [0, 0, 0, 43, 0, 0, 0, 0, 0, -506, 0, 0, 0, 506, 0, 0], [0, -4, 0, 0, 0, -27, 0, 0, 0, 0, -4, 27, 0, 0, 0, 0], [-46, 0, -46, 0, 0, 0, 0, 0, 47, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -357, 0, 336, 0, 0, 0, 0, 0, 0], [-342, 0, 0, 0, 0, 0, -142, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, -36, 0, 0, 0, 0], [0, 0, 0, -437, 0, 0, 0, 437, 0, 0, 0, 0, 0, -116, 0, 0], [0, 0, 0, 0, 236, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 0], [0, 0, 0, -53, 0, 0, 0, 0, 0, -619, 0, 0, 0, 619, 0, 0], [0, -36, 0, 0, 0, -104, 0, 0, 0, 0, -36, 104, 0, 0, 0, 0], [0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0], [0, 0, 0, 0, -4, 0, 0, 0, 0, 0, 0, 0, 240, 0, -4, -4], [0, -59, 0, 0, 0, 0, 0, 0, 0, 0, 0, -99, 0, 0, 0, 0], [0, 0, 0, -138, 0, 0, 0, 0, 0, 382, 0, 0, 0, -382, 0, 0], [0, 0, 0, 0, 0, 0, 0, 408, 0, -572, 0, 0, 0, 0, 0, 0], [0, 0, 1438, 0, 0, 0, 78, 0, -78, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -27, 0, 0, 0, 0, 0, 0, 0, -221, 0, -27, -27], [0, 0, 0, 0, 272, 0, 0, 0, 0, 0, 0, 0, 272, 0, 0, 25], [0, 0, 0, 39, 0, 0, 0, -39, 0, 0, 0, 0, 0, -186, 0, 0], [0, 0, 0, 0, -151, 0, 0, 0, 0, 0, 0, 0, 0, 0, -29, 0], [-22, 0, -22, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 26, 0, 0, 0, 0, 0], [288, 0, 0, 0, 0, 0, -194, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 399, 0, 0, 0, 0, 0, 0, 0, 399, 0, 0, -5], [0, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, -71, 0, 0, 0, 0], [0, 0, 0, 157, 0, 0, 0, -157, 0, 0, 0, 0, 0, -171, 0, 0], [0, 0, 0, 0, -150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, -41, 0, 0, 0, -49, 0, 0, 0, 0, -41, 49, 0, 0, 0, 0], [-416, 0, -416, 0, 0, 0, 0, 0, -73, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -113, 0, 106, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -43, 0, 0, 0, 0, 0, 0, 0, -163, 0, -43, -43], [0, 0, 0, -459, 0, 0, 0, 0, 0, 289, 0, 0, 0, -289, 0, 0], [46, 0, 46, 0, 0, 0, 0, 0, 216, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, -149, 0, 0, 0, 0, -39, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 202, 0, 91, 0, 0, 0, 0, 0, 0], [0, 0, 0, -327, 0, 0, 0, 327, 0, 0, 0, 0, 0, -89, 0, 0], [0, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4, 0], [0, 0, 0, 144, 0, 0, 0, 0, 0, 500, 0, 0, 0, -500, 0, 0], [0, 0, 0, 0, 0, 84, 0, 0, 0, 0, -36, 0, 0, 0, 0, 0], [0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, -431, 0, -2, -2], [-82, 0, 0, 0, 0, 0, 280, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, -37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0], [0, 0, 0, -359, 0, 0, 0, 0, 0, -501, 0, 0, 0, 501, 0, 0], [-1560, 0, -1560, 0, 0, 0, 0, 0, -110, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 451, 0, -9, 0, 0, 0, 0, 0, 0], [0, 0, -2112, 0, 0, 0, 24, 0, -24, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 277, 0, 0, 0, -277, 0, 0, 0, 0, 0, 149, 0, 0], [0, 0, 0, 487, 0, 0, 0, 0, 0, 628, 0, 0, 0, -628, 0, 0], [0, 69, 0, 0, 0, 73, 0, 0, 0, 0, 69, -73, 0, 0, 0, 0], [1256, 0, 1256, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0], [0, 0, -306, 0, 0, 0, 308, 0, -308, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -128, 0, 0, 0, 0, 0, 0, 0, -128, 0, 0, -25], [0, 0, 0, 0, -202, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0], [60, 0, 60, 0, 0, 0, 0, 0, 310, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, -114, 0, 20, 20], [0, 0, 0, 312, 0, 0, 0, -312, 0, 0, 0, 0, 0, -277, 0, 0], [0, 0, 0, -304, 0, 0, 0, 0, 0, 502, 0, 0, 0, -502, 0, 0], [0, -56, 0, 0, 0, 139, 0, 0, 0, 0, -56, -139, 0, 0, 0, 0], [-46, 0, -46, 0, 0, 0, 0, 0, -18, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 172, 0, 0, 0, 0, 51, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 317, 0, -214, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 127, 0, 24, 24], [0, -60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 178, 0, 0, 0, 0], [0, 0, 0, 0, -208, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0], [0, 73, 0, 0, 0, -91, 0, 0, 0, 0, 73, 91, 0, 0, 0, 0], [0, 0, 0, 0, -11, 0, 0, 0, 0, 0, 0, 0, -464, 0, -11, -11], [566, 0, 0, 0, 0, 0, 112, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3, 0], [0, 0, 0, -266, 0, 0, 0, 0, 0, -432, 0, 0, 0, 432, 0, 0], [0, 0, 0, 0, -24, 0, 0, 0, 0, 0, 0, 0, -55, 0, -24, -24], [0, 0, 0, 0, -68, 0, 0, 0, 0, 0, 0, 0, -68, 0, 0, -17], [0, 0, 0, -276, 0, 0, 0, 276, 0, 0, 0, 0, 0, 38, 0, 0], [0, 0, 0, 98, 0, 0, 0, 0, 0, 63, 0, 0, 0, -63, 0, 0], [0, 69, 0, 0, 0, -41, 0, 0, 0, 0, 69, 41, 0, 0, 0, 0], [-1100, 0, -1100, 0, 0, 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_1764_z_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_1764_3_z_n();".
// 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_1764_3_z_n(:prec:=16)
    chi := MakeCharacter_1764_z();
    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_1764_3_z_n();".
// 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_1764_3_z_n( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_1764_z();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,3,sign)));
    Vf := Kernel([<5,R![470596, 0, -38416, 0, 2450, 0, -56, 0, 1]>,<11,R![1882384, 0, 499408, 0, 131124, 0, 364, 0, 1]>,<13,R![2, 0, 20, 0, 1]>,<19,R![17909824, 0, -575552, 0, 14264, 0, -136, 0, 1]>],Snew);
    return Vf;
end function;