
// Make newform 1680.3.s.c in Magma, downloaded from the LMFDB on 25 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_1680_s();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_1680_s_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_1680_3_s_c();".
// 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_1680_3_s_c();".
// 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 := [441, -1638, 4950, -5472, 5613, -1074, 1704, -372, 295, -26, 21, -2, 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], [2151653525805, -1028895680526, 2969181679896, 8663666606754, 1781364901824, 1552126862414, 213549867516, 315532034086, 16671982336, 20630949354, 179172244, 1163071964], [-144857546720712, 411966888798087, -323219534885292, 167210840887752, -89943465015027, 52938005623695, -19979390806744, 7194121908415, -1428356575517, 518349481172, -84005908649, 19870505890], [8249891025873, -41728255959096, 34182728232798, -45731806099632, 6857417738770, -13556067558780, 2597271123866, -2326556207056, 182952067062, -164611608580, 14497160068, -7830116016], [-231105440938869, 210065305235184, -606435948666924, 153524430515955, -154323934459524, 58795985026140, -32964375662714, 9154276278382, -2290451892108, 684289167827, -134337649452, 28642872442], [-159247976309163, 472981527450621, -434675264623374, 278415259366386, -115859812936809, 88949827712793, -28411853780890, 13227194427325, -2027228723711, 950291458850, -128034905585, 39871638046], [794649726, -335831265, 966776562, 2082413232, 552012621, 544174569, 32874720, 112253475, 2597287, 7746906, -161001, 420436], [-18282636368199, 8787673541682, -25286831481312, -55318057600752, -14310718180788, -14410123013778, -696798378966, -2979440990802, -55032700892, -205981302354, 5210631312, -11187033068], [-4306806, 18996579, -29629158, 30382920, -5419563, 9463719, -2055140, 1697439, -142983, 121362, -11357, 5888], [-2470563074763, 45520828453800, -57941854444554, 55017188023641, -11089514438346, 17185537551444, -4036087599626, 3036253477328, -281471772670, 217694819151, -21796565040, 10465136770], [6309118974753, -16532688498102, 19858677257310, -25482799710645, 2916220839078, -7600600799214, 1347840842486, -1370545304570, 92976169234, -97232846541, 7993408932, -4771832146], [212231462685480, -646628005813608, 1053296354400858, -792860368623084, 222892955737464, -256948296495024, 68851916591280, -44563758346308, 4809676764430, -3210228154956, 350115328056, -151294336430]];
    Rf_basisdens := [1, 5604734688861, 16814204066583, 5604734688861, 16814204066583, 16814204066583, 133884909, 2402029152369, 1130283, 1528564006053, 579800140227, 16814204066583];
    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_1680_s();"
function MakeCharacter_1680_s()
    N := 1680;
    order := 2;
    char_gens := [1471, 421, 1121, 337, 241];
    v := [2, 2, 2, 2, 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_1680_s_Hecke();"
function MakeCharacter_1680_s_Hecke(Kf)
    N := 1680;
    order := 2;
    char_gens := [1471, 421, 1121, 337, 241];
    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], [-1, 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, -1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0], [1, 1, 0, 1, -2, -1, 0, 0, 1, 0, 0, -1], [-1, 0, 0, 0, 0, 0, 0, 1, 4, -1, 1, 2], [-1, 0, -1, -1, 0, 1, 0, 1, -2, -1, 1, 2], [-1, 0, -1, -6, 0, -2, 0, 1, 1, 2, -2, -1], [3, 3, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0], [6, 5, 0, 0, 0, 0, 2, -1, 0, 2, 2, 0], [1, 0, 0, 2, 0, 0, 0, -1, -10, -2, 2, -2], [6, -5, 0, 2, -4, -2, -4, -1, 2, -2, -2, -2], [1, 0, 0, 21, 0, -3, 0, -1, -3, 0, 0, -5], [-8, -3, 0, 2, -4, -2, 0, -5, 2, -3, -3, -2], [1, 0, 7, -11, 0, -1, 0, -1, 2, 1, -1, 4], [21, -9, 0, 0, 0, 0, 6, -6, 0, -2, -2, 0], [-7, 0, -2, -11, 0, -7, 0, 7, -7, 4, -4, 5], [4, 0, 9, -22, 0, 0, 0, -4, -1, -2, 2, 1], [-18, 9, 0, 2, -4, -2, -12, 1, 2, 1, 1, -2], [1, 4, 0, 1, -2, -1, -2, -3, 1, -6, -6, -1], [-3, 0, -2, -16, 0, -10, 0, 3, 14, -2, 2, -6], [0, -10, 0, 2, -4, -2, -8, -12, 2, -4, -4, -2], [6, 0, 0, -12, 0, 12, 0, -6, -8, -4, 4, 0], [-5, 0, -4, 5, 0, 1, 0, 5, -31, 4, -4, 7], [1, 0, 6, -14, 0, 0, 0, -1, -4, 10, -10, 4], [10, 0, 4, -20, 0, 8, 0, -10, -6, 6, -6, -8], [2, 0, 0, -4, 0, 6, 0, -2, -20, 5, -5, 2], [-27, -17, 0, 2, -4, -2, -6, -2, 2, -2, -2, -2], [-26, -4, 0, 4, -8, -4, -12, -16, 4, 2, 2, -4], [-35, 19, 0, 4, -8, -4, -6, -6, 4, -4, -4, -4], [-4, -2, 0, -4, 8, 4, 4, 12, -4, 1, 1, 4], [9, 0, -10, -7, 0, 13, 0, -9, -7, -2, 2, -15], [21, 3, 0, -4, 8, 4, -14, -6, -4, -8, -8, 4], [-3, 0, 9, 56, 0, -12, 0, 3, 17, 4, -4, 3], [-62, 9, 0, 6, -12, -6, 30, -1, 6, 6, 6, -6], [-56, 16, 0, 6, -12, -6, 4, -10, 6, 8, 8, -6], [-3, 0, 18, 44, 0, 0, 0, 3, -42, -3, 3, 24], [34, 7, 0, -2, 4, 2, -20, 7, -2, -7, -7, 2], [-1, 0, -7, -19, 0, -5, 0, 1, 0, 9, -9, -10], [-10, 0, -8, -26, 0, -22, 0, 10, -36, 6, -6, -10], [-45, -5, 0, -3, 6, 3, -4, 4, -3, 4, 4, 3], [0, 0, 13, -2, 0, -16, 0, 0, 11, -8, 8, -3], [-33, 22, 0, 9, -18, -9, -22, -11, 9, -2, -2, -9], [-68, 4, 0, 12, -24, -12, -4, 10, 12, -6, -6, -12], [-37, 17, 0, -6, 12, 6, -10, 18, -6, 12, 12, 6], [-5, 0, -8, -38, 0, 20, 0, 5, 2, 22, -22, 22], [50, -30, 0, 8, -16, -8, 52, -18, 8, -10, -10, -8], [18, 0, 2, -96, 0, 10, 0, -18, -10, -5, 5, -24], [12, 0, -4, 14, 0, -2, 0, -12, 38, 4, -4, -30], [-10, 0, 11, -50, 0, -20, 0, 10, 33, -18, 18, 11], [-111, 3, 0, -2, 4, 2, 46, 6, -2, -8, -8, 2], [-135, 8, 0, 7, -14, -7, 42, -7, 7, -6, -6, -7], [2, 0, -2, -50, 0, 2, 0, -2, -44, -16, 16, -4], [-37, 0, -30, 27, 0, -9, 0, 37, 67, 2, -2, 35], [9, 0, 19, -71, 0, -13, 0, -9, -28, 7, -7, -12], [-77, 9, 0, 2, -4, -2, -6, -22, 2, -2, -2, -2], [20, 0, 8, 110, 0, 10, 0, -20, 56, 34, -34, -22], [3, 0, 14, -126, 0, -20, 0, -3, -12, 12, -12, -12], [188, -5, 0, 6, -12, -6, -40, -11, 6, -4, -4, -6], [200, -10, 0, 4, -8, -4, 36, 12, 4, 0, 0, -4], [-14, 0, 10, 36, 0, -4, 0, 14, 14, -26, 26, 34], [-16, 0, 8, 14, 0, 10, 0, 16, 0, -24, 24, 50], [6, 0, 32, -104, 0, 4, 0, -6, 0, -18, 18, 24], [6, 0, 8, 44, 0, -32, 0, -6, 12, 24, -24, -36], [31, 0, 4, 4, 0, 26, 0, -31, 28, -10, 10, -32], [57, 3, 0, -8, 16, 8, 34, -18, -8, -2, -2, 8], [116, -48, 0, 2, -4, -2, -80, 30, 2, -10, -10, -2], [-80, -16, 0, -16, 32, 16, 20, -34, -16, -16, -16, 16], [115, 31, 0, -16, 32, 16, -30, 36, -16, -12, -12, 16], [-24, 0, -25, -30, 0, -20, 0, 24, 69, -6, 6, 3], [19, 0, -1, 17, 0, 31, 0, -19, -84, -45, 45, -8], [-109, 58, 0, 5, -10, -5, -14, 29, 5, 2, 2, -5], [18, 0, 44, -22, 0, -8, 0, -18, -50, -25, 25, 0], [36, 33, 0, -14, 28, 14, 48, 47, -14, 14, 14, 14], [-170, -8, 0, 16, -32, -16, 60, 8, 16, 32, 32, -16], [-43, 0, -21, -57, 0, -3, 0, 43, -40, 25, -25, 62], [-6, 23, 0, 2, -4, -2, 10, -7, 2, 14, 14, -2], [-9, 0, 8, -32, 0, 28, 0, 9, -40, -11, 11, 54], [-20, 0, 0, 2, -4, -2, -36, 14, 2, 0, 0, -2], [-48, 0, -8, 4, 0, -40, 0, 48, -72, 18, -18, 48], [-27, 0, -16, 47, 0, -29, 0, 27, 25, 2, -2, 9], [-38, -74, 0, 4, -8, -4, -24, 26, 4, -30, -30, -4], [-147, -50, 0, -3, 6, 3, -46, 7, -3, 10, 10, 3], [-29, 0, 24, 74, 0, -60, 0, 29, 74, 4, -4, 22], [-45, 0, 0, 58, 0, -36, 0, 45, 10, -22, 22, 54], [-201, -13, 0, -28, 56, 28, 50, 44, -28, 12, 12, 28], [34, -58, 0, 12, -24, -12, 52, -38, 12, -8, -8, -12], [8, -30, 0, 12, -24, -12, -44, 32, 12, -6, -6, -12], [12, 0, -22, -28, 0, 16, 0, -12, 32, 16, -16, -30], [88, 28, 0, 20, -40, -20, 60, -2, 20, -1, -1, -20], [60, 0, 6, 102, 0, 66, 0, -60, 72, 6, -6, -48], [0, 0, -48, -150, 0, 6, 0, 0, 26, 4, -4, -42], [-66, -34, 0, 0, 0, 0, -88, -2, 0, 5, 5, 0], [9, 1, 0, -1, 2, 1, 92, 64, -1, 28, 28, 1], [224, -54, 0, -10, 20, 10, 64, -12, -10, 8, 8, 10], [-29, 0, -47, -47, 0, -13, 0, 29, 224, -5, 5, -2], [-8, 0, -34, -34, 0, -26, 0, 8, 6, -18, 18, -44], [-21, 0, -30, -237, 0, 15, 0, 21, 153, -6, 6, 27], [-56, 0, -2, 24, 0, 20, 0, 56, 42, -30, 30, 130], [190, -48, 0, 28, -56, -28, 40, -80, 28, -14, -14, -28], [-46, -35, 0, -30, 60, 30, -12, 57, -30, 19, 19, 30], [-311, -15, 0, -30, 60, 30, -22, 56, -30, 24, 24, 30], [-8, 0, 4, 148, 0, -16, 0, 8, 52, -52, 52, 4], [-194, -40, 0, 4, -8, -4, -16, 4, 4, 16, 16, -4], [112, -18, 0, -6, 12, 6, -108, 24, -6, -24, -24, 6], [49, 0, 24, 152, 0, 6, 0, -49, -84, -12, 12, -68], [24, 0, -2, 76, 0, 68, 0, -24, -106, -62, 62, 18], [41, 0, -13, -1, 0, -11, 0, -41, -86, 11, -11, -106], [-13, -82, 0, 17, -34, -17, -22, -15, 17, -62, -62, -17], [16, 0, -32, 126, 0, 38, 0, -16, 122, -26, 26, -26], [104, 0, 58, -28, 0, 50, 0, -104, 50, -41, 41, -100], [168, -115, 0, -2, 4, 2, -128, 31, -2, -6, -6, 2], [-165, -31, 0, -24, 48, 24, 110, 62, -24, -28, -28, 24], [-3, 0, -43, -188, 0, 16, 0, 3, 185, 16, -16, -21], [-2, 52, 0, -8, 16, 8, 16, 4, -8, -22, -22, 8], [-62, -40, 0, 18, -36, -18, -68, -32, 18, 4, 4, -18], [-10, 0, -44, 148, 0, -28, 0, 10, -200, -4, 4, -52], [-31, 0, 35, -205, 0, -47, 0, 31, -300, 21, -21, 50], [-447, -65, 0, -4, 8, 4, 18, 34, -4, -30, -30, 4], [-27, -57, 0, -25, 50, 25, 88, 30, -25, -40, -40, 25], [-78, 0, 3, -226, 0, -60, 0, 78, -83, -46, 46, 99], [136, 78, 0, -4, 8, 4, 52, -96, -4, -2, -2, 4], [0, 0, 8, 146, 0, 46, 0, 0, -64, -8, 8, 54], [235, -13, 0, 14, -28, -14, 2, 52, 14, 50, 50, -14], [31, 0, 15, 114, 0, -54, 0, -31, 37, -28, 28, -101], [-402, 79, 0, -16, 32, 16, 126, -11, -16, 6, 6, 16], [-26, -52, 0, 12, -24, -12, 52, 44, 12, -4, -4, -12], [-24, 0, -10, -178, 0, -50, 0, 24, -36, -54, 54, -12], [10, 0, 32, -92, 0, -2, 0, -10, -148, 73, -73, 10], [7, 0, -18, 204, 0, -36, 0, -7, 94, 41, -41, -68], [-24, 64, 0, -38, 76, 38, 84, 122, -38, 66, 66, 38], [-771, 35, 0, 10, -20, -10, 54, -34, 10, 0, 0, -10], [62, -2, 0, 20, -40, -20, 36, 22, 20, 4, 4, -20], [334, -33, 0, -10, 20, 10, 52, -9, -10, 46, 46, 10], [-33, 0, 26, 233, 0, -23, 0, 33, 75, -6, 6, 69], [30, 0, 28, 58, 0, 38, 0, -30, 194, -38, 38, 6], [64, 0, 56, 116, 0, 4, 0, -64, 194, -20, 20, -68], [44, 0, 34, -132, 0, 80, 0, -44, 10, 2, -2, 26], [16, 0, -6, -96, 0, -24, 0, -16, -232, 76, -76, -62], [20, 84, 0, 28, -56, -28, -64, 106, 28, -16, -16, -28], [-35, 0, -37, 84, 0, 76, 0, 35, -337, 28, -28, 109], [48, 23, 0, -6, 12, 6, 130, 35, -6, 38, 38, 6], [-200, 54, 0, 8, -16, -8, -20, -72, 8, 15, 15, -8], [853, -45, 0, 0, 0, 0, 26, -34, 0, -32, -32, 0], [26, 0, -7, -14, 0, 64, 0, -26, -181, -8, 8, 5], [32, 0, -38, -296, 0, 20, 0, -32, 38, 46, -46, -82], [-29, 0, -4, -316, 0, 40, 0, 29, 136, 17, -17, 94], [-13, 0, 31, 85, 0, 35, 0, 13, 0, -69, 69, 92], [33, 0, -21, -176, 0, 36, 0, -33, 255, -30, 30, -51], [223, -1, 0, 80, -160, -80, -14, -80, 80, -58, -58, -80], [164, -15, 0, 26, -52, -26, -8, 15, 26, 96, 96, -26], [37, 0, 48, -9, 0, -45, 0, -37, 87, 12, -12, -71], [72, 7, 0, 2, -4, -2, 16, 105, 2, 15, 15, -2], [49, 0, 55, 277, 0, -13, 0, -49, -290, -25, 25, -56], [188, -73, 0, -18, 36, 18, 16, -115, -18, 3, 3, 18], [33, -10, 0, -33, 66, 33, 38, -61, -33, 78, 78, 33], [-1086, -54, 0, -12, 24, 12, -20, -58, -12, -8, -8, 12], [21, 0, 90, -345, 0, -57, 0, -21, 17, -26, 26, -9], [5, 0, -8, 42, 0, -76, 0, -5, 34, 50, -50, -94], [-22, 0, -22, -274, 0, -110, 0, 22, -110, 104, -104, -88], [-483, -49, 0, -44, 88, 44, 54, 110, -44, -6, -6, 44], [519, 25, 0, 26, -52, -26, 178, 82, 26, 24, 24, -26], [304, -212, 0, -12, 24, 12, 20, -62, -12, -67, -67, 12], [-41, 0, 88, -287, 0, -43, 0, 41, 247, -124, 124, 127], [-327, -209, 0, 18, -36, -18, -122, -134, 18, -72, -72, -18], [33, 0, -69, 57, 0, 147, 0, -33, -86, 41, -41, 12], [18, -6, 0, -8, 16, 8, -36, -34, -8, -26, -26, 8], [-51, 0, 12, 168, 0, -24, 0, 51, -244, -23, 23, 90], [-90, 50, 0, 80, -160, -80, 108, -14, 80, -78, -78, -80], [50, 0, -20, 100, 0, 44, 0, -50, 158, 22, -22, -76], [-1047, -25, 0, 13, -26, -13, -52, -22, 13, 24, 24, -13], [-8, 0, 1, -606, 0, 20, 0, 8, -153, -60, 60, 37], [237, -88, 0, 5, -10, -5, 126, -19, 5, -18, -18, -5], [230, -86, 0, -20, 40, 20, 40, 82, -20, -46, -46, 20], [-33, 0, 24, -18, 0, -84, 0, 33, -386, -4, 4, 6], [31, 0, -12, 243, 0, -69, 0, -31, -317, 32, -32, -143], [-734, -50, 0, 4, -8, -4, 112, 58, 4, -22, -22, -4], [-30, -35, 0, 6, -12, -6, 14, -101, 6, 66, 66, -6], [-2, 0, 36, -384, 0, -66, 0, 2, -76, 19, -19, -26], [-28, 0, 91, -286, 0, -16, 0, 28, 273, 48, -48, 131], [300, 182, 0, 56, -112, -56, 76, -24, 56, 17, 17, -56], [-51, 0, -48, 135, 0, -117, 0, 51, 53, 118, -118, -63], [-356, -23, 0, 50, -100, -50, 200, -61, 50, 18, 18, -50], [11, 0, 49, -521, 0, -19, 0, -11, -8, -7, 7, 8], [97, -5, 0, -6, 12, 6, -10, 162, -6, 48, 48, 6], [-94, 0, -98, -164, 0, -100, 0, 94, 240, -54, 54, -10], [-238, 141, 0, 26, -52, -26, -148, -7, 26, 18, 18, -26], [4, 0, -30, 240, 0, -24, 0, -4, -58, 100, -100, -62], [-374, 58, 0, -28, 56, 28, -100, -34, -28, -66, -66, 28], [-32, 0, -54, 78, 0, 78, 0, 32, 60, 66, -66, 88], [-31, 0, -14, -154, 0, -40, 0, 31, 180, 60, -60, 8], [443, -97, 0, 4, -8, -4, -26, -120, 4, -122, -122, -4], [290, 88, 0, -28, 56, 28, 180, -20, -28, -32, -32, 28], [24, 0, 18, 480, 0, 108, 0, -24, -216, 48, -48, 78], [-117, 59, 0, 58, -116, -58, -86, 68, 58, -18, -18, -58], [-25, 0, -107, 457, 0, 59, 0, 25, -146, -7, 7, 2], [-708, -26, 0, 42, -84, -42, 28, 56, 42, -62, -62, -42], [184, 147, 0, 50, -100, -50, -48, -119, 50, -20, -20, -50], [85, 0, 147, -243, 0, 63, 0, -85, -172, -89, 89, 40], [-13, 0, 61, 25, 0, -133, 0, 13, 392, -53, 53, -46], [432, 43, 0, -22, 44, 22, -222, 7, -22, -66, -66, 22], [-25, 0, 10, 102, 0, -88, 0, 25, -120, -72, 72, -28], [41, 0, 74, -24, 0, -128, 0, -41, 406, 47, -47, -136], [90, 0, -92, 30, 0, -10, 0, -90, -286, 100, -100, -282], [25, 0, 12, 219, 0, 39, 0, -25, -535, -8, 8, 1], [-18, 0, 146, 170, 0, -170, 0, 18, -10, -14, 14, 12], [-51, 0, -60, -242, 0, 0, 0, 51, 90, 36, -36, 42], [225, 219, 0, -20, 40, 20, 26, -30, -20, 104, 104, 20], [380, -44, 0, -4, 8, 4, 40, -190, -4, -20, -20, 4], [-157, 0, -65, -14, 0, -106, 0, 157, 177, 18, -18, 143], [-782, 210, 0, -28, 56, 28, -72, 10, -28, -98, -98, 28], [-2, 0, 20, -208, 0, -20, 0, 2, 146, 58, -58, 4], [62, -18, 0, 12, -24, -12, 240, 162, 12, 35, 35, -12], [-82, 0, 2, -28, 0, -200, 0, 82, -142, 82, -82, -34], [74, 0, 94, -86, 0, 86, 0, -74, 100, -82, 82, 32], [116, 0, -44, 188, 0, 44, 0, -116, 432, 60, -60, -232], [-662, 2, 0, 4, -8, -4, -64, 126, 4, -17, -17, -4], [-89, 0, 18, -123, 0, -99, 0, 89, 283, 110, -110, 97], [233, -109, 0, -62, 124, 62, 46, -102, -62, -44, -44, 62], [-139, 45, 0, 54, -108, -54, 370, 40, 54, 8, 8, -54], [-18, -216, 0, -56, 112, 56, 28, 40, -56, -124, -124, 56], [-9, 0, -6, 58, 0, 36, 0, 9, 128, 64, -64, 48], [78, 90, 0, 54, -108, -54, 104, 66, 54, 52, 52, -54], [-1214, -128, 0, -32, 64, 32, -168, -184, -32, -55, -55, 32], [-26, 0, -48, -354, 0, -6, 0, 26, 46, 20, -20, -2], [-686, -156, 0, 12, -24, -12, 156, 264, 12, 28, 28, -12], [-123, 0, -17, -143, 0, -61, 0, 123, 120, -81, 81, 168], [339, -124, 0, 27, -54, -27, -126, -157, 27, -78, -78, -27], [-96, 0, 30, 306, 0, -24, 0, 96, 284, -29, 29, 198], [-1045, 47, 0, 25, -50, -25, -44, 144, 25, 52, 52, -25], [166, 115, 0, -38, 76, 38, -116, -5, -38, 42, 42, 38], [-17, 0, 73, 232, 0, -196, 0, 17, -243, -6, 6, -89], [-262, 18, 0, -36, 72, 36, -60, 222, -36, 50, 50, 36], [-94, 230, 0, -118, 236, 118, 72, 234, -118, 132, 132, 118], [160, 0, 180, 76, 0, 0, 0, -160, -304, 76, -76, -140], [115, 0, 101, -145, 0, 1, 0, -115, -106, -119, 119, -128], [58, 0, -98, -100, 0, -64, 0, -58, 230, 118, -118, -278], [-1065, 93, 0, -6, 12, 6, -2, 42, -6, 40, 40, 6], [-401, 233, 0, -63, 126, 63, 232, 106, -63, 152, 152, 63], [-68, 0, 104, 122, 0, -74, 0, 68, 58, -112, 112, 166], [675, -65, 0, -36, 72, 36, -210, -200, -36, -146, -146, 36], [-69, 0, -187, -106, 0, -38, 0, 69, -41, -124, 124, -87], [-110, 0, -40, -150, 0, -20, 0, 110, -206, 17, -17, 160], [642, -66, 0, -76, 152, 76, 180, 10, -76, 92, 92, 76], [-45, 0, -1, -391, 0, 31, 0, 45, 348, 75, -75, 120], [104, 0, -4, -64, 0, 64, 0, -104, 400, 44, -44, -148], [120, 0, -84, 680, 0, 150, 0, -120, 116, 85, -85, -174], [107, 0, -12, 765, 0, 81, 0, -107, 259, 140, -140, -145], [-1148, -154, 0, -18, 36, 18, -116, 116, -18, -32, -32, 18], [39, 35, 0, 20, -40, -20, 362, 68, 20, 78, 78, -20], [-230, -131, 0, 14, -28, -14, -468, -215, 14, -150, -150, -14], [47, 0, 62, 149, 0, 37, 0, -47, -105, 42, -42, 5], [1047, -145, 0, -52, 104, 52, 98, -40, -52, -102, -102, 52], [114, 0, -20, 700, 0, 188, 0, -114, -60, 78, -78, -60], [-96, 0, -2, -176, 0, -160, 0, 96, 164, 196, -196, 30], [873, -163, 0, 69, -138, -69, -272, -28, 69, -48, -48, -69], [-810, -66, 0, 32, -64, -32, -160, 194, 32, 8, 8, -32], [-32, 0, -74, -452, 0, 56, 0, 32, -478, 70, -70, 46], [-84, 0, -2, -20, 0, -28, 0, 84, 416, -80, 80, 138], [-9, 0, -152, 430, 0, 128, 0, 9, 238, -16, 16, -6], [-20, 186, 0, -16, 32, 16, 340, 96, -16, 183, 183, 16], [631, 143, 0, 52, -104, -52, 66, 136, 52, -100, -100, -52], [-40, 0, 15, 518, 0, 72, 0, 40, 21, -114, 114, 167], [9, 0, 144, -740, 0, -156, 0, -9, -116, 77, -77, -30], [-93, 0, -139, 65, 0, -125, 0, 93, 26, 37, -37, -78], [-49, 0, -111, -378, 0, 66, 0, 49, 3, 156, -156, 53], [-460, -117, 0, -70, 140, 70, -118, 19, -70, -82, -82, 70], [-219, 0, -82, 5, 0, 1, 0, 219, -25, -2, 2, 357], [286, 245, 0, -46, 92, 46, 68, 245, -46, -29, -29, 46], [1381, -115, 0, 38, -76, -38, -50, -116, 38, 4, 4, -38], [136, 0, 129, 2, 0, -60, 0, -136, 55, -100, 100, -203], [-244, 1, 0, 42, -84, -42, -16, 19, 42, 115, 115, -42], [-77, 0, -134, 748, 0, 2, 0, 77, 206, 124, -124, 22], [592, -208, 0, -110, 220, 110, -28, 150, -110, 82, 82, 110], [-45, 0, -154, 204, 0, -14, 0, 45, -54, 180, -180, -78], [14, 0, -106, 762, 0, 136, 0, -14, 484, -175, 175, 2], [-349, 155, 0, 40, -80, -40, 198, -180, 40, -26, -26, -40], [-170, 148, 0, 76, -152, -76, -308, -80, 76, 102, 102, -76], [-708, 94, 0, -130, 260, 130, 188, 308, -130, 130, 130, 130], [-109, 0, -26, 43, 0, -121, 0, 109, 271, -148, 148, 71], [-31, 0, -105, 129, 0, -153, 0, 31, 238, -61, 61, -196], [-560, -70, 0, -138, 276, 138, -56, -112, -138, -26, -26, 138], [-57, 0, -167, -173, 0, 209, 0, 57, -198, -81, 81, 156], [24, 0, -5, -278, 0, 128, 0, -24, -191, -208, 208, 75], [-62, 0, -114, 276, 0, -132, 0, 62, 326, 202, -202, -122], [-61, -82, 0, 1, -2, -1, -398, 57, 1, 94, 94, -1], [-344, 242, 0, 32, -64, -32, 212, 104, 32, 68, 68, -32], [-647, 25, 0, -58, 116, 58, -42, 132, -58, 116, 116, 58], [65, 0, -90, -10, 0, 228, 0, -65, -160, -164, 164, 8], [-171, 0, -30, 147, 0, -141, 0, 171, -139, -62, 62, 171], [-1120, 55, 0, 14, -28, -14, -438, -133, 14, -50, -50, -14], [-296, 0, -198, -186, 0, -6, 0, 296, -60, -42, 42, 388], [-835, -321, 0, 22, -44, -22, -10, -74, 22, -88, -88, -22], [11, 0, -120, -3, 0, 177, 0, -11, 59, 124, -124, 35], [1416, -53, 0, 34, -68, -34, -88, -171, 34, -104, -104, -34], [42, 0, 180, 30, 0, 30, 0, -42, -484, -20, 20, 126], [-81, 0, 78, 62, 0, 48, 0, 81, 396, 72, -72, 288], [56, 0, -58, 776, 0, -32, 0, -56, -172, -128, 128, -202], [-131, 0, 106, -527, 0, -91, 0, 131, 101, 142, -142, 277], [-228, 0, -18, 4, 0, -384, 0, 228, 22, -34, 34, 54], [-25, 0, 60, 614, 0, -36, 0, 25, 178, 14, -14, 74], [321, -265, 0, 56, -112, -56, 338, -118, 56, -34, -34, -56], [-598, -180, 0, -60, 120, 60, 256, 80, -60, -28, -28, 60]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_1680_s_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_1680_3_s_c();".
// 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_1680_3_s_c(:prec:=12)
    chi := MakeCharacter_1680_s();
    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_1680_3_s_c();".
// 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_1680_3_s_c( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_1680_s();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,3,sign)));
    Vf := Kernel([<11,R![388416, -336576, 66832, 3424, -528, -8, 1]>],Snew);
    return Vf;
end function;