
// Make newform 1521.4.a.be in Magma, downloaded from the LMFDB on 20 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_1521_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_1521_4_a_be();".
// 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_1521_4_a_be();".
// 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 := [5144, 9428, -966, -4745, -150, 772, 29, -48, -1, 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, 1, 0, 0, 0, 0, 0, 0, 0], [513836, 1425628, -58625, -334818, -27838, 27181, 1734, -719, -3], [-2502316, -1425628, 257473, 334818, 27838, -27181, -1734, 719, 3], [3265492, -623892, -2016507, 170474, 248606, -16209, -10310, 483, 127], [-168892, -606900, -558855, 389090, 139382, -35013, -8974, 831, 171], [2264092, 3151596, -82469, -860826, -141702, 61649, 14878, -1291, -383], [2379924, 1774556, -2400467, -772630, 493806, 79991, -33670, -2293, 743], [-1800516, -2318484, 1205827, 771566, -300654, -67775, 24206, 1757, -591]];
    Rf_basisdens := [1, 1, 198848, 198848, 198848, 198848, 198848, 198848, 99424];
    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_1521_a();"
function MakeCharacter_1521_a()
    N := 1521;
    order := 1;
    char_gens := [677, 847];
    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_1521_a_Hecke(Kf)
    return MakeCharacter_1521_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 := [[-1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [-5, 3, 0, 0, 0, -1, -1, 2, -1], [1, -1, 0, -2, 1, -1, -2, 1, 2], [-2, 0, 2, -4, 1, 3, -1, -2, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [10, 5, 1, 0, -2, 2, 1, 10, -5], [-8, 1, 7, 8, 2, -6, 3, -8, -9], [-31, 11, -1, -5, -9, 3, 0, -2, 14], [52, 18, 6, 11, -12, -11, -2, -9, 4], [-52, -2, 4, 5, 4, 5, -22, 9, -6], [82, 7, -21, -15, 11, 2, 12, 1, -17], [-41, -58, 8, -5, 9, 19, -11, 14, -19], [10, -40, -6, -5, -17, -30, -3, 15, 16], [-148, -59, 9, 32, 28, 22, 21, -58, -3], [-157, 28, -29, -26, -30, -23, 4, 14, 6], [-214, -18, -11, 29, -16, 10, 38, 25, 20], [280, -81, -3, -42, 6, 34, -25, -22, -1], [35, 69, -45, -20, 22, 63, 67, -25, 2], [-241, 12, -34, 48, 4, 15, -34, -49, 47], [131, -125, -22, 8, -22, 67, 17, -62, 9], [-7, 111, -38, -53, 20, -55, 55, -36, 44], [-150, -43, 32, -58, -29, -58, -44, 54, 35], [-307, -55, -35, 40, -66, -9, 105, -59, 40], [194, 80, 29, -16, -4, -8, 12, 9, 55], [73, 1, -30, -94, 45, -93, -30, 119, -72], [-310, 144, 73, 41, -45, -184, -49, -40, -35], [69, -208, -45, 40, 13, 55, -57, -77, 43], [185, -126, 214, 81, -21, -133, -137, -16, -37], [366, -57, -177, -17, -3, -2, 148, 11, 53], [300, 196, 47, 42, 60, -44, -78, 195, -181], [-397, -410, 47, 171, -33, 9, 159, -213, 8], [-378, -128, -98, -113, -143, 44, 151, -91, 280], [-391, 56, -126, 13, -53, 129, -15, 48, 163], [-436, -33, 21, 57, 58, -165, -133, -1, 103], [-1154, -127, 109, -66, -47, 57, 64, 106, -125], [-130, -130, 252, 263, -55, 96, 127, -133, -66], [-503, -31, 29, -24, -142, -151, 115, 83, -62], [78, -278, 254, 7, 203, -20, -271, 45, -86], [-344, -444, 8, 171, -154, 255, 22, -125, 82], [247, -271, 440, 102, 62, 73, 233, -142, -197], [259, 229, -165, 8, 98, -91, 79, -113, 114], [1395, 111, -219, -140, 110, 263, 15, -215, -86], [1562, -202, 54, 71, 117, 186, 339, 163, -314], [-2050, -83, -208, 106, 69, 88, 238, -40, 75], [1306, -145, 103, -55, 52, 11, 51, -229, -17], [-201, 280, -62, -226, -118, 187, -46, 213, -181], [-419, 448, 200, 57, 215, -169, -351, 0, -141], [-398, -134, -119, -76, 328, 314, 298, -57, -79], [765, 24, 38, -178, 52, -85, 106, 23, 483], [1028, 513, 71, -54, -100, 206, -105, 294, -123], [-1372, 123, -157, -233, -173, -110, -318, 151, 95], [-1627, 671, -220, -79, 49, 183, -64, 311, -215], [-1606, -81, -20, 299, -128, 176, 31, -63, 41], [-1511, 189, -15, 16, 364, 77, 31, -103, -172], [479, 75, 283, 50, 116, -167, -43, -413, -98], [574, 447, -266, 227, -69, 208, 136, -324, 182], [-1540, -481, -64, 126, 106, 102, 319, -445, -28], [-1319, 324, -22, 541, 287, 505, -7, 80, -71], [-2295, 325, 219, -199, -23, -303, 62, -2, -490], [916, -61, 461, 12, 202, -124, -667, -114, 183], [-4228, 67, -181, 32, -79, 459, 136, -78, 65], [-709, 226, 544, 574, -86, -559, 168, -45, -25], [135, 843, -1103, -838, -126, -373, 35, 457, 788], [1408, 139, 324, 349, 325, 94, 286, 0, -340], [-3437, -15, 34, -405, -398, 307, 381, -306, 116], [-963, 904, -748, -833, 35, -61, -55, 372, 1], [-1648, 774, -388, -75, -562, 445, 246, -73, 318], [1150, 15, 140, 108, 251, -762, -290, -272, 277], [-680, -584, 630, 92, 464, -156, -912, 54, -298], [-4073, -131, 641, 268, 104, -21, -113, 395, -94], [-963, 761, -553, -112, 32, -467, -217, 133, 668], [-569, 875, 470, 589, -350, 139, 353, -728, -82], [1341, 300, -194, 837, -335, -21, -325, 120, -271], [340, -853, 293, 151, -275, -200, -46, 469, 59], [-1769, -517, 685, -130, -154, -909, -269, -363, 468], [-75, 1436, -70, -50, 185, -474, 79, -73, 103], [3346, -163, -829, 248, 200, 924, 211, -434, 635], [-823, 102, -1052, -876, -348, -605, 334, 391, 655], [911, 919, -244, -14, 453, 591, 660, 307, -308], [1469, 364, -426, -18, 249, 1416, 861, 21, -411], [1400, 1901, -1181, -1378, -10, -502, -103, -2, 605], [-1343, -537, 105, 470, -542, -141, -85, 25, 172], [-1691, 905, 299, 167, -114, 148, 281, 140, -154], [-367, -48, -615, 741, 36, -389, 320, -430, -313], [1141, 225, -167, 559, -102, -312, -777, -446, 974], [-3638, 1639, -115, -696, -132, -56, 505, 508, -401], [2968, -655, 899, 718, 243, 1233, 388, -564, -91], [-4688, -262, -663, 252, -671, 188, -167, 874, 664], [1608, 904, -492, 1176, -192, 524, 368, -228, 56], [-2206, -360, 889, 454, -282, -262, -862, 171, -131], [-2464, 157, -645, 1003, 353, 1634, -114, 295, -187], [100, 1744, -119, -70, -776, -1436, 282, -551, 433], [3338, 676, -630, -606, -855, -1059, -57, 396, 724], [2044, -1634, 350, 1298, -18, -32, -44, 630, -38], [-2013, -841, 349, -795, 1059, 163, -872, 400, 734], [-1704, -392, 824, 944, 248, 446, -864, -238, 230], [-756, 976, 110, 1393, 791, -644, -415, 735, -1556], [-3125, -1143, 427, -767, -125, 47, -706, 592, -410], [4673, -358, 106, 683, 739, 825, -553, 178, -273], [1642, -2531, 2723, 1503, 361, -270, -528, -273, -1781], [135, -470, 610, 1384, 230, 1081, 68, -1827, -515], [-5980, -485, 1268, -696, 264, -486, -261, 1233, 318], [-99, 3972, -302, 1027, -505, -601, 585, -308, 213], [2165, 605, -1413, -543, -183, -869, 52, -162, 1468], [1122, -3927, 1594, 1254, 337, -58, 1080, -2432, 621], [7703, 2066, -2362, -2443, -1112, -948, 746, 1444, 389], [336, 284, -780, 1190, 1182, 414, -150, -1072, -2], [3745, -707, 1399, -390, 1368, 301, -2141, -239, -1070], [-2139, 1708, 494, -12, 945, 374, 53, -1399, -515], [395, -1284, -963, -561, 1286, 2129, 938, -754, -1875], [5888, -2489, 119, -479, 483, 746, -1244, -31, 887], [-1132, 680, 1218, 916, 342, -456, -342, -464, -2204], [-13070, 669, -1647, -1288, 654, -316, -133, 724, 699], [-9666, -1221, -846, -310, -283, -616, 666, 758, 1403], [-4389, 1233, -1097, 955, -989, 393, 2492, -1008, 1454], [-1890, 659, 947, 270, -430, 494, 637, -190, -1295], [6949, -1602, -316, 577, -549, 1707, 723, 184, -1553], [-6957, -1507, -866, 23, 934, 1943, -1391, 150, -408], [-4467, 84, -1665, 270, 1359, 1563, -615, -567, 235], [-893, 1983, -569, -1472, -2040, 553, -77, -225, 1480], [-1271, 2900, -539, -980, -1251, 639, 403, 1487, -1709], [5458, -1269, -842, -100, 307, 1404, 2066, -902, 245], [8755, -4447, -838, 674, -34, 105, -1259, 240, -23], [-8979, -1028, -536, -915, -661, 1145, 777, -634, 497], [387, -2178, -204, -1349, -609, -209, 199, 224, 643], [957, -864, 1456, 128, -1102, -3355, -1320, 621, 471], [-2926, -364, 1152, -1914, 1482, 164, -622, 254, 36], [5230, 829, -184, 1368, -929, -908, 602, -532, 1473], [1303, 1679, 357, -630, 586, -649, 149, 277, 1012], [-13100, 2461, -1109, -333, 59, 1994, 1086, 353, 17], [-3254, 4527, 1399, 364, -1078, 802, -511, 540, -1143], [-1758, -445, 1083, -158, 427, 2431, 1472, -298, 357], [3203, 6152, 364, -721, -851, -403, -609, 1856, -689], [4099, -2289, -3259, -520, 1190, 1865, -537, 209, -6], [-4318, 1822, -2358, -246, -494, -1116, 912, 1378, 986], [-8369, 1569, -1048, 192, -863, -719, 2574, -849, 330], [5699, 900, -736, 67, -677, 1127, 2225, -124, -727], [855, -6792, 2844, 2577, -750, -774, 1590, -1116, -2205], [-6326, -1132, 3342, 833, -791, -1406, -969, -421, -444], [-13330, 1781, 539, 404, -234, -580, 235, 982, -1127], [-7459, 1098, -1173, -2334, -1070, 279, 590, 1814, 232], [-9061, -813, -2754, 1584, -547, -3, -722, 49, -16], [-6534, 3284, 1212, 135, -586, -1165, -1464, 2235, -1676], [-1241, 23, -1059, 1141, -2267, 1813, 1580, 1346, -258], [8018, 2242, -280, -561, 1261, 1088, 307, -2003, -1950], [12165, 973, -1539, 973, 283, 1283, 1464, -856, -3434], [-12974, -1856, 3242, 3660, 902, 206, -2538, -846, -1838], [-2141, -2423, -723, -2031, 2131, 187, 1238, -2238, 1528], [-3018, -3127, 1257, 2500, 3642, -538, 299, -168, -3517], [15400, 162, 2322, -253, 187, -1164, 1677, 1595, -1770], [7106, -121, 11, 1700, 954, 418, -1097, -1170, -83], [8832, -2871, -627, 276, 1484, 1240, -915, -1398, 2245], [-3269, -2098, -690, 1372, -1302, 313, 1906, 1829, -2497], [3825, -5212, 4244, 3331, 1853, 601, 811, -1320, -2883], [11137, 1634, 452, 936, 1262, -1805, -1738, 3449, -1749], [8681, -2330, 2583, -638, 558, -3027, -1134, -2026, 536], [12236, 3064, -3274, -219, -315, 1698, 771, 2175, -1448], [-8904, 1149, -369, -147, 698, -387, -3929, -2261, 3089], [-11108, -1572, 482, -482, 1577, 1471, 1379, -1662, -3108], [-19569, 3280, 1777, 1042, 162, 1731, -1836, -1538, 184], [-8911, 3373, -811, -3616, -686, 2761, 393, 1511, 1550], [8903, -3777, -721, -654, -1367, 1480, 214, -417, -2374], [-5367, -88, -682, -354, 431, 1682, 3351, -2931, 169], [4830, -885, 2613, -1269, 119, -3776, 470, 557, -1669], [-8303, -4737, 3925, 1876, 994, -2911, -1133, -1597, -736], [4311, 1930, -2971, -352, 1212, 683, -276, 3464, -168], [-3587, 2525, -169, 1008, 746, -869, -2017, 453, 1376], [-2601, -4846, 2256, -1059, 2286, 2200, 1540, -1284, -59], [8498, -803, -2031, -1199, 2211, 976, -1316, 779, 2969], [2470, 655, 1575, 2136, 8, -1408, 2007, -1548, -555], [7003, -3358, -928, 474, 3500, 1929, -1728, -2759, -1257], [9341, -1618, 836, 2501, 811, -1341, 3047, -3716, 2495], [14474, -2523, -4275, -245, 2203, -852, 1390, -829, 2201], [6512, 2005, -3549, 259, -2467, 200, -1540, 565, 2597], [506, 2528, -1776, -2605, -3239, -3870, 1031, 4201, 176], [4827, -2445, 3383, 1019, 2487, -4443, -2708, 320, -3170], [-16591, -1058, 91, -1783, 982, 3019, 2988, -28, -939], [-5262, -709, 3557, -1971, 2727, 62, -1032, 1141, -4711], [7133, -797, -3451, -3793, -1225, -1739, -958, 4120, 3294], [376, -748, 1039, 696, -2126, -2680, -1288, -1423, 3887], [-6561, -12, 1576, 1097, 1336, -620, -2112, 176, -2581], [2505, 4934, -4504, -473, 191, 2429, 2835, 692, -1831], [2137, 4863, -4571, 2331, -3141, 947, 1826, -178, 1798], [10236, -5567, 1297, 2554, -904, -4862, 425, 1866, 467], [8577, 1001, -878, -1937, -1622, 3625, -1083, 3088, 2350], [10638, -2407, 295, -1264, -212, -3234, -637, 1204, 4773], [10483, 4049, -4939, 704, -3736, -121, 893, -2245, 2466], [7188, -6031, 6438, 3937, 2366, 514, -5927, 2341, -5393], [-16740, -87, -1091, -1145, -173, -1758, -2008, -357, 2601], [-886, -4928, 4026, 1447, 692, -553, 2606, 823, -5410], [-14938, -8344, 1321, 490, -971, 464, 1969, -676, 582], [1862, -1085, -1905, 816, -1532, 2670, 4911, -740, 2801], [972, -3467, 1030, 816, 3738, 2732, 647, -5641, 352], [10968, -3220, 1193, 2037, 425, -1894, 1929, -4620, 4397], [-13845, -264, -2304, -1432, 1806, -1009, -2806, 2611, -691], [19586, -1765, 449, 2674, -817, 5571, 3386, -3266, -875], [16850, 1480, -4206, -1140, -568, 902, -1344, 2644, 2344], [-11872, -8622, -762, 3011, 815, -434, 1307, -1841, 3584], [2209, -291, -1815, 2315, 2261, 3071, 1884, -2692, -1866], [-4784, -2609, -189, -2941, -667, 3886, 1004, 3211, -939], [10631, 4655, -85, 3490, -3543, 32, 1682, -1157, -354], [8073, -2473, -1373, -237, 495, 6789, 5294, -2626, -1440], [5671, -2989, -592, -1002, 2780, 879, 27, 1126, -1905], [-11324, -1307, -1400, -4122, -2029, -628, -684, 4500, 3705], [2422, -8275, -5517, 1239, -1548, 321, -1485, -1257, 3203], [-48165, -4485, 1512, 426, -436, 1461, 2893, 70, -2401], [23091, -1674, 2251, 4396, 3211, -1299, -421, -915, -6025], [-11065, 3144, 3076, -2043, 4667, -1435, -1827, 4860, -2621], [6816, 2604, 4616, 1941, -3293, -3426, -2659, 1993, -540], [-7546, -1390, 1495, -2238, -5086, -664, -2468, 883, -747], [-40338, -8989, 2427, 118, 3459, 917, -250, -498, 511], [-12725, 2230, -1718, -91, -933, -4755, -2125, 174, -1253], [662, 6775, 4129, -177, -169, -2438, 2378, -1159, -2939], [3509, -543, 4085, -2091, -2089, -4609, -690, 138, 850], [-4374, -5672, 2575, 3671, -312, 2922, 704, -4911, 3244], [-13249, 2617, 2073, -15, -2624, -7154, 353, 1836, -1154], [21290, 5072, 5400, -1036, 2392, 378, -6400, 6382, -2562], [-9165, 4135, -7051, -6298, -4302, -5933, -989, 4485, 6524], [-28846, -328, 1641, 5053, -1095, 1866, 2805, -2696, -5171], [492, -3536, 3512, 1256, 4980, 662, -1392, -778, -750], [-33051, -2332, -911, 221, -1427, 6495, 5441, -3029, -2772], [6711, -1489, 1549, -2614, -6642, 345, -3297, 1553, 4384], [-4114, -10422, 2776, 1454, -2381, 1551, -3933, -2514, 1678], [-11921, -1655, -419, -6720, 2612, 5, 1095, 1863, 2510], [-7707, -7841, 1397, -2044, 5040, -1785, -6157, 3595, -4636], [5012, 2527, 1591, 6913, -1193, -3678, -1906, -2475, -3955], [-6425, 291, 5629, 552, -900, 5381, -2635, -235, -3030], [-11349, -8181, -1602, 2305, 635, 2863, 722, -1599, -4561], [-16140, -1118, -6725, -5338, 4306, 2184, -1372, 1657, -2171], [-15909, -12165, 1599, -5173, 3497, -2571, -5008, 3556, -1466], [-4907, -10819, 351, 2155, -5389, -89, -1226, -164, 100], [-8104, -4975, -3814, 2081, -1266, -824, 1019, -1531, 3581], [14596, 2283, -15, 4563, -651, -1612, -1036, 3131, 2485], [-9327, 5085, -10491, -4935, -127, 2333, 4772, 422, 4488], [-14937, 1720, 2828, 413, -299, 315, -1861, -1808, -479], [-6442, -7605, -2620, 2362, -4411, -1598, -4738, -2008, 5419], [-11768, 8072, 237, -2709, 5334, -5226, -9870, 2769, -1056], [-1839, -3334, -7010, -602, 1218, 2405, -3046, -5907, 2997], [-1487, -4470, 3266, 4250, -360, -1697, -2204, 1917, -527], [-16024, -1410, -4528, 912, -2513, 2235, 6635, -6268, 716], [26154, -1623, -8119, -51, 1755, -2220, -6210, 4709, 395], [-13092, -2956, 5444, 4097, 485, 294, -9089, 5983, -6586], [4531, -8126, -1966, 3185, 3707, 3989, -1517, -4974, 4493], [-355, 6310, -4568, -6753, -21, -7569, -57, -72, 2535], [-24435, 16377, 2073, 1646, 36, -5575, -6529, 8299, -1892], [-32452, -7042, -3208, -6647, -1626, -2133, 4240, -6399, 5798], [-28582, -2106, -2162, 277, -3972, 5963, 260, -1119, -1614], [-13638, -1915, -1121, 10152, -104, -5272, 2273, -136, -4285], [19830, 1334, 624, -6681, 425, 2306, -2433, 3063, -4732], [49044, 14293, -5087, -8216, 372, 286, -757, 1286, 1343], [-6630, -5374, -2254, -6107, 3777, 1982, 1277, -6399, 1256], [-7286, 5173, -5369, -3044, 632, 486, 2437, 3836, 1799], [41770, -3651, -4786, -2860, -4129, 466, -2126, 7898, 4241], [-9676, 3506, 5983, 547, 1542, -6654, -1176, -215, -1862], [-3048, -5594, 2439, 1662, 7757, 1014, 2107, -4202, -2842], [-58896, 9351, -1415, -3351, -2955, -54, 5526, 1849, -89], [41416, -7583, 1647, -1218, -446, 2656, 971, 870, -5525], [32620, -3208, -4253, -142, 883, -4772, -2019, -3448, -298], [2917, 931, -2875, -3580, -11681, -4612, 1400, 3673, 4852], [22811, 5229, 2213, -2660, -717, -10764, -1594, 53, -756], [-672, 2786, -2109, -3976, 332, -1052, 2282, 5743, 1873], [-13395, 15524, 1350, -2064, 746, -5273, -4756, 6733, -7221], [24345, 4529, 4021, -3166, 3288, -3755, -1927, -1721, -1628], [-8622, -3979, 3989, 9540, -1046, 4764, 7721, -4744, -3859], [41653, 2172, -8152, -6545, -1159, -1233, 27, 4506, -1537], [9981, -8208, -2335, 6587, -6043, 2277, 8173, -8415, 1886], [-12330, -3891, 3161, 1577, -2457, 4616, 5648, -5537, -3259], [38424, 13385, -6223, -8176, -850, -3646, 3407, 2582, -843], [-12541, 2502, 5983, 958, -2482, -6039, 1390, 4304, -1122], [-22877, 5998, -2934, 4501, -4605, 3753, 5799, -1858, 8045], [552, -592, -5152, -5085, 7165, 2572, -6609, -2603, 5278], [25372, 3674, -1927, 4324, 2436, 3246, -3458, -219, -499], [-50527, 7866, -7119, -2620, -1464, 4141, 2712, 3254, 2410], [18483, -4854, -1377, -3480, 2785, -1707, -8287, -1807, 2323], [-12595, -14816, 2006, 3127, 6316, 3454, -4532, -4180, -971], [-25707, -4049, 7844, 7721, 3849, -3563, -3038, 5025, -9357], [16297, 4042, 502, 5753, -2085, -3011, -3677, -1498, 2421], [16615, 837, -1066, 2053, -3086, -1675, 3587, -6058, 1382], [180, 5683, -260, 3022, 2873, -6392, -1084, -2556, -6505], [-12419, 646, 3048, -894, -284, 4269, 4280, 2189, -4767], [14149, 8086, 4773, -4769, 4927, 371, -4479, 3359, -11024], [-9704, -3515, 2675, 3459, -3365, -5076, -7264, -2017, 937], [42159, 4448, -4804, -2253, 1749, -8585, -2729, -1150, -1599], [25268, -1242, 3646, -822, -8982, -6266, -5152, -528, 8172], [-20240, -7166, 2626, -6566, -4042, 4056, 748, 3926, -2358], [-16748, 6537, 1848, 3034, -1504, 800, -1613, -1753, -7832], [-31798, -4219, 850, -3048, 3354, -1558, 2699, 4553, -8122], [-7239, 15738, -5028, -3890, 1263, -5100, -8713, 12945, 961], [56129, -15997, 5529, 1902, 3782, -2727, -14741, 2233, -884], [15433, 3028, 4749, -1172, 1945, 3589, -7605, 2035, -3351], [-15870, -1860, -9408, -5721, 2948, -3575, 1034, 1955, 4760], [6561, 6462, -1252, 5662, 5386, -75, -3088, 2439, -279], [-14752, 4758, 675, -3773, 4635, 9266, 2489, 162, -7861], [6856, -11391, 6147, 7971, -669, 2532, -222, -4731, -2577], [-24590, 1049, -190, -2727, 6046, 9026, 9157, -1961, -5323], [10231, 18195, -2860, -7758, -1388, 1509, 233, 6766, -393], [7319, -2608, -3921, -7736, -7817, -2869, -383, -3307, 5923], [37787, -9461, 3155, 3645, 3360, 1206, 5343, -4134, 9942], [10095, -4242, 5152, -7392, -1540, 1537, 2442, -5135, 6131], [-32768, 10629, -8041, -11740, -3747, 4765, 90, 1150, 9033], [-8711, 15638, 3067, 1255, 8709, -5759, -2261, 65, -8368], [-13649, 4400, 3669, -5346, -1055, -1257, -10745, 663, 4863], [48937, 8015, -3290, -3361, 3675, -3763, -10132, 7813, 4521], [-14053, 18882, 298, 3083, -5407, -5037, -7759, 5354, -2839], [58345, 3164, -4379, -2246, -7118, -1105, -704, 5060, 5670], [44256, -7984, -1826, -3601, -4193, 2666, 1231, 1773, 5604], [2119, 376, 3540, -3302, 1002, -3655, -1496, -27, 5901], [4209, 5798, -1176, 5284, -7148, 2923, 12036, -9341, 6909], [-5768, 13516, 2108, 1510, 3246, -2750, 12122, 360, -13350], [-36354, 17294, -3112, 1603, 467, -3678, -2351, 5717, -7118], [31825, -12806, 4885, -3969, 5162, -6673, -8064, -2694, 7033], [14490, -16385, -3339, -8546, -1716, 11874, 165, -8462, 7023], [-7736, 8871, -10151, -10502, 2818, 6270, 11953, -720, 6483], [6757, -7072, 7336, -1183, 5271, 11897, -319, -1364, -1651], [16219, 13030, 5044, 2471, 12, -3656, 5746, 6518, -5187], [13001, 10617, -8826, -7150, 2286, -6813, 1461, 866, -2577], [5582, 19684, 7172, -2937, -6175, -7304, 845, 3167, 7350], [7611, -2632, -1440, 416, 5272, 16601, 1050, -9833, -2355], [-48527, -12930, 10882, 35, -1247, -2055, -14095, 3478, -435], [-12239, 16240, 354, 7311, 963, 1857, -359, 6932, -6971], [10766, -7270, 1828, 1027, 5786, 19133, 1662, -569, -3008], [18458, -14157, 3498, 3277, 4836, 4322, 4661, -117, 3595], [9551, -14075, -1111, 6055, -12164, 2012, 11901, -578, -534], [53417, -526, -6908, -5716, 6612, 9967, -494, -8001, 3507], [259, 5128, 3358, 12599, -2590, 2790, 5850, -2810, -16617], [-43204, 1162, 8548, 2256, 1822, -8550, -2976, 3950, -5232], [3768, 5355, -10331, -1986, -3224, -8148, -4117, 12612, 3023], [18577, 19984, 2664, 4478, 11172, 1875, -1806, 2525, -7889], [41558, -5181, 4537, -3222, 8074, -15414, -10021, 4196, 765], [40706, 8850, -5098, -8468, -2250, -3254, 3376, 2500, 8438], [-16270, 5378, 6425, -5515, 1889, 1214, -4581, 3266, -4427], [36278, 1797, -173, 6460, 7898, 12348, 807, -1858, 517], [2127, 163, 4082, -4092, 5040, -4999, -11047, -3520, 11457], [34581, -7562, -3126, 3261, 3987, -4311, -9293, -11878, 1579], [48354, -2900, -8349, -2529, 6155, -1596, -13481, 7318, -7883], [-32404, -4269, 323, -1240, -1736, 9136, 7589, -5208, -5837], [49551, -10172, 14650, 7887, -3131, 3979, -1749, -6522, -6613], [-68981, 15163, 4021, -4095, 8162, 7000, 151, -6564, -10818], [-27235, -22258, -924, -7131, 8286, -2, -3320, 3054, 9883], [41259, -5333, 2569, 5075, -4075, 7969, -1876, 11226, -8428], [24487, -32878, 9500, 9323, -1367, 9577, 4977, -12124, -3013], [60758, 5112, -2430, 7374, 3071, 2927, -315, -14928, -7366], [9625, 22055, 1911, -847, -4670, -5062, 4029, 6058, -7710], [8208, -6349, 17973, 10763, -942, -10743, -8625, 5453, -6289], [-34623, -2426, -3543, -5534, -1985, 191, 6355, 9845, -4655], [-54537, 6293, 5979, -1848, -10816, 7967, -5147, 5871, 1610], [-19704, 7552, 1912, 4082, -3020, -3258, 2644, -16618, 4460], [14761, -7930, -8808, -7896, 5528, -2915, -8620, 14081, 423], [-80248, -13079, 5758, 2818, 7136, 8732, -5703, 1213, -2012], [-31061, 2283, -6631, -11358, -6222, -8363, 3101, -3935, 12724], [-21843, 11331, -11788, -10476, -553, -1567, 650, -125, 2174], [7488, -18114, 9020, 1412, 4237, -8363, 993, -196, -2974], [49985, 20066, -8130, -4071, 5367, -5125, -5361, 10304, -1839], [-18850, 486, 9450, 9050, 3918, 10716, 8296, -16734, -11662], [-15781, 6329, -2643, -11766, 1860, -8017, 707, -2329, -13912], [32797, 14619, 6673, 2313, 12403, -5513, -1956, 1908, -15442], [-2405, 17755, -6416, -4369, 9708, 7017, 8481, 3248, 1224], [91772, -2174, -2312, 6220, 1990, 2262, -4360, 1866, 9084], [45, -33898, 8906, 7426, 3708, 7919, -3916, 7185, -13359], [99660, -10512, -1156, 10037, 45, -2928, -9095, 4877, 9868], [-37559, -3480, 3306, -8487, -9851, -2921, 7575, 270, 2109], [-78631, 14932, 3366, -4257, 5249, -2435, -3637, 12332, -5425], [11543, 25597, 6490, 10568, -4873, -9117, -11966, 8007, -6922], [-8855, 2733, 1355, -10408, -4920, 5265, -6323, 4019, 9682], [12800, 6741, 5272, 1755, -981, -7766, -3178, -2844, -300], [-7726, 25022, -15649, -13006, -1091, 5646, -2359, 11170, -822], [-76146, 11168, 1349, 19116, 2998, 478, 9648, 3205, -1817], [8045, 5388, 4514, 4932, 10755, 4868, -8213, -7863, -2799], [-36330, 7651, 14672, 2243, -329, -5826, -13858, 1174, -10538], [22333, -19148, 2880, 1427, 8809, 24055, 2751, -11394, -3741], [-11855, -4450, -1732, -12902, -10792, -2197, 2724, -4901, 18791], [32807, -18662, 12010, 3225, 17148, 300, -18270, 960, -8787], [-79865, 18044, 9757, 12155, 1939, -5823, -2701, -5345, 3138], [-47839, -981, -9293, -11357, 3157, 2271, 15148, -13422, 4284], [-33690, -6456, -12467, -1981, -6069, -232, 851, -12080, 13915], [22107, 10014, 6480, -199, 2535, -7999, -6625, 9730, -15931], [-21011, -7071, 8050, 9981, -2722, 5615, 335, 1008, -13040], [-47478, -7782, -17250, -13451, -4811, -11142, 3977, 4593, 16180], [17689, -13180, 2235, -7959, 1162, 9593, 1268, -1208, 2743], [52523, 7720, -13578, 3554, 7167, 2, -1663, 8269, 2973], [109910, -10011, 7421, -498, 328, -9744, -11053, 1610, 1293], [17240, -18469, 11715, -1605, 15744, 3903, -4813, -16985, 4265], [55461, -936, 10818, -7389, -4511, 2771, -9941, -5918, 6123], [4795, -5607, -1185, 2264, 12256, 1021, -7327, 8371, -11770], [-33009, 13316, -4150, 2197, 11467, 6499, 3897, 1924, 433], [11806, 2186, 3279, -8805, -3360, 1004, 2046, 2873, 5634], [103641, 3915, -6959, -7650, 1436, -5301, -5909, -1921, 8598], [-48995, 14185, 8081, 7404, -1720, -26581, -8535, 9927, -1662], [31341, 3471, -9725, -25431, -6849, 10203, 4116, 7062, 12800], [29722, -9956, -414, 1866, 3219, 9511, -423, -20042, 7854], [10018, 14331, 258, 3535, -7221, 3804, 14664, -4124, 2026], [-27531, -5590, -4869, 6579, -12596, 15153, 8204, -6760, 13661], [89826, -39170, 10116, 7404, 3978, -10118, 6276, -11534, -1668], [18500, -14738, 632, 3164, -4384, -6936, 8050, -210, 4988], [11959, -1714, -9984, -14643, 5248, 11950, -10794, 4160, 5837], [-61868, 14291, 6174, -567, -5752, 2532, -4929, -3127, 8419], [58077, 1744, -4266, -5208, 8606, -7857, 12478, -13847, 8147], [42058, 4019, -11325, 4861, -12733, 378, 10592, -2377, 11099], [16513, 13722, 10038, -5815, 4072, -4758, -13810, 6646, 9687], [12080, 27717, -12831, -1349, -243, -7344, 7880, -4419, 14863], [-10685, -9084, -11452, 5112, 3930, 12983, 13790, -3697, -13183], [-10321, 2162, -1333, 6747, -3289, 9173, -10943, 19115, -2456], [38935, -631, 17285, -9985, 7053, -14983, -15358, 14152, -6670], [2701, -2070, 2316, -12440, 4771, -9766, -20489, 17129, -3931], [-84073, -1045, -14496, 12318, -3256, 6761, 4717, 7290, -11845], [74644, 17911, -11431, 4389, -2703, 8892, 17530, -10217, 1113], [65227, -8130, 15816, 12073, -7807, -8597, -13687, 4362, -2765], [-7290, 41248, -11148, -5996, -9438, -24984, -11334, 14378, 15014], [-41747, 4582, 14618, 8494, -5890, -735, 14122, -1807, -11731], [-18808, -12793, -11238, -3074, -7449, -1348, 12092, 7034, 10657], [17659, -6903, -10211, -6886, -1419, 28930, 8962, -8793, -2244], [-16977, 15244, -18008, -11287, -12332, -2112, -9808, 2404, 11935], [54761, -13500, 7126, 2395, -4439, -1417, 10091, -9992, 2809], [-37497, -13166, -7353, -13839, 11099, 10567, 9055, 1481, 8546], [-12845, 7998, 456, 9605, 10145, 1691, 9, 7214, -8245], [-39417, 5530, 4770, -1152, 4586, 2943, -4718, -6209, -8151], [-29527, -17152, -5090, 14158, -7331, -14322, 1371, -7535, -1729], [64080, -8206, 4594, -2609, 285, 17600, 13073, -4989, -3652], [5479, 22091, -6769, 1332, 7756, 12821, 1357, -7205, 4624], [-13343, 8516, -25509, -18483, 3280, 6179, -12008, 2320, 8383], [64227, -7027, 3165, -946, -15858, 13881, 5391, -3719, 2086], [-60915, 27353, 2377, 1449, 165, -7475, -16760, -1130, 20058], [81325, -13082, -10414, -6830, -15606, -5455, 22514, 3285, 8793], [-102642, -5079, 19799, -7629, 5848, 7739, -1503, 2327, -7925], [-42273, 7101, 1873, 2687, -9041, -10235, -7332, 19658, -3564], [-3295, 24478, 14313, 3580, 976, -17427, -13348, 7032, -12550], [-1917, -9261, 935, 17313, -7143, 9429, 17460, -3936, -1842], [-29021, -31207, -6695, 1638, 6826, 6785, 7451, 9479, -13936], [-61906, -10321, 689, -12008, -10600, -9608, -12949, -6066, 18271]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_1521_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_1521_4_a_be();".
// 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_1521_4_a_be(:prec:=9)
    chi := MakeCharacter_1521_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_1521_4_a_be();".
// 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_1521_4_a_be( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_1521_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,4,sign)));
    Vf := Kernel([<2,R![9464, -3640, -8946, 1303, 2521, 8, -251, -20, 8, 1]>,<5,R![-15899689, -65644332, -23660364, 19041401, 2089839, -130261, -18187, -28, 41, 1]>,<7,R![-132217379, 1411107012, -628227922, -209691125, 1074885, 1103305, 715, -1864, -1, 1]>],Snew);
    return Vf;
end function;