
// Make newform 360.4.k.d in Magma, downloaded from the LMFDB on 29 May 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_360_k();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_360_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_360_4_k_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_360_4_k_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 := [2097152, -1048576, 229376, -90112, 35840, -14848, 8640, -4000, 1080, -232, 70, -22, 7, -4, 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], [-484179968, 137920512, 17481728, -30223360, 17579008, -7774144, 1829984, -396632, 230104, -104462, 44822, -14835, 4300, -405], [268959744, -180715520, 92061696, -24942592, 6300416, -1459136, 695360, -318520, 144592, -41150, 4330, 41, -720, -17], [-1048576, 229376, -90112, 35840, -14848, 8640, -4000, 1080, -232, 70, -22, 7, -4, 1], [-833355776, 563511296, -408223744, 206828544, -89617408, 30597952, -10561056, 3835592, -1264200, 487866, -159314, 47329, -10628, 1847], [1174667264, -2536603648, 1368162304, -603003904, 197581824, -57021888, 17968736, -6680280, 3165400, -1051982, 308694, -62771, 2060, 3179], [-589824, 49152, -18432, 6144, 2432, 640, -1840, 616, -92, 26, -8, -1, -2, 1], [-4951375872, 2015854592, -927350784, 284511232, -99487232, 28277312, -12196832, 5770600, -1890616, 438482, -113794, 10693, 6996, 2483], [10485760, -17924096, 8634368, -3095552, 783360, -218304, 44512, -31224, 13880, -5206, 990, -7, -68, 31], [-6873153536, 4687953920, -1350074368, 388611072, -52306432, -2856896, -2883168, 4595240, -2080344, 261090, 117022, -81059, 34852, -4645], [-1986789376, 2925821952, -820723712, 30364672, 40232960, -60546752, 19584352, -2319544, 421400, -489190, 274654, -158463, 46988, -10281], [-4343988224, 4698177536, -905789440, 45831168, 80411648, -54036416, 18929760, -1236568, 67032, -649038, 349270, -158483, 52300, -11125], [2067267584, -1493204992, 444153856, -7803904, -48995328, 30905280, -10379872, 816600, -148568, 376750, -197046, 86659, -28300, 5765], [5573443584, 923828224, 111919104, -499379200, 212071424, -100022720, 42681440, -11734936, 2563288, -1202462, 592006, -190075, 56844, -19661]];
    Rf_basisdens := [1, 231211008, 8257536, 262144, 231211008, 231211008, 65536, 115605504, 786432, 115605504, 231211008, 231211008, 115605504, 231211008];
    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_360_k();"
function MakeCharacter_360_k()
    N := 360;
    order := 2;
    char_gens := [271, 181, 281, 217];
    v := [2, 1, 2, 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_360_k_Hecke();"
function MakeCharacter_360_k_Hecke(Kf)
    N := 360;
    order := 2;
    char_gens := [271, 181, 281, 217];
    char_values := [[1, 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], [1, 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 := 4;
    raw_aps := [[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, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-3, 0, 0, -2, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0], [-1, 5, -1, -2, 0, 1, -3, -1, 0, 0, 1, -1, -1, 0], [-4, 3, 1, -8, 0, -3, 1, -1, 0, 0, 1, -2, 0, 1], [-15, 0, -2, -12, 8, -1, 5, -1, 3, -1, -1, 4, 0, 0], [3, -4, 0, 6, -12, 0, 0, -4, 0, 2, 4, -1, -1, -1], [33, 2, -2, 18, -12, 4, 4, -4, 1, -2, -4, -2, -4, 0], [9, -29, -2, 18, -22, -4, -12, 0, 0, -4, 0, 7, -3, -4], [44, -7, 4, 10, 6, 9, -13, -3, 1, 1, -3, -1, -3, 0], [9, -18, -1, 18, 6, 9, 5, -1, 0, 4, 1, 1, 1, -5], [57, -13, 0, 18, 26, 4, 4, 0, -6, -2, 0, 1, -7, 0], [-1, -23, 6, -10, -6, -4, 20, 8, 0, 0, -8, 5, 3, 2], [12, 11, 6, 0, -46, 18, -10, -2, -11, -2, -2, -7, 3, 0], [9, -1, -2, 10, -62, -4, -12, -16, 0, 4, 16, -1, -11, -12], [-23, 43, -3, -14, 104, -9, -21, -7, 0, -4, 7, -19, 9, 0], [-1, 65, 10, 22, 30, -42, -2, -2, 0, -10, 2, 3, 11, -12], [-17, 107, -2, -66, -66, -12, -20, 0, 0, -8, 0, 5, -21, -12], [-102, 26, -4, 24, -52, -30, 6, 10, 16, 6, 10, -10, 14, 0], [-152, 18, 16, -4, -44, 24, -8, 16, 0, -4, 16, -2, 22, 0], [-26, -49, 4, -2, 146, 9, 3, 5, 17, -3, 5, 25, -9, 0], [-24, -98, 8, -88, -20, -8, 24, -8, 0, 8, 8, -8, -16, -34], [145, -41, 12, -150, 146, 44, -20, -8, 14, -6, -8, 45, 1, 0], [244, 52, -20, -120, -64, -30, 54, 2, 2, -6, 2, 12, 20, 0], [36, 186, 4, 120, 80, 8, 24, 24, 0, -4, -24, 16, 36, 32], [-77, 10, 4, 62, -20, -6, 46, 34, -29, -10, 34, -10, 14, 0], [-46, 342, 34, -68, 32, -106, 30, 26, 0, -32, -26, 10, 26, 20], [-27, 337, -8, -46, 138, 8, -24, 12, 0, -10, -12, -7, 1, -18], [65, 36, 26, -132, -80, 23, -67, 7, 7, 11, 7, 0, 40, 0], [75, -40, -4, 214, -16, 30, -22, -34, -19, -2, -34, -32, -56, 0], [-71, -511, -23, -206, -52, 71, -21, -7, 0, 16, 7, -39, -39, 42], [259, 74, 6, -72, -172, 111, 69, -9, -13, -45, -9, 18, 22, 0], [61, -160, -14, 130, -48, 14, -42, 30, 0, -22, -30, 49, 1, 5], [171, 385, -2, 438, -154, -4, -12, -24, 0, 8, 24, 49, 39, 20], [-366, 41, 36, 30, -106, 177, 43, 5, 27, -55, 5, 31, 29, 0], [177, -114, 3, 370, -138, 41, 53, 15, 0, 16, -15, 77, 25, -25], [-20, 802, 16, -32, 60, 24, 88, -24, 0, 40, 24, -44, 20, 18], [-422, -19, -14, -84, 94, 114, 118, -26, -11, -58, -26, 63, -27, 0], [88, -448, 38, 456, 456, -110, 42, 6, 0, -20, -6, 0, 152, 38], [-235, -231, 11, -614, -56, -47, -3, 23, 0, -24, -23, -55, -67, 34], [47, 555, 40, 6, -354, -56, 104, 20, 0, 2, -20, 59, -13, 2], [454, -198, -32, 468, 380, 0, 80, -24, -24, -20, -24, -2, -138, 0], [982, -178, 36, 76, 356, -42, -158, 14, -46, 50, 14, -14, -46, 0], [-95, 273, 20, -126, 146, -146, -66, 54, 0, -80, -54, 15, 29, 46], [744, 157, -4, -170, -394, 15, -91, -61, 85, 19, -61, -21, 45, 0], [-145, -256, 30, -202, 240, -174, -54, -14, 0, -50, 14, -53, 27, -1], [-239, 56, 16, -30, -288, -90, -142, 6, -145, 58, 6, -112, 12, 0], [220, -1566, -22, 544, -272, -62, -150, -10, 0, -48, 10, 112, 12, -22], [39, -391, -34, -106, -450, 170, 34, 26, 0, 38, -26, 35, -77, 72], [821, 72, 34, -708, -8, -1, -75, 31, -53, 19, 31, 60, 108, 0], [720, -86, -44, 696, 108, -40, 72, -32, 134, -8, -32, -34, -102, 0], [637, 91, 20, -402, 34, -114, 114, 154, -54, 0, 154, 41, 153, 0], [-27, 409, -95, -150, 92, 107, -273, -27, 0, -28, 27, 1, -123, -178], [-1933, -182, -30, 480, 212, -13, -31, -69, -81, 11, -69, -62, -166, 0], [-1940, -171, 30, 360, 206, 22, -142, -22, -61, 30, -22, -57, -95, 0], [303, -483, 18, 846, 478, -12, 60, 144, 0, -60, -144, 177, 171, -32], [1152, -105, 44, 434, 114, -123, -41, 129, -161, 41, 129, -111, -1, 0], [361, 1764, -55, 882, -258, 131, -89, 61, 0, -20, -61, 157, 73, 145], [3724, 132, -76, -216, -328, 50, 38, -158, 70, -22, -158, 20, -52, 0], [5, -1095, -6, -38, 186, -4, -28, -96, 0, 40, 96, -41, -55, -276], [250, -652, 20, 588, -268, 124, 204, -84, 0, 124, 84, -6, 74, 76], [-128, -1858, -136, -400, 276, 228, -316, -36, 0, -4, 36, -68, -160, -170], [-1096, -186, -108, 576, 372, -460, 60, 44, -102, 100, 44, -126, -138, 0], [-3426, 14, -36, 164, -140, -234, 2, 46, -178, 58, 46, -126, -22, 0], [-167, 1181, -36, -494, -382, -18, -162, -202, 0, 56, 202, -145, -171, -138], [249, 1436, -88, 362, -948, 252, -100, 72, 0, 2, -72, 153, -75, 257], [5204, 226, -64, -524, -284, 84, 300, -20, 32, -96, -20, 110, 78, 0], [68, 1058, -82, 312, 656, 310, -18, -222, 0, 184, 222, -224, 28, -126], [-207, 23, -30, -886, -30, 226, 106, 218, 0, -26, -218, 81, -155, -72], [-4133, -252, 102, -636, 608, -71, -397, 41, -175, 117, 41, 24, 16, 0], [-2948, -128, -68, 900, -112, 130, 22, -190, -24, -38, -190, -104, -264, 0], [2863, -10, -28, 1274, -220, 84, 284, 44, 31, -92, 44, -110, -98, 0], [-235, 4260, -71, -742, 30, 407, 123, -199, 0, 232, 199, -291, -155, -51], [537, 1488, -70, 1234, -48, 170, -110, 2, 0, 14, -2, 201, 53, -171], [3919, 356, 74, 318, -1312, -92, -444, -28, -47, 134, -28, -316, 110, 0], [452, 1190, -44, 1048, -504, 68, -108, -100, 0, 40, 100, 124, 20, -60], [370, -2395, -119, 1108, -36, 29, -447, -297, 0, 44, 297, -44, -2, -187], [-6047, 105, -92, -450, 158, 154, 550, 14, 44, -176, 14, 219, 35, 0], [-5514, -88, 24, -160, 112, -12, -196, -44, -76, 52, -44, -24, -40, 0], [-69, -1069, -121, -42, 876, 349, -135, 51, 0, 28, -51, -97, 27, 54], [-285, -3435, -22, 238, 2382, -42, -130, -18, 0, -34, 18, -329, 367, 224], [10, 322, 28, -24, -820, 538, 430, 2, -144, -242, 2, 46, 78, 0], [4904, 386, 16, 508, -1324, -36, -60, 20, -172, 24, 20, -290, 78, 0], [2728, -71, 236, 54, -130, -81, -475, 275, -391, 139, 275, -225, 177, 0], [-232, 494, 206, -296, 240, -386, 438, 26, 0, 0, -26, -100, 200, 210], [-5876, -330, -164, -396, 948, 236, 196, -348, 164, -108, -348, 290, -330, 0], [-6836, 56, 204, -792, 472, -66, -22, 430, 106, 22, 430, 168, 440, 0], [-447, -2185, 98, -350, 490, -956, -564, 200, 0, -480, -200, 75, 181, 360], [2361, -54, 388, 958, -276, 288, -544, 360, -31, 64, 360, -210, 274, 0], [904, 4390, -236, 2336, 764, 572, -372, 244, 0, -72, -244, 376, 232, 86], [4492, 172, -108, -636, -72, -182, 366, 58, -116, -46, 58, 76, 76, 0], [-4143, 14, 164, -102, -588, 870, -302, -258, -175, -142, -258, 2, -110, 0], [941, -1581, -153, 1850, -140, 513, -99, 439, 0, -116, -439, 637, 69, -120], [347, -6908, 152, 1182, 756, -292, 316, 176, 0, -82, -176, 195, 367, 43], [-3306, 291, 106, -588, -382, -214, -274, 182, 267, 122, 182, 1, 351, 0], [-76, 1458, -112, -328, -16, 316, -132, 244, 0, -76, -244, 96, -60, 268], [4694, 164, 100, 2256, -696, 232, 648, 408, -96, -220, 408, -228, 112, 0], [238, 4754, 164, 1412, 1164, -540, 116, -12, 0, -100, 12, -2, 494, 196], [-753, 4947, -288, -1978, 438, 556, -596, -240, 0, 110, 240, -473, -445, -146], [-107, -3849, 166, 434, 2046, -616, 48, 260, 0, -272, -260, 95, 401, -134], [-160, -700, -286, -424, -1272, 382, -762, -374, 0, 92, 374, -288, -336, 362], [316, 1318, -14, 312, -976, 218, 162, -210, 0, 200, 210, 32, -172, -314], [6187, 323, 220, -366, -742, 386, 78, 286, -252, -116, 286, -23, 345, 0], [719, 6434, -208, 806, -1440, 672, -160, 156, 0, 50, -156, 467, -317, -327], [5332, -1276, 76, 288, 2832, 606, -406, -354, 98, -50, -354, 380, -612, 0], [-158, -1890, 182, 972, 1416, -1142, -414, 54, 0, -416, -54, -30, 554, 476], [-6149, 238, 130, -600, -1428, 991, -571, -521, -293, -105, -521, -98, -178, 0], [-4866, 74, 92, -24, -212, -770, -422, 358, -268, 298, 358, -314, 254, 0], [-4422, 100, 64, 1768, -728, -132, -44, 172, 20, 44, 172, -340, 20, 0], [1991, 1082, 192, 498, -3300, 300, -300, 84, -157, 0, 84, -514, 422, 0], [-380, -3403, -165, -1912, -2232, 83, -577, -63, 0, -92, 63, 110, -736, -377], [3869, -260, -334, 324, 496, -829, -31, -269, -49, 215, -269, -152, -400, 0], [-537, 9602, 262, 6, 1044, -1130, -82, -146, 0, -230, 146, -337, 483, 621], [7922, 469, -116, -1054, -234, -177, 677, 195, 251, -125, 195, 259, 341, 0], [-6692, 464, 376, 1752, -2576, 994, -570, -30, -426, -106, -30, -568, 68, 0], [-414, -4880, -16, -196, 2256, -196, -260, 28, 0, -128, -28, -266, 258, 50], [11658, 329, -138, -1116, -746, 178, 198, -266, -199, -94, -266, 67, -51, 0], [-391, -5295, 124, -614, 2962, 482, 978, 146, 0, 292, -146, -389, 365, -86], [1017, 3015, 89, 1666, -1256, 307, 663, 173, 0, 156, -173, 549, 25, -372], [547, -3235, 62, 1486, 1254, -290, -42, 342, 0, -254, -342, 467, 271, -472], [4856, -1026, 56, -572, 2460, 1032, 136, -336, -208, -292, -336, 546, -526, 0], [-309, 2371, 292, -1362, -330, -394, 774, 486, 0, -148, -486, 337, -57, -258], [942, -556, 60, 1868, -1728, 456, 696, -320, 0, 448, 320, 74, 86, 94], [-51, -7168, -168, -118, -1116, 0, -672, -188, 0, -74, 188, -55, -223, 229], [-628, -5714, -136, -696, 2536, 220, -324, -300, 0, 124, 300, -656, 124, -16], [561, -7249, 130, 842, -1542, 66, 586, -262, 0, 294, 262, 97, -59, -276], [1482, 264, 168, -1128, -560, 886, -318, -266, 378, -142, -266, 272, 148, 0], [-4495, 1698, -244, -902, -3252, 270, 1354, 54, 461, -406, 54, 126, 614, 0], [943, -2560, 47, 2190, -1686, -235, -47, -309, 0, 84, 309, 267, 63, -141], [539, -8904, -340, 1294, -684, 176, -1184, -724, 0, 110, 724, -133, -369, -761], [-2261, -836, 2, -3762, 2800, -24, -912, -440, 93, 234, -440, 668, -186, 0], [1360, -1319, 140, -454, 2502, 1389, -641, -735, -187, -187, -735, 463, -819, 0], [-799, 9764, 37, -3294, -2730, -193, -45, 305, 0, -212, -305, 269, -783, -231], [8798, 1224, -476, 48, -2960, -32, 592, -640, 668, -140, -640, -104, -68, 0], [8743, 45, 140, -38, 558, -1602, -206, 978, -226, 452, 978, -321, 647, 0], [-1183, 9245, -216, -2974, 450, 138, -726, -182, 0, -56, 182, -497, -531, -214], [-60, -8760, -100, 288, 2064, 792, 392, 56, 0, 268, -56, -344, 316, 388], [237, 8911, 34, 42, -1126, -316, -180, 24, 0, -136, -24, 343, -255, -580], [1398, -694, -176, 2844, 908, -278, 846, 210, -906, -142, 210, -362, -582, 0], [1191, 7492, 26, 2574, -3264, -398, -294, 274, 0, -310, -274, 855, 91, 631], [341, 2451, -102, 1018, 1866, 0, -408, 92, 0, -148, -92, 195, 89, -780], [11577, -660, -80, 3314, 280, 270, -566, -578, 507, 74, -578, -308, -776, 0], [-870, 12718, 204, -3740, -2284, -24, 792, 80, 0, 152, -80, 22, -782, -728], [-321, -7765, 12, 150, 2382, -144, -96, -4, 0, -58, 4, -313, 371, 182], [2262, 1478, 164, -888, -3180, 566, 962, 526, -408, -382, 526, -102, 842, 0], [-126, 3091, -233, 1012, 2964, 115, -817, -407, 0, 28, 407, -560, 326, 15], [9107, -940, -70, -1860, 2400, 1333, 791, -411, -939, -531, -411, 696, -628, 0], [-2293, 10526, 162, -6266, 1284, 430, 1078, -218, 0, 486, 218, -1105, -625, -495], [12536, 817, -26, 192, -890, -274, 1146, 658, 443, -218, 658, 139, 685, 0], [85, -8062, -133, -2102, -2466, 1225, 693, 639, 0, 160, -639, 617, -803, -529], [-3747, 195, -724, -342, 170, -1324, 1156, -208, -126, 42, -208, 1, -347, 0], [1286, -5372, -36, 1956, -1248, 456, 312, 304, 0, 40, -304, 834, -154, -862], [6916, 851, -510, 2304, -1950, -2258, 666, 442, 125, 398, 442, -799, 191, 0], [1099, 9787, -530, 2334, 606, 1592, -528, 124, 0, 204, -124, 261, -33, -12], [-14066, -872, 156, 1740, 1408, -768, -880, 256, -294, 412, 256, -424, -236, 0], [14464, 723, -28, -3082, -830, -765, -399, 127, 87, 291, 127, 85, 599, 0], [-1930, -1136, 508, 3744, 1824, 1932, -332, -116, 912, -400, -116, 288, -428, 0], [-9552, -1158, -344, 5900, 1404, -984, 296, -48, 4, 172, -48, -690, -1034, 0], [240, -10386, -840, -1408, -696, 2736, -624, 112, 0, 472, -112, 56, -1072, -716], [-2360, -12320, 76, -3928, 3592, -1324, -1020, -308, 0, -432, 308, -1112, 64, 196], [14521, -524, 382, 1236, 1072, 731, -775, 11, 883, 11, 11, 192, 36, 0], [-16387, 802, -208, -1598, -1764, -894, -170, -54, -279, 266, -54, -290, 258, 0], [-403, 17065, -367, -1014, -100, 931, -537, 45, 0, 76, -45, -287, -227, 750], [3211, -1246, 510, -3168, 3348, -201, -1091, 575, -1353, 323, 575, 234, 198, 0], [-3449, 3008, -198, 1374, -7560, 820, 1620, 4, 365, -610, 4, -568, 818, 0], [-19944, -2351, 20, 662, 6878, 471, 893, 251, 441, -341, 251, 1143, -639, 0], [-408, 8355, -439, -2112, 456, 2045, 289, -209, 0, 688, 209, -558, -628, -367]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_360_k_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_360_4_k_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_360_4_k_d(:prec:=14)
    chi := MakeCharacter_360_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(997) - 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_360_4_k_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_360_4_k_d( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_360_k();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,4,sign)));
    Vf := Kernel([<7,R![-47570432, -1020672, 4875648, 397440, -18584, -1380, 14, 1]>],Snew);
    return Vf;
end function;