
// Make newform 1024.4.a.n in Magma, downloaded from the LMFDB on 25 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_1024_a();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_1024_4_a_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_1024_4_a_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 := [-32, 0, 420, 0, -1380, 0, 405, 0, -36, 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, 4528, 0, -10042, 0, 2823, 0, -250, 0, 7], [17840, 0, -70882, 0, 21595, 0, -2018, 0, 59, 0], [-24496, 0, 180342, 0, -55785, 0, 4982, 0, -137, 0], [0, 18896, 0, -278022, 0, 85849, 0, -7750, 0, 217], [-18656, 0, 112562, 0, -33651, 0, 2994, 0, -83, 0], [35856, 0, -277098, 0, 86919, 0, -8042, 0, 231, 0], [0, 34432, 0, -206166, 0, 62573, 0, -5622, 0, 157], [0, -13680, 0, 73594, 0, -22135, 0, 1978, 0, -55], [0, 224336, 0, -1348970, 0, 407255, 0, -36458, 0, 1015]];
    Rf_basisdens := [1, 208, 416, 416, 832, 208, 416, 416, 64, 832];
    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_1024_a();"
function MakeCharacter_1024_a()
    N := 1024;
    order := 1;
    char_gens := [1023, 5];
    v := [1, 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;

function MakeCharacter_1024_a_Hecke(Kf)
    return MakeCharacter_1024_a();
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, 1, 0, 0], [0, 0, 0, 0, -1, 0, 0, 0, 0, 0], [3, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -1, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 3, 1, 1], [0, 0, 2, 1, 0, -2, 1, 0, 0, 0], [0, 1, 0, 0, -5, 0, 0, -2, 2, -1], [29, 0, 2, -2, 0, 1, -3, 0, 0, 0], [0, -3, 0, 0, 1, 0, 0, 18, 2, -2], [36, 0, -3, 2, 0, 3, 3, 0, 0, 0], [0, 2, 0, 0, 1, 0, 0, 29, -1, -1], [1, 0, -1, 4, 0, 14, 1, 0, 0, 0], [0, -20, 0, 0, -12, 0, 0, -1, 0, -4], [90, 0, -7, 10, 0, 5, 3, 0, 0, 0], [0, -3, 0, 0, -1, 0, 0, 35, 13, -7], [0, -41, 0, 0, 18, 0, 0, 5, 14, 4], [0, 19, 0, 0, -1, 0, 0, 41, -9, 11], [0, 50, 0, 0, 11, 0, 0, -10, 12, 1], [347, 0, -10, 2, 0, 15, 3, 0, 0, 0], [-29, 0, -11, 1, 0, 16, -6, 0, 0, 0], [446, 0, 12, -8, 0, -6, -16, 0, 0, 0], [0, 71, 0, 0, 48, 0, 0, 9, 22, -2], [15, 0, 25, 1, 0, 8, -26, 0, 0, 0], [4, 0, 14, 3, 0, 14, -29, 0, 0, 0], [0, 38, 0, 0, -11, 0, 0, -73, 13, -3], [691, 0, 0, -10, 0, -43, 25, 0, 0, 0], [0, -110, 0, 0, 45, 0, 0, -10, -12, 23], [0, 6, 0, 0, 11, 0, 0, -88, 32, 8], [78, 0, 60, 14, 0, 24, -10, 0, 0, 0], [744, 0, 11, 30, 0, -79, -3, 0, 0, 0], [0, 154, 0, 0, 23, 0, 0, 50, 4, -3], [165, 0, 63, 2, 0, -42, 3, 0, 0, 0], [0, -206, 0, 0, -86, 0, 0, -35, 20, -6], [0, -93, 0, 0, 1, 0, 0, -204, 16, -28], [917, 0, -24, 74, 0, 123, 7, 0, 0, 0], [0, -143, 0, 0, 59, 0, 0, -153, -7, 37], [0, 238, 0, 0, -136, 0, 0, -59, 20, 28], [1059, 0, -27, 40, 0, -52, -52, 0, 0, 0], [0, 58, 0, 0, -47, 0, 0, -193, -75, -11], [0, 181, 0, 0, 12, 0, 0, 137, -6, 38], [0, 149, 0, 0, -71, 0, 0, -260, 24, 60], [1208, 0, -75, -14, 0, -177, 51, 0, 0, 0], [-652, 0, -90, 79, 0, 14, 31, 0, 0, 0], [0, -256, 0, 0, 159, 0, 0, -36, 60, 36], [1107, 0, -49, -52, 0, 74, 2, 0, 0, 0], [0, 179, 0, 0, -182, 0, 0, 63, -50, -68], [948, 0, 137, 10, 0, 183, -25, 0, 0, 0], [0, 6, 0, 0, 132, 0, 0, 97, 44, -72], [0, 334, 0, 0, -101, 0, 0, -18, -14, -22], [407, 0, 97, -47, 0, 72, 14, 0, 0, 0], [1578, 0, 116, -56, 0, 14, 32, 0, 0, 0], [-144, 0, 10, -99, 0, -210, 29, 0, 0, 0], [0, 107, 0, 0, 92, 0, 0, -221, -130, -38], [1066, 0, 148, -134, 0, -144, -62, 0, 0, 0], [731, 0, 100, 46, 0, 105, 37, 0, 0, 0], [0, -96, 0, 0, 251, 0, 0, 260, 20, 28], [-74, 0, 55, -122, 0, -69, -131, 0, 0, 0], [0, -333, 0, 0, 59, 0, 0, 317, -85, -9], [751, 0, 61, 107, 0, 288, 88, 0, 0, 0], [0, -73, 0, 0, 81, 0, 0, 298, 70, -19], [0, 614, 0, 0, 103, 0, 0, 112, 48, -16], [0, -169, 0, 0, 45, 0, 0, 384, 102, 49], [-227, 0, 85, 156, 0, 2, 34, 0, 0, 0], [685, 0, 291, -120, 0, 158, -135, 0, 0, 0], [0, 819, 0, 0, -251, 0, 0, 120, 52, 32], [0, 192, 0, 0, -185, 0, 0, -32, 72, -111], [-18, 0, -8, 144, 0, -56, -88, 0, 0, 0], [0, 673, 0, 0, 158, 0, 0, -451, 106, 20], [0, -1067, 0, 0, -151, 0, 0, -142, 138, 14], [-318, 0, -44, 118, 0, -144, 198, 0, 0, 0], [-525, 0, 164, -66, 0, 33, -139, 0, 0, 0], [-3830, 0, 153, 282, 0, 117, 51, 0, 0, 0], [0, 533, 0, 0, 343, 0, 0, -429, 213, -167], [0, 399, 0, 0, -262, 0, 0, -619, 134, -28], [-888, 0, 106, -172, 0, -10, 102, 0, 0, 0], [0, -1080, 0, 0, -335, 0, 0, -347, -81, 71], [0, -200, 0, 0, 471, 0, 0, -206, -242, 22], [-160, 0, 42, -315, 0, -242, -107, 0, 0, 0], [953, 0, -417, -160, 0, -82, 101, 0, 0, 0], [0, -1080, 0, 0, -179, 0, 0, -264, -64, 19], [0, 1078, 0, 0, 331, 0, 0, -1062, 174, -98], [-918, 0, -312, -288, 0, -54, 28, 0, 0, 0], [680, 0, -86, 245, 0, 182, 117, 0, 0, 0], [-2587, 0, 459, -376, 0, 188, -68, 0, 0, 0], [0, 993, 0, 0, -47, 0, 0, 926, 66, -23], [-2860, 0, -290, -77, 0, 78, -221, 0, 0, 0], [-2803, 0, -5, 108, 0, -322, 221, 0, 0, 0], [0, -200, 0, 0, -729, 0, 0, -1914, 114, 98], [-5290, 0, 226, -220, 0, -156, 138, 0, 0, 0], [0, -1479, 0, 0, 213, 0, 0, 572, 434, -43], [-28, 0, 257, -70, 0, -305, 15, 0, 0, 0], [-6661, 0, 109, 488, 0, 380, 36, 0, 0, 0], [0, 1420, 0, 0, 6, 0, 0, -1675, 288, 10], [0, -187, 0, 0, -70, 0, 0, -1373, -86, 264], [-1123, 0, -170, -122, 0, 509, -167, 0, 0, 0], [0, 1643, 0, 0, 775, 0, 0, -735, 311, -61], [3997, 0, 15, -118, 0, 334, -165, 0, 0, 0], [0, 36, 0, 0, 685, 0, 0, 338, 56, 11], [0, -1975, 0, 0, 327, 0, 0, -1603, -117, 151], [0, -280, 0, 0, 267, 0, 0, -486, -248, -275], [0, 194, 0, 0, 165, 0, 0, 393, 163, 163], [0, -641, 0, 0, 423, 0, 0, 1526, -594, 111], [-2491, 0, -441, -230, 0, -194, 179, 0, 0, 0], [0, 17, 0, 0, 1053, 0, 0, 1378, 290, -131], [-2206, 0, 192, -236, 0, -232, 476, 0, 0, 0], [0, 1340, 0, 0, 253, 0, 0, 234, -256, -13], [3350, 0, -136, -68, 0, -104, 92, 0, 0, 0], [3341, 0, -73, 48, 0, -728, 192, 0, 0, 0], [-1761, 0, 465, -155, 0, 440, -54, 0, 0, 0], [-1452, 0, -68, -408, 0, -616, -132, 0, 0, 0], [0, 1746, 0, 0, 83, 0, 0, 622, 218, 154], [-3081, 0, -403, 307, 0, 264, 176, 0, 0, 0], [0, -642, 0, 0, 843, 0, 0, -1512, -308, -335], [5, 0, 332, -78, 0, 727, -141, 0, 0, 0], [1644, 0, -506, 391, 0, -682, 87, 0, 0, 0], [0, 1014, 0, 0, 455, 0, 0, 1682, 68, -195], [8387, 0, -318, 42, 0, -197, -41, 0, 0, 0], [0, -296, 0, 0, 611, 0, 0, 472, -112, -392], [0, -1069, 0, 0, 308, 0, 0, -563, 318, -30], [0, -1609, 0, 0, 225, 0, 0, -512, 652, -72], [44, 0, 694, -345, 0, -698, -601, 0, 0, 0], [0, 2314, 0, 0, 801, 0, 0, 1581, 79, -17], [0, 256, 0, 0, 172, 0, 0, 2759, 368, 292], [0, 677, 0, 0, 954, 0, 0, 2699, 402, -320], [0, 1975, 0, 0, -365, 0, 0, 391, -215, -443], [0, -1728, 0, 0, 653, 0, 0, 1007, 5, 101], [15638, 0, 364, -440, 0, -270, 112, 0, 0, 0], [2853, 0, 381, -324, 0, -670, -598, 0, 0, 0], [0, -2163, 0, 0, -1131, 0, 0, 328, -580, 64], [0, 1590, 0, 0, 758, 0, 0, 1791, -172, 190], [11507, 0, 511, -52, 0, -38, -126, 0, 0, 0], [3810, 0, -1208, 192, 0, 226, 684, 0, 0, 0], [0, 1237, 0, 0, 1201, 0, 0, 3380, -88, 148], [4189, 0, -349, -76, 0, 662, 413, 0, 0, 0], [7100, 0, -1306, 63, 0, 214, 447, 0, 0, 0], [0, -2452, 0, 0, -611, 0, 0, 1151, 213, 149], [0, 2615, 0, 0, 420, 0, 0, -1955, -626, -78], [0, -1931, 0, 0, -233, 0, 0, 793, 39, -69], [4777, 0, 151, -936, 0, -586, 197, 0, 0, 0], [0, -1598, 0, 0, 29, 0, 0, 1918, 172, 143], [0, 993, 0, 0, -593, 0, 0, -2297, 113, -107], [-3763, 0, -675, 492, 0, 586, -454, 0, 0, 0], [0, 821, 0, 0, -1603, 0, 0, 1362, -702, -499], [0, 2079, 0, 0, 119, 0, 0, 1209, 335, 363], [17947, 0, -113, 444, 0, 82, -30, 0, 0, 0], [0, -813, 0, 0, -665, 0, 0, -721, -295, 653], [-5399, 0, 707, -970, 0, -1058, -293, 0, 0, 0], [0, -2679, 0, 0, 1618, 0, 0, -1687, 90, 336], [13660, 0, -1335, 186, 0, 287, 263, 0, 0, 0], [0, 302, 0, 0, -713, 0, 0, 534, 170, -478], [-8826, 0, 256, 556, 0, 64, 148, 0, 0, 0], [0, 2863, 0, 0, 1321, 0, 0, -1924, 526, -243], [25989, 0, 873, 148, 0, 70, 558, 0, 0, 0], [0, -2338, 0, 0, 1500, 0, 0, -1429, 348, -176], [24430, 0, 391, 150, 0, -477, -147, 0, 0, 0], [1605, 0, 814, 934, 0, 205, -175, 0, 0, 0], [-708, 0, 238, -149, 0, 950, 555, 0, 0, 0], [4335, 0, 217, -87, 0, -1384, -674, 0, 0, 0], [0, -862, 0, 0, -341, 0, 0, -2712, -400, -1048], [0, -753, 0, 0, 461, 0, 0, 4240, -650, 161], [-8427, 0, -353, 910, 0, -18, 39, 0, 0, 0], [9667, 0, 1481, -784, 0, 344, -72, 0, 0, 0], [0, 2450, 0, 0, 622, 0, 0, 417, -1012, 542], [12008, 0, 450, -447, 0, 1350, -303, 0, 0, 0], [15853, 0, -343, 324, 0, 14, 1054, 0, 0, 0], [2236, 0, 84, 200, 0, 1160, -60, 0, 0, 0], [0, -158, 0, 0, 405, 0, 0, 2883, -471, -431], [-15176, 0, -710, -267, 0, 182, 549, 0, 0, 0], [0, -499, 0, 0, 261, 0, 0, -1578, 1070, -534], [0, 2237, 0, 0, 985, 0, 0, -3746, -358, -231], [0, 995, 0, 0, 5, 0, 0, -4316, -864, -76], [25643, 0, -466, 274, 0, 1159, -469, 0, 0, 0], [17715, 0, -1103, -697, 0, -856, 472, 0, 0, 0], [-794, 0, -219, 594, 0, -123, -257, 0, 0, 0], [15495, 0, -571, -41, 0, -1256, 116, 0, 0, 0], [0, -423, 0, 0, 244, 0, 0, 3231, -1078, -258], [0, 794, 0, 0, -1195, 0, 0, -3937, 1509, -11], [-14973, 0, 743, -196, 0, -1502, 58, 0, 0, 0], [0, 638, 0, 0, -347, 0, 0, -691, 343, -129], [-4312, 0, 308, 872, 0, -1532, 1052, 0, 0, 0], [0, -4300, 0, 0, 104, 0, 0, -3215, -632, -192], [0, 636, 0, 0, -1913, 0, 0, 2012, 756, -332], [-15845, 0, 369, -973, 0, -2248, -20, 0, 0, 0], [-58, 0, -1223, 298, 0, -1375, 315, 0, 0, 0], [0, 127, 0, 0, -447, 0, 0, 3372, 888, 332], [0, 77, 0, 0, 1739, 0, 0, 5807, -767, -227], [0, 4002, 0, 0, 238, 0, 0, -1689, -380, 326], [-8935, 0, -353, -376, 0, -962, -1059, 0, 0, 0], [20984, 0, -1026, 444, 0, -1406, -14, 0, 0, 0], [16418, 0, -988, 686, 0, 1008, -2, 0, 0, 0], [0, 3106, 0, 0, -84, 0, 0, -1845, -292, 464], [0, -691, 0, 0, -1781, 0, 0, 1038, 146, 783], [0, 2781, 0, 0, -1215, 0, 0, -3398, 106, 86], [0, -4730, 0, 0, -404, 0, 0, 497, -1532, 1240], [5663, 0, -195, 1927, 0, 1464, 332, 0, 0, 0], [8950, 0, -1640, 988, 0, -1736, 732, 0, 0, 0], [0, -2101, 0, 0, 2843, 0, 0, 3511, 1041, -91], [-27014, 0, 1016, 996, 0, 1784, -780, 0, 0, 0], [6371, 0, 1916, -18, 0, 1401, -211, 0, 0, 0], [0, 1880, 0, 0, 181, 0, 0, 5769, -309, -525], [-11130, 0, 320, 240, 0, -1090, 764, 0, 0, 0], [0, 1359, 0, 0, 2127, 0, 0, 3823, 849, -547], [2378, 0, 1684, 970, 0, -48, 50, 0, 0, 0], [0, 6330, 0, 0, -1901, 0, 0, -3600, 60, 873], [0, -3797, 0, 0, 541, 0, 0, 8568, -52, 48], [-21840, 0, 176, -1248, 0, -2816, -272, 0, 0, 0], [0, -3588, 0, 0, -3330, 0, 0, 867, 1208, -102], [36883, 0, 1621, -187, 0, 1336, -314, 0, 0, 0], [0, 696, 0, 0, -359, 0, 0, 3766, -664, -449], [-16808, 0, -94, -463, 0, 1142, -671, 0, 0, 0], [0, 1447, 0, 0, -1167, 0, 0, -2528, 828, -1672], [-40411, 0, -175, -732, 0, -322, -138, 0, 0, 0], [0, 7323, 0, 0, 3383, 0, 0, 4324, -322, 767], [17099, 0, -739, -1176, 0, -100, -748, 0, 0, 0], [4953, 0, 1651, 638, 0, 1038, -637, 0, 0, 0], [-11326, 0, 2194, -684, 0, 1456, -798, 0, 0, 0], [18064, 0, -1518, 1185, 0, -834, -495, 0, 0, 0], [17141, 0, 1901, -964, 0, -382, -1542, 0, 0, 0], [0, 6477, 0, 0, 4133, 0, 0, 7400, -340, 768], [0, -5130, 0, 0, 2995, 0, 0, -998, 502, 526], [-22179, 0, 324, 242, 0, 1111, 539, 0, 0, 0], [29748, 0, 1262, 707, 0, 1342, -93, 0, 0, 0], [-47298, 0, 514, 196, 0, -1652, -38, 0, 0, 0], [0, -8543, 0, 0, 189, 0, 0, 3452, -294, 261], [0, 1803, 0, 0, -497, 0, 0, 8407, 169, -171], [21439, 0, -463, -551, 0, -2128, -890, 0, 0, 0], [-2508, 0, 376, 2736, 0, 2604, 368, 0, 0, 0], [-11877, 0, 422, -1694, 0, -1089, 1283, 0, 0, 0], [0, 8260, 0, 0, 2648, 0, 0, 3659, 576, -328], [0, 1318, 0, 0, -357, 0, 0, 2876, -1404, 1300], [0, -845, 0, 0, 931, 0, 0, 3546, 174, 259], [-19344, 0, -1218, -196, 0, 282, -2014, 0, 0, 0], [-47741, 0, -887, 431, 0, 272, -216, 0, 0, 0], [0, -1230, 0, 0, -460, 0, 0, -565, -60, 704], [29622, 0, 2522, -1164, 0, -724, -1934, 0, 0, 0], [11552, 0, -1222, 989, 0, 2190, 45, 0, 0, 0], [0, 4231, 0, 0, 3677, 0, 0, 1418, -990, 918], [0, 7523, 0, 0, 2771, 0, 0, 3184, 534, -117], [14259, 0, 2537, 1680, 0, -312, 40, 0, 0, 0], [0, -3811, 0, 0, 3558, 0, 0, -2153, 826, 108], [0, 3545, 0, 0, -757, 0, 0, -5396, 1186, -1553], [-35397, 0, -1034, 2114, 0, 1839, 1379, 0, 0, 0], [0, 140, 0, 0, -4895, 0, 0, -1001, -1115, 461], [-28978, 0, -1512, -1264, 0, 1352, 136, 0, 0, 0], [1845, 0, -3617, 976, 0, -1912, 1144, 0, 0, 0], [-27460, 0, -669, 78, 0, 29, -1011, 0, 0, 0], [0, -7772, 0, 0, 3117, 0, 0, -1096, 1744, 147], [0, 664, 0, 0, -438, 0, 0, -5015, 504, -66], [-9070, 0, -838, -1372, 0, 504, 1370, 0, 0, 0], [0, -4469, 0, 0, -215, 0, 0, 4402, -1822, 190], [-35326, 0, -1388, -330, 0, 2128, -122, 0, 0, 0], [15851, 0, -904, -2282, 0, -1579, -367, 0, 0, 0], [-34381, 0, 1773, 1173, 0, -2976, 1454, 0, 0, 0], [0, 3872, 0, 0, 4299, 0, 0, 472, 1400, -920], [0, -5045, 0, 0, -6110, 0, 0, -3433, -642, -556], [0, 3243, 0, 0, -2915, 0, 0, -5074, -1258, -1326], [0, -2211, 0, 0, 992, 0, 0, 1147, 2418, -294], [0, -2870, 0, 0, -451, 0, 0, -3193, -107, -1731], [18565, 0, -1005, 604, 0, -3938, 1237, 0, 0, 0], [-33272, 0, 1642, -620, 0, 2038, -986, 0, 0, 0], [0, -6440, 0, 0, 2026, 0, 0, -6953, 792, 1150], [0, 8308, 0, 0, 7065, 0, 0, 4605, 1023, 767], [0, 5785, 0, 0, 1457, 0, 0, -4890, 2614, -790], [-12916, 0, 2310, -9, 0, 950, -89, 0, 0, 0], [0, 1072, 0, 0, -3107, 0, 0, 520, 704, -1245], [0, -5278, 0, 0, 1723, 0, 0, 4720, 1608, -64], [-5261, 0, -955, -1631, 0, -432, 1162, 0, 0, 0], [0, -5081, 0, 0, -5728, 0, 0, -1545, -1034, 686], [0, 2208, 0, 0, 233, 0, 0, 3725, -2545, -1617], [0, 164, 0, 0, 569, 0, 0, -3921, -2923, 1093], [0, -2079, 0, 0, -1889, 0, 0, 1506, -454, -637], [-44593, 0, 1485, -577, 0, 232, -988, 0, 0, 0], [25292, 0, 2234, -1372, 0, -358, 1262, 0, 0, 0], [-39618, 0, 460, -1870, 0, 2384, -526, 0, 0, 0], [-33683, 0, -1676, -1518, 0, 2103, 651, 0, 0, 0], [0, 4329, 0, 0, -4361, 0, 0, -1440, -1454, 1875], [0, -6817, 0, 0, 1203, 0, 0, 3667, -459, 1721], [54859, 0, 1173, 645, 0, -560, 1078, 0, 0, 0], [0, -4479, 0, 0, 297, 0, 0, -3552, -2182, -519], [14828, 0, -1319, -1846, 0, -3713, -25, 0, 0, 0], [18883, 0, -1678, 714, 0, 1387, -73, 0, 0, 0], [45893, 0, 832, -134, 0, 3859, -65, 0, 0, 0], [0, 10592, 0, 0, -4013, 0, 0, -6098, -654, 1226], [0, -4410, 0, 0, -1746, 0, 0, -351, -100, 670], [66798, 0, -2425, -1498, 0, -2493, 2333, 0, 0, 0], [35832, 0, -630, 2333, 0, -74, -147, 0, 0, 0], [0, 7779, 0, 0, -3529, 0, 0, 9175, 337, 197], [19325, 0, -1944, 1594, 0, -3805, 839, 0, 0, 0], [6666, 0, -1976, -80, 0, 2336, -792, 0, 0, 0], [0, -7462, 0, 0, -3693, 0, 0, 1800, 1080, -200], [0, 1051, 0, 0, -3581, 0, 0, 6050, 2166, -357], [19299, 0, -3763, -1111, 0, -1048, 234, 0, 0, 0], [0, 3872, 0, 0, -3057, 0, 0, -6720, 400, -863], [0, -2108, 0, 0, 2903, 0, 0, 14214, 1298, -30], [0, 12837, 0, 0, -157, 0, 0, 6295, -895, -955], [33236, 0, -1299, 1218, 0, -1533, -2029, 0, 0, 0], [0, -5063, 0, 0, 2521, 0, 0, -1560, -1484, -1296], [0, -3683, 0, 0, 747, 0, 0, -1564, 1098, -3113], [0, 2142, 0, 0, 1389, 0, 0, 16196, 1412, 1335], [-72091, 0, -3465, -1958, 0, -594, 35, 0, 0, 0], [0, 9264, 0, 0, -3499, 0, 0, 449, 1155, 1595], [6894, 0, 2963, 830, 0, -441, -623, 0, 0, 0], [0, 7471, 0, 0, -432, 0, 0, -583, -1274, 1358], [0, -2613, 0, 0, -2947, 0, 0, 9526, -2786, 89], [2692, 0, -1282, -1373, 0, -4386, -205, 0, 0, 0], [0, 4094, 0, 0, 6347, 0, 0, 1576, -2852, 225], [0, 4582, 0, 0, 3009, 0, 0, -4105, -3763, 61], [48061, 0, -1983, -236, 0, 3654, -138, 0, 0, 0], [0, 8284, 0, 0, -2467, 0, 0, 1759, 1973, -2251], [1950, 0, 1033, -342, 0, -2423, -3269, 0, 0, 0], [0, 2443, 0, 0, 2605, 0, 0, 10570, 450, -1194], [-380, 0, -2394, -273, 0, -2562, 479, 0, 0, 0], [0, 13868, 0, 0, 2063, 0, 0, -186, -1032, -1015], [17475, 0, -4205, 3764, 0, 774, 1006, 0, 0, 0], [6271, 0, -631, -775, 0, 2456, -34, 0, 0, 0], [0, -495, 0, 0, 4148, 0, 0, -13631, 298, -1346], [80576, 0, 3356, -2744, 0, 916, -748, 0, 0, 0], [-44182, 0, 4024, -44, 0, 648, -1308, 0, 0, 0], [67086, 0, 1664, -1464, 0, -3664, -2152, 0, 0, 0], [0, 3023, 0, 0, 3218, 0, 0, -5577, 2142, -1068], [-47263, 0, -433, -1028, 0, -18, -71, 0, 0, 0], [0, 10537, 0, 0, 5181, 0, 0, -2408, 388, -640], [-52028, 0, 336, 2416, 0, -2588, 1768, 0, 0, 0], [-29095, 0, -301, 1482, 0, 1782, -505, 0, 0, 0], [-30440, 0, 866, -39, 0, -378, 793, 0, 0, 0], [0, 4320, 0, 0, 1062, 0, 0, -16101, 2440, 434], [0, -12701, 0, 0, 4207, 0, 0, -17412, -1202, 151], [70628, 0, 1795, -1538, 0, -347, -2163, 0, 0, 0], [0, 6186, 0, 0, 4355, 0, 0, 5074, -1970, 1878], [0, 490, 0, 0, -2323, 0, 0, -6979, 3999, -545], [0, -7985, 0, 0, 881, 0, 0, -5862, 3842, 1254], [12600, 0, -274, -3284, 0, -5454, 1330, 0, 0, 0], [0, 13658, 0, 0, 5255, 0, 0, 19114, 1964, -1147], [0, 7866, 0, 0, -5804, 0, 0, -7125, -1820, -352], [0, 2261, 0, 0, -8202, 0, 0, 10117, -262, 508], [0, 4273, 0, 0, -6495, 0, 0, 5450, 554, 2086], [12242, 0, 1300, 2358, 0, 2816, 2406, 0, 0, 0], [-29265, 0, -3347, 1019, 0, 16, -1288, 0, 0, 0], [26426, 0, -2455, 1818, 0, 2709, 1251, 0, 0, 0], [0, 1109, 0, 0, 6237, 0, 0, -11878, -502, -778], [41509, 0, 3723, -3120, 0, 1982, -1399, 0, 0, 0], [0, -5836, 0, 0, -5931, 0, 0, -8605, -3023, 961], [58059, 0, 3582, -2414, 0, 1751, -1605, 0, 0, 0], [0, 9917, 0, 0, -1061, 0, 0, -11101, -123, 969], [0, -2242, 0, 0, -10466, 0, 0, 1983, -2116, -18], [0, -8090, 0, 0, -7493, 0, 0, -4422, -1410, -2466], [0, -2262, 0, 0, -4961, 0, 0, -17332, -1356, 2309], [25506, 0, -2842, 2236, 0, 2348, -1522, 0, 0, 0], [0, -6955, 0, 0, -4667, 0, 0, -7110, -2126, 518], [0, 2488, 0, 0, 188, 0, 0, 1645, -1960, 4268], [-34291, 0, 2367, -850, 0, 1446, -937, 0, 0, 0], [0, 9408, 0, 0, -3195, 0, 0, 2353, -3421, 491], [9270, 0, -348, -4744, 0, -3334, -1352, 0, 0, 0], [0, -3117, 0, 0, -4795, 0, 0, -14374, 618, -42], [-44913, 0, 1157, 971, 0, -1672, 1248, 0, 0, 0], [19140, 0, -1528, 576, 0, 5900, -176, 0, 0, 0], [0, 3280, 0, 0, -7970, 0, 0, 14813, 1424, 1874], [-31688, 0, 122, 2997, 0, 5622, 933, 0, 0, 0], [-62011, 0, 533, -1268, 0, -1366, 1762, 0, 0, 0], [0, 6292, 0, 0, 257, 0, 0, 2145, -1621, -2165], [48275, 0, -4059, 1269, 0, -3960, 2406, 0, 0, 0], [-18586, 0, -673, 1718, 0, -4573, 3157, 0, 0, 0], [0, -4739, 0, 0, -3780, 0, 0, -18633, -102, -2698], [0, -1966, 0, 0, 4004, 0, 0, 7785, -4092, -1904], [67007, 0, 1501, -5113, 0, -3528, -724, 0, 0, 0], [0, -9910, 0, 0, 1285, 0, 0, -19335, -2925, 51], [-89053, 0, 2154, -3430, 0, 1619, -529, 0, 0, 0], [-80279, 0, 3171, 30, 0, 1582, 435, 0, 0, 0], [0, -12148, 0, 0, 1823, 0, 0, 9614, 1808, 1473], [0, 5774, 0, 0, 2023, 0, 0, -4564, 3980, -2667], [-34294, 0, 4099, -2210, 0, 3747, -551, 0, 0, 0], [0, 209, 0, 0, 5555, 0, 0, 3453, -677, -2633], [90277, 0, -50, -1690, 0, 173, -4543, 0, 0, 0], [0, 8819, 0, 0, 4033, 0, 0, -22446, -1574, -2130], [0, 6823, 0, 0, -8648, 0, 0, -14647, -1730, 1902], [-14900, 0, 3067, 2654, 0, 2741, 2613, 0, 0, 0], [25306, 0, -5244, -958, 0, 960, 362, 0, 0, 0], [57664, 0, -534, 2197, 0, -530, 1733, 0, 0, 0], [-97515, 0, -6045, 2400, 0, -1610, 1617, 0, 0, 0], [0, -2205, 0, 0, -9411, 0, 0, 3860, -4888, -44], [-48443, 0, 2947, 816, 0, 5734, 321, 0, 0, 0], [-56675, 0, -3316, 3618, 0, 2191, 1731, 0, 0, 0], [24362, 0, 5540, 354, 0, -2128, 10, 0, 0, 0], [0, -7346, 0, 0, -1124, 0, 0, -19239, -4, -1360], [-63525, 0, 5936, -1914, 0, -8307, 73, 0, 0, 0], [25050, 0, -4943, -1142, 0, 6029, -1413, 0, 0, 0], [0, -1255, 0, 0, 7415, 0, 0, 1455, -415, -2019], [0, -1893, 0, 0, 3846, 0, 0, 18553, -2122, -2728], [-48392, 0, -4844, -1000, 0, -4332, -1364, 0, 0, 0], [35730, 0, 1328, 4012, 0, -7832, 820, 0, 0, 0], [0, -20304, 0, 0, 113, 0, 0, -6611, 2199, -1], [0, 4060, 0, 0, -5259, 0, 0, -6406, 872, 563], [0, -6165, 0, 0, 7330, 0, 0, 15279, -234, 1692], [12461, 0, -5783, 420, 0, 2958, 3870, 0, 0, 0], [39025, 0, 1159, -1108, 0, 230, -1791, 0, 0, 0], [31892, 0, 4088, -3664, 0, 9100, -3152, 0, 0, 0], [69137, 0, 6451, 638, 0, 422, -1549, 0, 0, 0], [0, 16800, 0, 0, 11280, 0, 0, 1891, 2720, -1584], [0, 1573, 0, 0, -341, 0, 0, -2935, 5775, 1307], [0, 6447, 0, 0, 2725, 0, 0, -6396, 4048, 2676], [-52380, 0, 6254, -5701, 0, -834, 1707, 0, 0, 0], [29358, 0, -1334, -2204, 0, -2828, -990, 0, 0, 0], [-32679, 0, 9003, -4254, 0, 5230, -1785, 0, 0, 0], [0, 20114, 0, 0, -7885, 0, 0, 4342, 2370, -1454], [-6373, 0, -6646, 938, 0, -4149, 2367, 0, 0, 0], [0, 2442, 0, 0, 11801, 0, 0, 15007, -1667, -1019], [-75344, 0, -1694, -3735, 0, -4450, 1145, 0, 0, 0], [0, 10709, 0, 0, 4406, 0, 0, -1529, 2714, -3940], [0, -1390, 0, 0, 11147, 0, 0, -6066, -284, -503], [-26578, 0, 5964, -638, 0, 1984, 1794, 0, 0, 0], [0, 3339, 0, 0, -3009, 0, 0, -9561, -4247, -1371], [0, -3311, 0, 0, -6168, 0, 0, 3819, 2394, 3354], [0, -16702, 0, 0, 5854, 0, 0, 2223, 4348, 4158], [-36985, 0, -3795, 4951, 0, 6896, 4924, 0, 0, 0], [0, -9282, 0, 0, -1719, 0, 0, -4113, 13, -2955], [-34176, 0, 2226, 132, 0, -8282, -914, 0, 0, 0], [50107, 0, 3194, 4234, 0, 6555, -65, 0, 0, 0], [108136, 0, 2010, -19, 0, -3082, 13, 0, 0, 0], [-106403, 0, 5003, 408, 0, 5076, -820, 0, 0, 0], [0, 1077, 0, 0, -705, 0, 0, -8559, 3111, -653], [0, 2194, 0, 0, 3449, 0, 0, -17155, -393, 431], [-96462, 0, 4791, 2486, 0, 1287, -3259, 0, 0, 0], [0, 8383, 0, 0, -4592, 0, 0, 14927, 542, -2410], [46301, 0, 5795, 4228, 0, 3062, 1549, 0, 0, 0], [0, 15408, 0, 0, 11533, 0, 0, -783, 2955, 1307], [0, 19509, 0, 0, 1813, 0, 0, 12436, -2502, 605], [29287, 0, 409, 565, 0, 10296, -1678, 0, 0, 0], [0, 14159, 0, 0, -41, 0, 0, -19932, -1298, -3329], [-17155, 0, -11315, -820, 0, 394, 2026, 0, 0, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_1024_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_1024_4_a_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_1024_4_a_n(:prec:=10)
    chi := MakeCharacter_1024_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 4));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(2999) - 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_1024_4_a_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_1024_4_a_n( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_1024_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,4,sign)));
    Vf := Kernel([<3,R![-829472, 0, 893712, 0, -157552, 0, 8504, 0, -162, 0, 1]>,<5,R![-202085408, 0, 291758672, 0, -11484496, 0, 138664, 0, -650, 0, 1]>,<7,R![44000, -46736, 13376, -736, -14, 1]>],Snew);
    return Vf;
end function;