
// Make newform 1764.4.k.bd in Magma, downloaded from the LMFDB on 25 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_1764_k();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_1764_k_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_4_k_bd();".
// 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_4_k_bd();".
// 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 := [14161, 2142, 3061, 62, 446, 10, 27, -2, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0], [283035907, -33983852, 45151502, -5942222, 1627866, -629156, 134695, -21796], [-24068474591, 17697242605, -3839540326, 505307686, -460363998, 53501428, -11454035, -1205557], [-3794765653, 1569138137, -605362658, 79669538, -86212482, 8435324, -1805905, -319577], [29070621265, -2020738937, 4637511290, -610325690, 391076178, -64620620, 13834525, -1120543], [431668097, 1356668411, -46360973, 207897296, -13516500, 18671351, -2047537, 553591], [-7476734776, -13024209625, 48961711, -1930017850, 14215002, -132244027, 12181892, -4603973], [-3319150975, 1825168121, -1953697577, 356720156, -153395616, 52895627, -11501593, 1576285]];
    Rf_basisdens := [1, 256662294, 2309960646, 329994378, 769986882, 164997189, 1154980323, 384993441];
    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_k();"
function MakeCharacter_1764_k()
    N := 1764;
    order := 3;
    char_gens := [883, 785, 1081];
    v := [3, 3, 2];
    // 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_k_Hecke();"
function MakeCharacter_1764_k_Hecke(Kf)
    N := 1764;
    order := 3;
    char_gens := [883, 785, 1081];
    char_values := [[1, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0], [-1, 1, 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 := 4;
    raw_aps := [[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, -3, 0, -1, 0, 0, 0], [0, 0, 0, 0, -3, 0, 0, -3], [0, 12, -1, 3, 3, 0, 0, 0], [-48, 48, 0, 0, 0, -5, -6, -3], [48, -48, 0, 0, 0, -6, -3, 1], [-24, 0, 0, 9, -1, -9, 0, -1], [0, -12, -6, -9, 3, 0, 0, 0], [-64, 64, 0, 0, 0, 24, -6, 6], [-252, 0, 1, 15, -3, -15, 1, -3], [-28, 0, 6, -12, -6, 12, 6, -6], [216, -216, 0, 0, 0, 3, -10, -3], [0, -162, 24, -18, -10, 0, 0, 0], [0, 84, -10, 15, -21, 0, 0, 0], [-240, 240, 0, 0, 0, 14, -30, 15], [0, -180, -6, 48, -30, 0, 0, 0], [336, 0, 3, 30, -9, -30, 3, -9], [0, -168, -30, 49, -18, 0, 0, 0], [496, -496, 0, 0, 0, 96, 36, 24], [-780, 0, 8, 18, 18, -18, 8, 18], [540, -540, 0, 0, 0, -69, -11, 15], [504, 0, 18, 49, -48, -49, 18, -48], [0, 48, -9, -12, 42, 0, 0, 0], [-636, 636, 0, 0, 0, -31, 42, -9], [-456, 456, 0, 0, 0, -84, -21, 1], [0, -172, 42, 6, 48, 0, 0, 0], [258, 0, -12, 108, 0, -108, -12, 0], [280, 0, 18, 12, 78, -12, 18, 78], [540, -540, 0, 0, 0, 6, 72, -6], [0, -912, 42, -3, 81, 0, 0, 0], [780, 0, -96, 112, 12, -112, -96, 12], [-186, 186, 0, 0, 0, -78, -72, -82], [0, -656, -90, 36, 54, 0, 0, 0], [0, 1200, 78, -40, 27, 0, 0, 0], [-820, 820, 0, 0, 0, -108, -102, 18], [-528, 0, -82, 315, -45, -315, -82, -45], [-1272, 1272, 0, 0, 0, -162, -27, -72], [0, -1344, 123, -48, -27, 0, 0, 0], [-1392, 0, 96, 36, 111, -36, 96, 111], [840, -840, 0, 0, 0, 270, 177, 109], [0, -1178, 0, -228, 84, 0, 0, 0], [1494, 0, 60, 54, -118, -54, 60, -118], [0, -1584, 0, 108, -72, 0, 0, 0], [1116, 0, -84, 288, 0, -288, -84, 0], [-1704, 0, -96, 180, -144, -180, -96, -144], [0, 2292, -126, 171, 135, 0, 0, 0], [2928, -2928, 0, 0, 0, -72, -84, 45], [-2328, 2328, 0, 0, 0, 213, 30, -81], [2088, 0, 27, -438, -9, 438, 27, -9], [0, 2328, -114, 153, -24, 0, 0, 0], [2148, 0, -190, 327, 75, -327, -190, 75], [-492, 492, 0, 0, 0, -111, -9, 165], [0, -4248, 99, -6, 99, 0, 0, 0], [0, -2568, 217, -78, 138, 0, 0, 0], [1404, -1404, 0, 0, 0, 193, -126, -33], [0, -2314, -96, -132, -156, 0, 0, 0], [4008, 0, -174, 189, 217, -189, -174, 217], [0, -2640, -78, 445, -15, 0, 0, 0], [3936, 0, -19, 360, -126, -360, -19, -126], [-768, 0, -222, 401, 9, -401, -222, 9], [0, 1104, -134, 411, -93, 0, 0, 0], [480, -480, 0, 0, 0, -243, -336, -54], [-3222, 3222, 0, 0, 0, 78, 96, 242], [260, -260, 0, 0, 0, -228, -108, 96], [-2296, 0, 444, -282, 30, 282, 444, 30], [0, -552, 213, -240, -225, 0, 0, 0], [-1728, 0, 90, 72, 129, -72, 90, 129], [0, -2436, -559, 159, -21, 0, 0, 0], [4392, -4392, 0, 0, 0, 210, 195, -109], [0, -4008, -204, -86, 30, 0, 0, 0], [-946, 946, 0, 0, 0, 444, 120, 84], [6652, 0, 192, 348, -204, -348, 192, -204], [1920, -1920, 0, 0, 0, -192, -44, 48], [0, -768, 324, -333, 289, 0, 0, 0], [1728, -1728, 0, 0, 0, -284, 162, 201], [-1992, 1992, 0, 0, 0, -435, 150, -81], [0, -1176, -30, -261, -336, 0, 0, 0], [-5916, 0, -98, 255, 291, -255, -98, 291], [450, 0, -312, -768, 120, 768, -312, 120], [0, -1704, -651, -210, 9, 0, 0, 0], [432, 0, -324, -81, -498, 81, -324, -498], [-3144, 3144, 0, 0, 0, 396, 408, 36], [6456, -6456, 0, 0, 0, -432, -201, 73], [-2142, 0, -36, 936, -396, -936, -36, -396], [-2142, 2142, 0, 0, 0, 456, -576, 24], [-408, 0, 395, -378, 252, 378, 395, 252], [-2528, 0, -534, -108, 306, 108, -534, 306], [7380, -7380, 0, 0, 0, 951, 614, 165], [0, 4632, -874, 393, 33, 0, 0, 0], [0, 7848, -282, 444, 510, 0, 0, 0], [-6288, 0, -537, 708, -243, -708, -537, -243], [-260, 260, 0, 0, 0, 336, -42, -438], [-8280, 0, -280, 330, -174, -330, -280, -174], [-2280, 2280, 0, 0, 0, -810, 253, -54], [0, -2412, 737, -1131, -15, 0, 0, 0], [-4500, 4500, 0, 0, 0, 954, 324, 102], [-1630, 1630, 0, 0, 0, 1500, 360, 276], [-9980, 0, 24, 444, -264, -444, 24, -264], [0, -3942, 504, -906, -450, 0, 0, 0], [0, 4788, 542, -213, 399, 0, 0, 0], [-3504, 3504, 0, 0, 0, -69, -618, 269], [0, 3284, -1452, 204, -276, 0, 0, 0], [0, -6720, 60, -9, 204, 0, 0, 0], [-9564, 0, 342, -1299, -327, 1299, 342, -327], [4260, -4260, 0, 0, 0, -813, -89, -339], [0, 8496, 669, -318, 1, 0, 0, 0], [-576, 0, -684, -657, 336, 657, -684, 336], [-1416, 1416, 0, 0, 0, -864, -672, 204], [0, -2700, 390, 1080, -126, 0, 0, 0], [696, 0, 618, -261, 19, 261, 618, 19], [0, 300, 708, 374, 6, 0, 0, 0], [800, 0, 1506, -972, 594, 972, 1506, 594], [0, 6024, -786, 1239, 19, 0, 0, 0], [-5784, 0, -210, 571, -705, -571, -210, -705], [0, 5352, 306, 633, 273, 0, 0, 0], [3432, -3432, 0, 0, 0, 93, 912, 405], [-6432, 0, 1299, -540, 333, 540, 1299, 333], [0, 13920, 102, -1530, 33, 0, 0, 0], [1764, 0, -684, 180, -72, -180, -684, -72], [-4248, 4248, 0, 0, 0, 954, 261, 792], [0, 20472, 663, 384, -279, 0, 0, 0], [8868, -8868, 0, 0, 0, 54, -372, -42], [-13992, 0, 588, -201, -315, 201, 588, -315], [-8092, 8092, 0, 0, 0, -390, 150, 996], [-2400, 2400, 0, 0, 0, 1086, 152, 786], [-9036, 0, 1134, -203, 165, 203, 1134, 165], [13872, -13872, 0, 0, 0, -558, 24, -345], [0, -5292, 750, -324, -738, 0, 0, 0], [-13272, 0, -849, -186, -233, 186, -849, -233], [9160, -9160, 0, 0, 0, -288, -648, 612], [3212, 0, -570, 2898, 216, -2898, -570, 216], [3444, -3444, 0, 0, 0, -51, 145, -795], [-1488, 0, -564, -1053, 618, 1053, -564, 618], [0, -6192, -503, -1104, -150, 0, 0, 0], [0, -2364, 852, -1094, 78, 0, 0, 0], [10680, 0, -63, -2694, 204, 2694, -63, 204], [0, 8778, -660, 1752, -1052, 0, 0, 0], [-15540, 0, -228, -1782, 810, 1782, -228, 810], [-10614, 10614, 0, 0, 0, 618, 528, 414], [0, 21896, 528, -1248, 276, 0, 0, 0], [3120, 0, -975, -744, -513, 744, -975, -513], [0, -3360, -600, 274, 645, 0, 0, 0], [9360, 0, 190, 159, -1065, -159, 190, -1065], [-8448, 0, -534, -1188, -327, 1188, -534, -327], [0, 22788, 217, -2157, 165, 0, 0, 0], [4896, -4896, 0, 0, 0, 401, 198, 183], [15072, -15072, 0, 0, 0, 546, -927, 145], [18460, -18460, 0, 0, 0, -1200, -1254, -138], [3900, 0, -27, -2445, -753, 2445, -27, -753], [20636, 0, 882, -168, -426, 168, 882, -426], [-12672, 12672, 0, 0, 0, 1077, -314, -357], [0, 7244, -294, -72, -90, 0, 0, 0], [-10344, 0, 831, 2322, 539, -2322, 831, 539], [5912, -5912, 0, 0, 0, -660, -258, 546], [17076, -17076, 0, 0, 0, -1239, 1457, -471], [17472, 0, 384, -1697, 480, 1697, 384, 480], [0, -10176, 809, -3708, 36, 0, 0, 0], [6888, -6888, 0, 0, 0, 936, 3, -783], [3054, 0, 2760, -1428, 676, 1428, 2760, 676], [-15120, 0, 330, -132, 1806, 132, 330, 1806], [-36, 36, 0, 0, 0, 1128, 2168, 816], [0, -5712, 246, -255, 1233, 0, 0, 0], [0, -1704, 1432, 24, -768, 0, 0, 0], [0, 15544, 2502, -2604, 1074, 0, 0, 0], [0, -17952, 222, -1634, -663, 0, 0, 0], [21790, 0, -1608, 1140, 516, -1140, -1608, 516], [-13128, 13128, 0, 0, 0, 90, 1351, 684], [0, -288, -1557, 168, -819, 0, 0, 0], [-9120, 0, 678, 1544, -117, -1544, 678, -117], [24192, -24192, 0, 0, 0, -1842, -1683, 1017], [0, 2564, 1932, -1314, 918, 0, 0, 0], [0, -4560, -192, 436, 36, 0, 0, 0], [-24396, 0, 235, -1095, 921, 1095, 235, 921], [3132, 0, 276, -4848, 276, 4848, 276, 276], [0, -4512, -120, -2535, -297, 0, 0, 0], [-5460, 0, -2082, -135, 885, 135, -2082, 885], [8640, -8640, 0, 0, 0, -806, 1062, 837], [7568, -7568, 0, 0, 0, 2496, 2100, 1668], [17844, 0, -2728, 1644, -300, -1644, -2728, -300], [-15048, 0, -18, 1686, 132, -1686, -18, 132], [19164, -19164, 0, 0, 0, -63, -2735, -837], [0, 27816, -2319, 6, -1027, 0, 0, 0], [0, 3048, 2449, -438, 732, 0, 0, 0], [0, -4194, -360, 5136, -384, 0, 0, 0], [0, 612, 576, 1008, 468, 0, 0, 0], [-11180, 11180, 0, 0, 0, -810, 1440, 486], [0, -43920, -1448, 1638, -162, 0, 0, 0], [-40680, 40680, 0, 0, 0, 2889, -810, 450], [-11568, 0, -1965, 3600, -2043, -3600, -1965, -2043], [-19124, 19124, 0, 0, 0, 4008, -996, 1200], [-15528, 15528, 0, 0, 0, -882, 791, 1332], [0, -15120, -1413, -1188, 1449, 0, 0, 0], [0, 18564, -1441, 2553, -1515, 0, 0, 0], [0, -20700, 1320, -2952, 144, 0, 0, 0], [19880, -19880, 0, 0, 0, 3966, 2154, 348], [-37404, 0, 315, -213, -807, 213, 315, -807], [18168, -18168, 0, 0, 0, 315, 2654, -891], [0, -8994, 276, -5514, 522, 0, 0, 0], [10320, 0, 588, 1566, 78, -1566, 588, 78], [-2304, 2304, 0, 0, 0, -5738, -756, 765], [0, -23256, -342, -1273, 1770, 0, 0, 0], [-19836, 0, 244, 3498, -462, -3498, 244, -462], [0, 30672, -2699, -1380, -1758, 0, 0, 0], [2280, -2280, 0, 0, 0, 4028, 888, 108], [30288, -30288, 0, 0, 0, -540, -1275, 819], [-8934, 0, 720, 1176, -2296, -1176, 720, -2296], [0, 34944, -1446, -855, 249, 0, 0, 0], [-22600, 22600, 0, 0, 0, -1536, 2100, 588], [-21840, 0, -1485, 2748, -1716, -2748, -1485, -1716], [6616, 0, 1758, -1476, 1278, 1476, 1758, 1278], [-852, 852, 0, 0, 0, -342, -748, -1386], [0, 13056, -3122, 1713, -303, 0, 0, 0], [-47664, 47664, 0, 0, 0, -2921, -1440, -2250], [0, -27800, 426, 3444, -1194, 0, 0, 0], [0, -19836, 2869, -3171, -147, 0, 0, 0], [8112, -8112, 0, 0, 0, 2046, 1389, 81], [20544, 0, 4236, -3003, 855, 3003, 4236, 855], [-5588, 5588, 0, 0, 0, 4242, 1038, 372], [11028, 0, -462, 6759, -333, -6759, -462, -333], [-56118, 56118, 0, 0, 0, 2892, -1164, 576], [1864, -1864, 0, 0, 0, 768, -324, 1200], [-3540, 0, 1324, 2400, 1392, -2400, 1324, 1392], [-20384, 0, -3282, 3324, 78, -3324, -3282, 78], [38508, -38508, 0, 0, 0, -2397, -935, 327], [0, -19728, -1461, -2826, 1763, 0, 0, 0], [-27804, 27804, 0, 0, 0, -3875, -2670, -2769], [-52920, 52920, 0, 0, 0, -2256, -1953, -171], [0, -12620, -1170, 3330, -2448, 0, 0, 0], [0, -4992, -354, 5319, -309, 0, 0, 0], [-27080, 0, 450, -4668, 510, 4668, 450, 510], [0, -29610, 612, 5676, 1008, 0, 0, 0], [-3120, 0, -678, 2129, 2661, -2129, -678, 2661], [0, 41880, 1836, -282, 222, 0, 0, 0], [-18264, 18264, 0, 0, 0, -6489, -1014, -2496], [26502, -26502, 0, 0, 0, 738, -324, 2746], [67656, 0, -549, -3096, -595, 3096, -549, -595], [64848, 0, 1684, 2964, -1068, -2964, 1684, -1068], [0, -12528, 1845, 1416, -1377, 0, 0, 0], [-2100, 2100, 0, 0, 0, 6552, 984, 3192], [0, 21072, 1896, -2376, 1224, 0, 0, 0], [-23166, 23166, 0, 0, 0, -552, 2328, 744], [32220, 0, -947, 4389, -525, -4389, -947, -525], [-23664, 23664, 0, 0, 0, -1203, 1934, 627], [41964, 0, -2382, -481, -441, 481, -2382, -441], [0, -31596, -1106, 5589, -63, 0, 0, 0], [0, 32284, 876, 564, 2172, 0, 0, 0], [-3984, 0, -1971, -3282, 1925, 3282, -1971, 1925], [-14446, 0, -4392, 6516, -468, -6516, -4392, -468], [-6612, 6612, 0, 0, 0, -3363, -459, 1959], [0, -30600, 21, 30, -107, 0, 0, 0], [-27240, 0, 1482, -1831, 2142, 1831, 1482, 2142], [0, -14112, 2971, 2724, 1338, 0, 0, 0], [-16728, 16728, 0, 0, 0, 5568, -2205, -595], [0, -61192, -378, -2166, 3048, 0, 0, 0], [0, -68976, 1062, -1129, 1071, 0, 0, 0], [-1008, 0, 1105, 5460, -2838, -5460, 1105, -2838], [-1200, 1200, 0, 0, 0, 7115, 4584, 1386], [0, -25288, 180, -1152, 1116, 0, 0, 0], [14232, 0, -1677, -7884, -683, 7884, -1677, -683], [0, -3648, 4908, -3978, 765, 0, 0, 0], [13728, 0, 2130, -6782, 2535, 6782, 2130, 2535], [0, 15132, 4455, -1233, 747, 0, 0, 0], [32556, -32556, 0, 0, 0, -4212, 456, -2244], [46866, 0, 1308, -3894, 1350, 3894, 1308, 1350], [72684, 0, -783, 663, 951, -663, -783, 951], [-58276, 0, -1632, 2808, 144, -2808, -1632, 144], [0, 528, -816, -1803, 2915, 0, 0, 0], [38880, -38880, 0, 0, 0, -7128, -1710, 1503], [0, -19636, 2772, 1692, 2664, 0, 0, 0], [0, 21912, 534, -2889, -510, 0, 0, 0], [53864, -53864, 0, 0, 0, -2760, 3540, -1608], [-48168, 0, -4410, 6125, -2466, -6125, -4410, -2466], [26364, -26364, 0, 0, 0, 3605, -2046, -2145], [7536, -7536, 0, 0, 0, 4944, 2775, 4293], [0, -8522, 2976, 660, -1740, 0, 0, 0], [-51074, 51074, 0, 0, 0, 2316, -168, 2244], [-13236, 13236, 0, 0, 0, 2301, -406, 39], [0, 66048, 368, 516, 444, 0, 0, 0], [0, 40040, 6270, -5052, 966, 0, 0, 0], [-23520, 0, -6148, 6294, -1986, -6294, -6148, -1986], [-44112, 0, -6954, 1350, 633, -1350, -6954, 633], [-468, 468, 0, 0, 0, -3218, 900, -4686], [-17472, 17472, 0, 0, 0, -2778, -795, -171], [0, 28934, -2448, -3288, -600, 0, 0, 0], [-39666, 0, 2820, -4866, 1250, 4866, 2820, 1250], [0, -30228, -2622, -1301, -837, 0, 0, 0], [-17868, 0, 1315, -4257, 3969, 4257, 1315, 3969], [0, -38178, 2940, 822, -1630, 0, 0, 0], [0, 88812, -1828, -1368, -2088, 0, 0, 0], [37488, -37488, 0, 0, 0, 795, 2670, -107], [-19380, 0, 2474, -3891, 681, 3891, 2474, 681], [-41050, 0, 3696, -828, 1692, 828, 3696, 1692], [0, 6024, 2791, -5466, 2076, 0, 0, 0], [-35232, 35232, 0, 0, 0, -5630, -516, -1326], [46440, 0, 1081, -798, -2274, 798, 1081, -2274], [-5796, 5796, 0, 0, 0, 3405, 1394, -1281], [72708, 0, 3864, -104, -504, 104, 3864, -504], [-1008, 1008, 0, 0, 0, -7263, -3276, 2622], [-27072, 27072, 0, 0, 0, -585, 540, 4275], [0, -5256, -4758, 9804, -1686, 0, 0, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_1764_k_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_1764_4_k_bd();".
// 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_4_k_bd(:prec:=8)
    chi := MakeCharacter_1764_k();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 4));
    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_4_k_bd();".
// 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_4_k_bd( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_1764_k();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,4,sign)));
    Vf := Kernel([<5,R![769951504, -15982848, 11763952, 237312, 141996, 1152, 412, 0, 1]>,<11,R![537394557184, 60803923968, 9911692928, -343056384, 16373424, -165888, 4136, 0, 1]>,<13,R![10008036, -31104, -7092, 0, 1]>],Snew);
    return Vf;
end function;