
// Make newform 1024.4.b.j in Magma, downloaded from the LMFDB on 19 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_1024_b();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_1024_b_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_1024_4_b_j();".
// 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_b_j();".
// 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], [-18656, 0, -112562, 0, -33651, 0, -2994, 0, -83, 0], [35856, 0, 277098, 0, 86919, 0, 8042, 0, 231, 0], [0, 18896, 0, 278022, 0, 85849, 0, 7750, 0, 217], [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, 208, 416, 832, 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_b();"
function MakeCharacter_1024_b()
    N := 1024;
    order := 2;
    char_gens := [1023, 5];
    v := [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_1024_b_Hecke();"
function MakeCharacter_1024_b_Hecke(Kf)
    N := 1024;
    order := 2;
    char_gens := [1023, 5];
    char_values := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-1, 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, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, -1, 0, 0, 0], [-3, 0, -1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -1, 0, 0, 1], [0, 0, 0, 0, 0, 0, -1, 3, 1, -1], [0, 0, 2, -1, -2, 1, 0, 0, 0, 0], [0, -1, 0, 0, 0, 0, 5, -2, 2, 1], [-29, 0, -2, -2, -1, 3, 0, 0, 0, 0], [0, 3, 0, 0, 0, 0, -1, 18, 2, 2], [36, 0, -3, -2, 3, 3, 0, 0, 0, 0], [0, 2, 0, 0, 0, 0, 1, -29, 1, -1], [-1, 0, 1, 4, -14, -1, 0, 0, 0, 0], [0, -20, 0, 0, 0, 0, -12, 1, 0, -4], [90, 0, -7, -10, 5, 3, 0, 0, 0, 0], [0, -3, 0, 0, 0, 0, -1, -35, -13, -7], [0, -41, 0, 0, 0, 0, 18, -5, -14, 4], [0, -19, 0, 0, 0, 0, 1, 41, -9, -11], [0, -50, 0, 0, 0, 0, -11, -10, 12, -1], [-347, 0, 10, 2, -15, -3, 0, 0, 0, 0], [29, 0, 11, 1, -16, 6, 0, 0, 0, 0], [446, 0, 12, 8, -6, -16, 0, 0, 0, 0], [0, -71, 0, 0, 0, 0, -48, 9, 22, 2], [-15, 0, -25, 1, -8, 26, 0, 0, 0, 0], [4, 0, 14, -3, 14, -29, 0, 0, 0, 0], [0, 38, 0, 0, 0, 0, -11, 73, -13, -3], [-691, 0, 0, -10, 43, -25, 0, 0, 0, 0], [0, -110, 0, 0, 0, 0, 45, 10, 12, 23], [0, -6, 0, 0, 0, 0, -11, -88, 32, -8], [78, 0, 60, -14, 24, -10, 0, 0, 0, 0], [744, 0, 11, -30, -79, -3, 0, 0, 0, 0], [0, -154, 0, 0, 0, 0, -23, 50, 4, 3], [-165, 0, -63, 2, 42, -3, 0, 0, 0, 0], [0, -206, 0, 0, 0, 0, -86, 35, -20, -6], [0, -93, 0, 0, 0, 0, 1, 204, -16, -28], [-917, 0, 24, 74, -123, -7, 0, 0, 0, 0], [0, 143, 0, 0, 0, 0, -59, -153, -7, -37], [0, -238, 0, 0, 0, 0, 136, -59, 20, -28], [-1059, 0, 27, 40, 52, 52, 0, 0, 0, 0], [0, -58, 0, 0, 0, 0, 47, -193, -75, 11], [0, -181, 0, 0, 0, 0, -12, 137, -6, -38], [0, 149, 0, 0, 0, 0, -71, 260, -24, 60], [1208, 0, -75, 14, -177, 51, 0, 0, 0, 0], [-652, 0, -90, -79, 14, 31, 0, 0, 0, 0], [0, -256, 0, 0, 0, 0, 159, 36, -60, 36], [-1107, 0, 49, -52, -74, -2, 0, 0, 0, 0], [0, -179, 0, 0, 0, 0, 182, 63, -50, 68], [948, 0, 137, -10, 183, -25, 0, 0, 0, 0], [0, -6, 0, 0, 0, 0, -132, 97, 44, 72], [0, 334, 0, 0, 0, 0, -101, 18, 14, -22], [-407, 0, -97, -47, -72, -14, 0, 0, 0, 0], [1578, 0, 116, 56, 14, 32, 0, 0, 0, 0], [-144, 0, 10, 99, -210, 29, 0, 0, 0, 0], [0, 107, 0, 0, 0, 0, 92, 221, 130, -38], [1066, 0, 148, 134, -144, -62, 0, 0, 0, 0], [-731, 0, -100, 46, -105, -37, 0, 0, 0, 0], [0, 96, 0, 0, 0, 0, -251, 260, 20, -28], [-74, 0, 55, 122, -69, -131, 0, 0, 0, 0], [0, -333, 0, 0, 0, 0, 59, -317, 85, -9], [-751, 0, -61, 107, -288, -88, 0, 0, 0, 0], [0, -73, 0, 0, 0, 0, 81, -298, -70, -19], [0, 614, 0, 0, 0, 0, 103, -112, -48, -16], [0, 169, 0, 0, 0, 0, -45, 384, 102, -49], [227, 0, -85, 156, -2, -34, 0, 0, 0, 0], [-685, 0, -291, -120, -158, 135, 0, 0, 0, 0], [0, -819, 0, 0, 0, 0, 251, 120, 52, -32], [0, 192, 0, 0, 0, 0, -185, 32, -72, -111], [-18, 0, -8, -144, -56, -88, 0, 0, 0, 0], [0, 673, 0, 0, 0, 0, 158, 451, -106, 20], [0, 1067, 0, 0, 0, 0, 151, -142, 138, -14], [-318, 0, -44, -118, -144, 198, 0, 0, 0, 0], [525, 0, -164, -66, -33, 139, 0, 0, 0, 0], [-3830, 0, 153, -282, 117, 51, 0, 0, 0, 0], [0, 533, 0, 0, 0, 0, 343, 429, -213, -167], [0, 399, 0, 0, 0, 0, -262, 619, -134, -28], [-888, 0, 106, 172, -10, 102, 0, 0, 0, 0], [0, -1080, 0, 0, 0, 0, -335, 347, 81, 71], [0, 200, 0, 0, 0, 0, -471, -206, -242, -22], [-160, 0, 42, 315, -242, -107, 0, 0, 0, 0], [-953, 0, 417, -160, 82, -101, 0, 0, 0, 0], [0, 1080, 0, 0, 0, 0, 179, -264, -64, -19], [0, 1078, 0, 0, 0, 0, 331, 1062, -174, -98], [-918, 0, -312, 288, -54, 28, 0, 0, 0, 0], [680, 0, -86, -245, 182, 117, 0, 0, 0, 0], [2587, 0, -459, -376, -188, 68, 0, 0, 0, 0], [0, 993, 0, 0, 0, 0, -47, -926, -66, -23], [-2860, 0, -290, 77, 78, -221, 0, 0, 0, 0], [2803, 0, 5, 108, 322, -221, 0, 0, 0, 0], [0, 200, 0, 0, 0, 0, 729, -1914, 114, -98], [-5290, 0, 226, 220, -156, 138, 0, 0, 0, 0], [0, 1479, 0, 0, 0, 0, -213, 572, 434, 43], [-28, 0, 257, 70, -305, 15, 0, 0, 0, 0], [6661, 0, -109, 488, -380, -36, 0, 0, 0, 0], [0, 1420, 0, 0, 0, 0, 6, 1675, -288, 10], [0, 187, 0, 0, 0, 0, 70, -1373, -86, -264], [1123, 0, 170, -122, -509, 167, 0, 0, 0, 0], [0, -1643, 0, 0, 0, 0, -775, -735, 311, 61], [-3997, 0, -15, -118, -334, 165, 0, 0, 0, 0], [0, 36, 0, 0, 0, 0, 685, -338, -56, 11], [0, 1975, 0, 0, 0, 0, -327, -1603, -117, -151], [0, 280, 0, 0, 0, 0, -267, -486, -248, 275], [0, -194, 0, 0, 0, 0, -165, 393, 163, -163], [0, 641, 0, 0, 0, 0, -423, 1526, -594, -111], [2491, 0, 441, -230, 194, -179, 0, 0, 0, 0], [0, 17, 0, 0, 0, 0, 1053, -1378, -290, -131], [-2206, 0, 192, 236, -232, 476, 0, 0, 0, 0], [0, 1340, 0, 0, 0, 0, 253, -234, 256, -13], [3350, 0, -136, 68, -104, 92, 0, 0, 0, 0], [-3341, 0, 73, 48, 728, -192, 0, 0, 0, 0], [1761, 0, -465, -155, -440, 54, 0, 0, 0, 0], [-1452, 0, -68, 408, -616, -132, 0, 0, 0, 0], [0, 1746, 0, 0, 0, 0, 83, -622, -218, 154], [3081, 0, 403, 307, -264, -176, 0, 0, 0, 0], [0, -642, 0, 0, 0, 0, 843, 1512, 308, -335], [-5, 0, -332, -78, -727, 141, 0, 0, 0, 0], [1644, 0, -506, -391, -682, 87, 0, 0, 0, 0], [0, -1014, 0, 0, 0, 0, -455, 1682, 68, 195], [-8387, 0, 318, 42, 197, 41, 0, 0, 0, 0], [0, 296, 0, 0, 0, 0, -611, 472, -112, 392], [0, 1069, 0, 0, 0, 0, -308, -563, 318, 30], [0, -1609, 0, 0, 0, 0, 225, 512, -652, -72], [44, 0, 694, 345, -698, -601, 0, 0, 0, 0], [0, 2314, 0, 0, 0, 0, 801, -1581, -79, -17], [0, 256, 0, 0, 0, 0, 172, -2759, -368, 292], [0, -677, 0, 0, 0, 0, -954, 2699, 402, 320], [0, -1975, 0, 0, 0, 0, 365, 391, -215, 443], [0, -1728, 0, 0, 0, 0, 653, -1007, -5, 101], [15638, 0, 364, 440, -270, 112, 0, 0, 0, 0], [-2853, 0, -381, -324, 670, 598, 0, 0, 0, 0], [0, 2163, 0, 0, 0, 0, 1131, 328, -580, -64], [0, -1590, 0, 0, 0, 0, -758, 1791, -172, -190], [-11507, 0, -511, -52, 38, 126, 0, 0, 0, 0], [3810, 0, -1208, -192, 226, 684, 0, 0, 0, 0], [0, 1237, 0, 0, 0, 0, 1201, -3380, 88, 148], [-4189, 0, 349, -76, -662, -413, 0, 0, 0, 0], [7100, 0, -1306, -63, 214, 447, 0, 0, 0, 0], [0, -2452, 0, 0, 0, 0, -611, -1151, -213, 149], [0, -2615, 0, 0, 0, 0, -420, -1955, -626, 78], [0, 1931, 0, 0, 0, 0, 233, 793, 39, 69], [-4777, 0, -151, -936, 586, -197, 0, 0, 0, 0], [0, -1598, 0, 0, 0, 0, 29, -1918, -172, 143], [0, 993, 0, 0, 0, 0, -593, 2297, -113, -107], [3763, 0, 675, 492, -586, 454, 0, 0, 0, 0], [0, 821, 0, 0, 0, 0, -1603, -1362, 702, -499], [0, -2079, 0, 0, 0, 0, -119, 1209, 335, -363], [-17947, 0, 113, 444, -82, 30, 0, 0, 0, 0], [0, -813, 0, 0, 0, 0, -665, 721, 295, 653], [5399, 0, -707, -970, 1058, 293, 0, 0, 0, 0], [0, -2679, 0, 0, 0, 0, 1618, 1687, -90, 336], [13660, 0, -1335, -186, 287, 263, 0, 0, 0, 0], [0, -302, 0, 0, 0, 0, 713, 534, 170, 478], [-8826, 0, 256, -556, 64, 148, 0, 0, 0, 0], [0, -2863, 0, 0, 0, 0, -1321, -1924, 526, 243], [-25989, 0, -873, 148, -70, -558, 0, 0, 0, 0], [0, -2338, 0, 0, 0, 0, 1500, 1429, -348, -176], [24430, 0, 391, -150, -477, -147, 0, 0, 0, 0], [-1605, 0, -814, 934, -205, 175, 0, 0, 0, 0], [-708, 0, 238, 149, 950, 555, 0, 0, 0, 0], [-4335, 0, -217, -87, 1384, 674, 0, 0, 0, 0], [0, 862, 0, 0, 0, 0, 341, -2712, -400, 1048], [0, 753, 0, 0, 0, 0, -461, 4240, -650, -161], [8427, 0, 353, 910, 18, -39, 0, 0, 0, 0], [-9667, 0, -1481, -784, -344, 72, 0, 0, 0, 0], [0, 2450, 0, 0, 0, 0, 622, -417, 1012, 542], [12008, 0, 450, 447, 1350, -303, 0, 0, 0, 0], [-15853, 0, 343, 324, -14, -1054, 0, 0, 0, 0], [2236, 0, 84, -200, 1160, -60, 0, 0, 0, 0], [0, -158, 0, 0, 0, 0, 405, -2883, 471, -431], [-15176, 0, -710, 267, 182, 549, 0, 0, 0, 0], [0, -499, 0, 0, 0, 0, 261, 1578, -1070, -534], [0, 2237, 0, 0, 0, 0, 985, 3746, 358, -231], [0, -995, 0, 0, 0, 0, -5, -4316, -864, 76], [-25643, 0, 466, 274, -1159, 469, 0, 0, 0, 0], [-17715, 0, 1103, -697, 856, -472, 0, 0, 0, 0], [-794, 0, -219, -594, -123, -257, 0, 0, 0, 0], [-15495, 0, 571, -41, 1256, -116, 0, 0, 0, 0], [0, -423, 0, 0, 0, 0, 244, -3231, 1078, -258], [0, 794, 0, 0, 0, 0, -1195, 3937, -1509, -11], [14973, 0, -743, -196, 1502, -58, 0, 0, 0, 0], [0, -638, 0, 0, 0, 0, 347, -691, 343, 129], [-4312, 0, 308, -872, -1532, 1052, 0, 0, 0, 0], [0, 4300, 0, 0, 0, 0, -104, -3215, -632, 192], [0, 636, 0, 0, 0, 0, -1913, -2012, -756, -332], [15845, 0, -369, -973, 2248, 20, 0, 0, 0, 0], [-58, 0, -1223, -298, -1375, 315, 0, 0, 0, 0], [0, 127, 0, 0, 0, 0, -447, -3372, -888, 332], [0, -77, 0, 0, 0, 0, -1739, 5807, -767, 227], [0, -4002, 0, 0, 0, 0, -238, -1689, -380, -326], [8935, 0, 353, -376, 962, 1059, 0, 0, 0, 0], [20984, 0, -1026, -444, -1406, -14, 0, 0, 0, 0], [16418, 0, -988, -686, 1008, -2, 0, 0, 0, 0], [0, 3106, 0, 0, 0, 0, -84, 1845, 292, 464], [0, 691, 0, 0, 0, 0, 1781, 1038, 146, -783], [0, -2781, 0, 0, 0, 0, 1215, -3398, 106, -86], [0, 4730, 0, 0, 0, 0, 404, 497, -1532, -1240], [-5663, 0, 195, 1927, -1464, -332, 0, 0, 0, 0], [8950, 0, -1640, -988, -1736, 732, 0, 0, 0, 0], [0, 2101, 0, 0, 0, 0, -2843, 3511, 1041, 91], [-27014, 0, 1016, -996, 1784, -780, 0, 0, 0, 0], [-6371, 0, -1916, -18, -1401, 211, 0, 0, 0, 0], [0, -1880, 0, 0, 0, 0, -181, 5769, -309, 525], [-11130, 0, 320, -240, -1090, 764, 0, 0, 0, 0], [0, 1359, 0, 0, 0, 0, 2127, -3823, -849, -547], [2378, 0, 1684, -970, -48, 50, 0, 0, 0, 0], [0, 6330, 0, 0, 0, 0, -1901, 3600, -60, 873], [0, 3797, 0, 0, 0, 0, -541, 8568, -52, -48], [-21840, 0, 176, 1248, -2816, -272, 0, 0, 0, 0], [0, 3588, 0, 0, 0, 0, 3330, 867, 1208, 102], [-36883, 0, -1621, -187, -1336, 314, 0, 0, 0, 0], [0, 696, 0, 0, 0, 0, -359, -3766, 664, -449], [-16808, 0, -94, 463, 1142, -671, 0, 0, 0, 0], [0, 1447, 0, 0, 0, 0, -1167, 2528, -828, -1672], [40411, 0, 175, -732, 322, 138, 0, 0, 0, 0], [0, 7323, 0, 0, 0, 0, 3383, -4324, 322, 767], [-17099, 0, 739, -1176, 100, 748, 0, 0, 0, 0], [-4953, 0, -1651, 638, -1038, 637, 0, 0, 0, 0], [-11326, 0, 2194, 684, 1456, -798, 0, 0, 0, 0], [18064, 0, -1518, -1185, -834, -495, 0, 0, 0, 0], [-17141, 0, -1901, -964, 382, 1542, 0, 0, 0, 0], [0, -6477, 0, 0, 0, 0, -4133, 7400, -340, -768], [0, -5130, 0, 0, 0, 0, 2995, 998, -502, 526], [22179, 0, -324, 242, -1111, -539, 0, 0, 0, 0], [29748, 0, 1262, -707, 1342, -93, 0, 0, 0, 0], [-47298, 0, 514, -196, -1652, -38, 0, 0, 0, 0], [0, 8543, 0, 0, 0, 0, -189, 3452, -294, -261], [0, 1803, 0, 0, 0, 0, -497, -8407, -169, -171], [-21439, 0, 463, -551, 2128, 890, 0, 0, 0, 0], [-2508, 0, 376, -2736, 2604, 368, 0, 0, 0, 0], [11877, 0, -422, -1694, 1089, -1283, 0, 0, 0, 0], [0, 8260, 0, 0, 0, 0, 2648, -3659, -576, -328], [0, -1318, 0, 0, 0, 0, 357, 2876, -1404, -1300], [0, 845, 0, 0, 0, 0, -931, 3546, 174, -259], [-19344, 0, -1218, 196, 282, -2014, 0, 0, 0, 0], [47741, 0, 887, 431, -272, 216, 0, 0, 0, 0], [0, -1230, 0, 0, 0, 0, -460, 565, 60, 704], [29622, 0, 2522, 1164, -724, -1934, 0, 0, 0, 0], [11552, 0, -1222, -989, 2190, 45, 0, 0, 0, 0], [0, 4231, 0, 0, 0, 0, 3677, -1418, 990, 918], [0, 7523, 0, 0, 0, 0, 2771, -3184, -534, -117], [-14259, 0, -2537, 1680, 312, -40, 0, 0, 0, 0], [0, 3811, 0, 0, 0, 0, -3558, -2153, 826, -108], [0, 3545, 0, 0, 0, 0, -757, 5396, -1186, -1553], [35397, 0, 1034, 2114, -1839, -1379, 0, 0, 0, 0], [0, -140, 0, 0, 0, 0, 4895, -1001, -1115, -461], [-28978, 0, -1512, 1264, 1352, 136, 0, 0, 0, 0], [-1845, 0, 3617, 976, 1912, -1144, 0, 0, 0, 0], [-27460, 0, -669, -78, 29, -1011, 0, 0, 0, 0], [0, 7772, 0, 0, 0, 0, -3117, -1096, 1744, -147], [0, 664, 0, 0, 0, 0, -438, 5015, -504, -66], [-9070, 0, -838, 1372, 504, 1370, 0, 0, 0, 0], [0, 4469, 0, 0, 0, 0, 215, 4402, -1822, -190], [-35326, 0, -1388, 330, 2128, -122, 0, 0, 0, 0], [-15851, 0, 904, -2282, 1579, 367, 0, 0, 0, 0], [34381, 0, -1773, 1173, 2976, -1454, 0, 0, 0, 0], [0, -3872, 0, 0, 0, 0, -4299, 472, 1400, 920], [0, 5045, 0, 0, 0, 0, 6110, -3433, -642, 556], [0, 3243, 0, 0, 0, 0, -2915, 5074, 1258, -1326], [0, -2211, 0, 0, 0, 0, 992, -1147, -2418, -294], [0, -2870, 0, 0, 0, 0, -451, 3193, 107, -1731], [-18565, 0, 1005, 604, 3938, -1237, 0, 0, 0, 0], [-33272, 0, 1642, 620, 2038, -986, 0, 0, 0, 0], [0, 6440, 0, 0, 0, 0, -2026, -6953, 792, -1150], [0, 8308, 0, 0, 0, 0, 7065, -4605, -1023, 767], [0, -5785, 0, 0, 0, 0, -1457, -4890, 2614, 790], [-12916, 0, 2310, 9, 950, -89, 0, 0, 0, 0], [0, -1072, 0, 0, 0, 0, 3107, 520, 704, 1245], [0, 5278, 0, 0, 0, 0, -1723, 4720, 1608, 64], [5261, 0, 955, -1631, 432, -1162, 0, 0, 0, 0], [0, -5081, 0, 0, 0, 0, -5728, 1545, 1034, 686], [0, 2208, 0, 0, 0, 0, 233, -3725, 2545, -1617], [0, -164, 0, 0, 0, 0, -569, -3921, -2923, -1093], [0, 2079, 0, 0, 0, 0, 1889, 1506, -454, 637], [44593, 0, -1485, -577, -232, 988, 0, 0, 0, 0], [25292, 0, 2234, 1372, -358, 1262, 0, 0, 0, 0], [-39618, 0, 460, 1870, 2384, -526, 0, 0, 0, 0], [33683, 0, 1676, -1518, -2103, -651, 0, 0, 0, 0], [0, 4329, 0, 0, 0, 0, -4361, 1440, 1454, 1875], [0, 6817, 0, 0, 0, 0, -1203, 3667, -459, -1721], [-54859, 0, -1173, 645, 560, -1078, 0, 0, 0, 0], [0, 4479, 0, 0, 0, 0, -297, -3552, -2182, 519], [14828, 0, -1319, 1846, -3713, -25, 0, 0, 0, 0], [-18883, 0, 1678, 714, -1387, 73, 0, 0, 0, 0], [-45893, 0, -832, -134, -3859, 65, 0, 0, 0, 0], [0, 10592, 0, 0, 0, 0, -4013, 6098, 654, 1226], [0, -4410, 0, 0, 0, 0, -1746, 351, 100, 670], [66798, 0, -2425, 1498, -2493, 2333, 0, 0, 0, 0], [35832, 0, -630, -2333, -74, -147, 0, 0, 0, 0], [0, 7779, 0, 0, 0, 0, -3529, -9175, -337, 197], [-19325, 0, 1944, 1594, 3805, -839, 0, 0, 0, 0], [6666, 0, -1976, 80, 2336, -792, 0, 0, 0, 0], [0, 7462, 0, 0, 0, 0, 3693, 1800, 1080, 200], [0, -1051, 0, 0, 0, 0, 3581, 6050, 2166, 357], [-19299, 0, 3763, -1111, 1048, -234, 0, 0, 0, 0], [0, 3872, 0, 0, 0, 0, -3057, 6720, -400, -863], [0, 2108, 0, 0, 0, 0, -2903, 14214, 1298, 30], [0, -12837, 0, 0, 0, 0, 157, 6295, -895, 955], [33236, 0, -1299, -1218, -1533, -2029, 0, 0, 0, 0], [0, -5063, 0, 0, 0, 0, 2521, 1560, 1484, -1296], [0, -3683, 0, 0, 0, 0, 747, 1564, -1098, -3113], [0, -2142, 0, 0, 0, 0, -1389, 16196, 1412, -1335], [72091, 0, 3465, -1958, 594, -35, 0, 0, 0, 0], [0, -9264, 0, 0, 0, 0, 3499, 449, 1155, -1595], [6894, 0, 2963, -830, -441, -623, 0, 0, 0, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_1024_b_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_1024_4_b_j();".
// 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_b_j(:prec:=10)
    chi := MakeCharacter_1024_b();
    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_1024_4_b_j();".
// 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_b_j( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_1024_b();
    // 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;