
// Make newform 405.4.a.n in Magma, downloaded from the LMFDB on 17 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_405_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_405_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_405_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 := [288, -1200, -460, 479, 74, -44, -2, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], [-13, 0, 1, 0, 0, 0, 0], [-1, -23, 0, 1, 0, 0, 0], [-240, -114, 310, 35, -39, -1, 1], [672, 756, -397, -140, 42, 4, -1], [-1104, 732, 595, -82, -48, 2, 1]];
    Rf_basisdens := [1, 1, 1, 1, 12, 24, 24];
    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_405_a();"
function MakeCharacter_405_a()
    N := 405;
    order := 1;
    char_gens := [326, 82];
    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_405_a_Hecke(Kf)
    return MakeCharacter_405_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, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [5, 0, 0, 0, 0, 0, 0], [3, 0, 0, 0, 0, -1, 0], [2, 3, 0, 0, 1, 0, 0], [15, -4, 1, 0, -1, -1, 1], [22, -1, 2, -2, 1, 2, -2], [40, 3, 2, 2, -1, 0, 0], [11, 6, 2, -2, 0, 1, 0], [-46, 15, -5, 0, 0, -1, 3], [37, -8, -9, -4, -1, -1, 1], [61, -14, -11, 0, 5, -1, -1], [-8, 4, -5, 2, 1, -9, -1], [82, -29, -12, -2, 5, 0, 0], [30, -4, -9, 2, -5, 8, 1], [74, -4, 24, 4, -4, 4, 10], [1, -53, -1, -10, -4, 3, -13], [95, 101, -20, 2, -7, -8, 6], [171, -21, -12, 8, -7, 5, 0], [89, -144, -3, 0, 1, 7, 7], [293, 29, -3, 10, 4, 3, -3], [322, -58, -6, -6, -8, 16, 16], [223, -138, 14, 0, -4, -3, -8], [-406, -133, -13, 2, 20, -19, -13], [307, -175, 37, 22, 8, 7, 3], [-340, -126, -22, -4, -4, 22, -8], [195, 160, -19, 16, -15, -1, 33], [400, -73, 17, 14, 10, 4, -13], [-21, -119, 6, -14, 11, -18, 2], [-394, -50, 62, 28, 4, 10, 16], [346, -366, 1, 14, 3, 8, -17], [-68, -204, -16, -22, 4, 30, -14], [339, -55, -121, -18, 34, -15, -7], [-105, -257, -17, 26, -4, 37, -5], [-263, 39, 74, -6, 9, 2, -2], [243, 28, 85, -10, 25, 51, -31], [-22, -26, 12, -48, 26, 8, -38], [-311, 396, 27, -4, 31, 53, -21], [428, 158, -93, 20, -43, -72, 23], [-372, -98, 72, -36, -38, 20, -36], [139, 154, 59, -4, -3, -51, -3], [-52, -167, -15, -8, -60, -79, 61], [281, 458, -59, 54, -13, 9, 21], [708, -369, 166, 14, 21, -22, -42], [192, 40, -96, -44, -60, 20, 10], [659, 34, 101, 56, -1, -39, -5], [971, 474, 113, -70, 43, 23, -19], [1392, -46, 75, -80, 29, 8, -17], [1280, -357, 128, -32, 61, 96, 6], [642, -237, 89, 32, 10, -107, 41], [10, -59, -130, 50, -13, 2, -8], [-672, -218, 46, 6, -64, -86, 56], [-272, 836, -87, -18, -5, 5, -49], [2, 51, 298, 92, 15, 12, -22], [2391, -495, -111, -62, -24, 123, 53], [-771, -244, -13, 4, 79, -19, 63], [-2165, -71, 24, 38, -111, 64, 48], [1765, 350, -165, -96, -43, 47, -15], [719, 108, -213, -52, -31, 1, -17], [-2531, 687, 4, 80, 15, -70, 6], [2219, -58, -58, -78, -28, 115, -38], [1563, 36, 55, 56, -15, 49, 19], [1058, 155, -313, -84, 40, 8, -89], [1111, 700, -133, 78, 43, 71, -73], [824, 227, -186, 62, -119, 118, 36], [1545, 696, -45, 180, -75, -67, 53], [4264, 176, 46, 112, 86, 20, -14], [771, 665, -325, 58, 106, 141, -55], [1890, 851, -464, 18, -99, -108, 80], [408, -593, 27, -96, -32, 119, -11], [4227, -133, 143, -54, -36, -15, 31], [-1699, 274, 653, -54, 27, 33, -15], [3601, 56, 251, -32, -53, -51, 159], [594, 2200, 20, 32, -12, 4, -146], [2259, -823, -393, -112, 102, -77, -51], [-1713, 216, 541, 0, 1, 55, -83], [-5111, 243, -26, -134, 49, 122, -148], [1100, -18, 354, -60, 188, 14, -74], [371, 649, 277, -14, 148, 47, -165], [-2645, -1109, -175, -94, -94, 327, -75], [-1307, 498, -397, 66, 29, 5, -9], [-2436, -168, -202, 52, -206, 2, -38], [-4002, 820, -14, -98, 30, 228, 16], [-5158, 285, -418, -282, -17, 118, -6], [3748, -910, 446, -22, -112, -74, 112], [-2803, 1607, 220, 146, -119, -179, 118], [757, 2029, -253, -126, 110, 141, -179], [-3070, 481, 58, -218, 199, 254, 4], [2438, 183, -799, 60, -210, -347, 37], [-1873, 592, -781, 98, -125, -319, 257], [-3820, 199, -18, 6, 131, -138, -74], [-2208, -286, 248, 154, -186, 54, 342], [2591, 814, 851, 42, -71, 1, -99], [-10631, -255, -117, 92, -34, 33, 85], [4183, 233, 421, 112, -80, -237, -77], [7262, -670, -281, -24, -67, -102, -21], [2708, -711, -23, 52, 96, 493, -41], [-1645, -1134, 474, 0, 36, -254, 48], [5456, 1806, 523, -126, -11, 180, -309], [-4938, -339, 151, 328, -62, 99, 105], [-3460, -2139, -391, -92, 72, -2, 1], [1532, -1074, -222, -20, -32, 398, -62], [3727, -619, -274, 14, -151, -581, 36], [6975, 21, 101, 102, 144, 299, 165], [-1895, -15, 1009, 118, -252, -153, 165], [-11599, 1251, -209, 34, 240, 277, -127], [-7420, -857, -77, -44, -8, -250, -45], [7007, -1624, 715, -116, 1, 381, -47], [-2214, 1140, 666, -102, -278, 176, -180], [-5047, -1819, 699, -302, 198, 361, -405], [-2194, -1632, -99, -206, 17, 488, -141], [-1699, -892, 701, -156, -61, -61, 125], [-6093, 1371, -229, 218, -68, 41, 221], [-1082, -717, -156, 2, -323, 278, 282], [-5500, 3338, -106, -90, -144, 2, 156], [-324, -540, 19, 66, -99, -665, -3], [1545, 1453, -286, 74, 297, 213, 0], [-4908, 278, 267, -52, -115, -316, 107], [-2779, -3884, -347, -12, 351, -245, -193], [-2490, -344, 252, -134, -132, 84, 38], [-3804, 1846, -30, 64, -240, -334, -94], [-10699, 2450, 439, 416, 183, 165, -171], [1009, -1872, 191, -112, -319, 585, -7], [2540, -1215, -782, -10, -391, 414, 70], [-1386, 3040, -238, -210, -18, 124, -60], [-681, 1323, 102, -278, -83, -358, 68], [-2790, -6027, 561, 164, -36, -159, 293], [6222, -460, -932, -180, 24, -130, 76], [6620, -244, -593, 378, -145, -46, -219], [-784, 1102, -82, -156, 388, 46, -282], [6573, -1623, 795, -66, -326, 315, 359], [16249, 2190, 474, -344, -84, 245, 170], [4839, 2050, -161, 112, 293, 585, -23], [-2733, -3450, -379, 128, -95, -265, 189], [-7352, 741, 775, 558, -722, -187, 393], [-5136, -1039, -65, 250, -134, 33, 705], [8030, 474, -406, 252, 388, -170, 26], [7605, -1484, 867, -92, 11, 437, -101], [-201, 696, 897, 500, -277, -289, 251], [3731, -1523, -1003, 378, -492, -325, -37], [13207, -1645, -761, 76, 76, 263, 45], [-5795, -1271, 828, -78, -47, 216, 266], [-2232, 5084, 1, 406, -287, -570, 399], [-9234, 778, 863, -284, -371, -112, -27], [-5023, 613, -544, -154, 177, -496, -482], [4963, 2560, -1751, -528, -115, -339, -349], [227, 920, -1723, -280, -113, -473, 271], [-19797, -378, 25, -260, -155, -25, 421], [10756, -2393, 960, 598, 349, -276, 146], [6228, 2438, -843, 32, -181, -912, 153], [-2929, 638, -1639, 204, 17, -257, -191], [-10197, 727, -678, 264, 217, 324, -554], [4753, 1487, 122, -490, -173, 113, 196], [-4845, -5078, 617, 20, 407, -785, 29], [11445, 1927, 1444, 50, 37, -43, -62], [-13702, 4366, 180, -184, 534, 494, -376], [14320, -5926, -628, -118, 150, 190, 38], [19380, -2396, 1730, 776, -166, -330, -158], [-4978, -1850, -1002, 456, -592, -378, 212], [-10636, 2003, -1369, -184, 120, 31, -829], [-7125, -169, -1014, 364, 239, -107, -334], [15542, -951, 148, 66, 501, 40, -490], [11747, 1350, 1122, -66, 588, -399, -588], [-10877, 1598, -787, 136, -677, -815, 123], [-22660, -1699, 94, -710, -217, 638, -560], [17723, 96, -158, -178, -738, 177, 308], [-1380, 2432, 934, 88, 26, 264, 250], [-15738, -2712, -884, -132, 112, 516, 478], [-5758, 4729, -195, -170, 100, 1019, -817], [18595, 5908, 115, 28, 237, -399, -931], [-9659, -1843, -2077, 516, -162, 493, -171], [-15708, 4181, -1207, -80, -252, 693, -557], [-9607, -1772, -1305, 418, -165, 169, -25], [-4949, -3567, 499, -490, -446, 241, -191], [4818, -734, 1846, -508, 28, 1038, -598], [-428, -984, 186, 316, -918, -626, 772], [25597, -2467, 291, -180, 118, 769, 109], [4366, -2278, 944, 340, 810, -596, -70], [5369, 2528, -1742, 894, 190, -445, 740], [-13469, 2161, 1370, -222, 307, 1010, -96], [-3667, -844, -1289, -36, 655, 173, -85], [-4608, -955, -1104, 192, 783, -246, -12], [-11061, -538, 1475, 340, 191, -243, -357], [-30698, -2657, 620, -478, 111, 796, -272], [6824, 3580, 515, 526, -733, -894, 1189], [2900, 10095, -967, -896, -126, 509, -77], [-15330, 7070, 1814, -96, -16, 578, -6], [15737, 2782, 466, 340, 8, -1729, 368], [-9080, 5862, -897, -242, -721, -409, 971], [-17670, 3770, 480, 36, -182, -58, -456], [-11918, -4339, 724, 342, -371, 912, -178], [16437, 61, 1422, 20, -335, -945, -70], [11980, 1031, 1060, -332, 321, -1378, -892], [-22829, 3969, -1454, 186, -473, -726, 574], [-3281, 3233, -2036, -678, 431, -489, -118], [14914, 4403, -244, 1182, -457, 612, -248], [4416, 2590, 853, 618, 285, 69, 555], [-15916, 1718, 1264, 20, -422, 768, -206], [-8488, 197, 2492, 410, 9, 116, 402], [36399, 4144, -362, 766, -738, -31, 216], [22952, -2390, 2174, 768, 388, 402, -14], [-7275, -1058, 2001, 424, 199, 211, 431], [-8852, 3396, 908, 96, 72, 308, -64], [-10081, 286, 1950, -540, 1160, 370, 372], [-31025, 2729, 1343, 186, 754, 181, 127], [5011, 4732, -379, 128, -225, -781, 1025], [-12809, 6882, -243, -134, -901, -733, 1385], [13344, 849, -671, -396, 856, 830, 17], [-8941, -3266, 1012, -680, 1086, -472, -280], [13719, 8147, -2167, 524, -482, 523, 263], [9803, 3617, -1291, -830, -248, -585, -575], [-23114, -1732, -1860, -68, 212, -512, 72], [14144, -9050, -1181, 108, 721, -392, 55], [12249, -32, -2833, -56, 639, 737, -517], [-6989, 1756, -1007, 318, 225, -53, -1355], [17084, -2956, -159, 1010, 455, -491, 19], [-3033, -2498, 1178, 1658, 604, -287, 308], [22699, 961, 841, -1134, 368, 943, -363], [-11820, -8078, -1999, 110, 431, -1362, 823], [-118, 4098, 2318, -244, 1232, -14, -260], [-1185, -6451, -208, -66, -43, 0, -1166], [26851, 6748, 421, -758, 809, -577, -1319], [6623, 6268, -780, 448, -1080, -1556, 1436], [12871, -6326, -2746, -536, -112, 215, -1122], [12813, -4585, 3532, 520, 429, -209, -748], [19506, 13402, -424, 436, -810, -400, 990], [4171, -9864, -641, 1308, 25, 1253, -327], [-16435, 2932, -163, -724, 881, 803, -565], [-21294, 4558, -3133, -228, 153, -2054, 675], [-14797, -7670, 3509, 996, -133, 297, 551], [-7254, 4980, 360, -852, 1876, 404, -194], [13851, 5090, -727, 10, -689, -1149, 1481], [19735, -9780, -3537, -80, 251, -511, 689], [-23038, -3978, -79, 850, -659, 449, 1079], [7866, -6582, 903, -1272, 1529, 208, -947], [16935, -4338, 2302, 332, -28, -749, -210], [24999, -3153, 2130, 852, -459, -628, 282], [38123, -11512, -907, -472, -113, -953, 765], [-24422, -2391, 2204, 14, -353, 1590, -518], [-6671, 6494, -93, 294, -423, 65, -261], [11072, -3557, -825, -230, 1580, -284, -1079], [27901, -5374, 2089, 696, 339, 2063, -753], [18166, -4454, -1979, -576, -1125, 142, 1205], [12114, 4517, -1399, 504, 1268, 1865, -507], [13336, -899, 1300, 2, -939, -524, 1004], [-48959, -3806, -203, 2022, -1149, 65, 1709], [17481, 11236, -3108, -722, -856, 735, 494], [11486, -4333, 132, -738, -327, -1646, 426], [6613, 4098, -611, 1546, -149, 1041, 205], [-41829, -870, 1200, -400, -746, -149, -516], [10501, -2612, 1833, -1492, -353, 1503, -485], [2195, -9848, -2694, 836, -814, -1702, 124], [32765, -4398, -143, -1306, -1285, 1587, 691], [25953, 3075, 3584, -332, 611, -626, -1076], [1930, 7132, -3234, 568, -1150, -2206, 1462], [-19133, -13139, 2063, 686, 762, 785, -661], [18704, -4008, -1082, -840, 306, 1542, 344], [19416, 1830, 5073, -770, 747, 1264, -383], [-34023, 3698, 1709, 1692, -1855, -1197, 1467], [-5164, -5263, 740, -62, -487, 1536, 872], [10816, -6174, 2035, 2020, 33, 944, 239], [5663, 9241, -3834, 168, 1101, 1389, 530], [-886, 9404, 620, -92, 180, 660, 246], [-2418, -1244, 796, 1196, 664, -940, 1786], [-13667, -4722, -1725, -516, -1417, -143, 1771], [3277, 5855, -3763, -1420, 1230, 1141, -901], [34750, 8000, -2300, -2184, -1228, 1360, 330], [-41519, -8704, 92, -1216, 276, 360, -426], [21873, 4019, 486, 702, -1705, 425, 1004], [20234, -5798, -36, -888, -50, -2236, -2050], [9260, -3368, 434, 424, 442, -530, -1456], [-21005, 4358, -3132, 2030, -222, -1873, -316], [-50574, 575, 2370, -474, -1011, -322, 90], [-12676, -3022, 550, -1052, 624, 1680, 118], [7185, 10593, 193, -158, 892, -597, -1731], [-52398, -2706, 4261, -592, -549, -526, 69], [3146, 2850, -4683, 1462, -353, 470, -131], [-26340, -4354, -2406, -904, 1444, 354, -516], [4814, 5422, -2649, 102, 1303, 267, 103], [8112, -11241, 1564, 506, -27, -3128, 22], [6435, 5306, 2809, -764, -165, -77, 1097], [-31789, -3672, -1345, -1316, -713, 2821, -463], [60491, -2780, -245, -258, -1229, -839, 489], [28480, 559, -5131, -264, -2902, -695, 1455], [-52136, -1327, -1209, -1966, 346, 2656, -1855], [23310, 4806, -3506, 852, 540, -1274, -522], [21471, -13954, -1315, -1220, -887, -1065, -913], [23270, -5680, 42, -120, 1690, -582, -354], [-46512, -2704, 4248, -1140, -1040, -1468, 412], [-15758, -4660, -3653, 2054, 21, 627, 985], [34388, -2056, -910, -1140, -2190, 814, -152], [-1928, 12373, 2078, -894, 637, 1978, -2066], [22466, -3187, 3866, -1126, 1003, 1430, -3488], [19260, -3011, -296, 876, -313, -222, -1304], [37445, 8336, -1131, -376, -1293, 2539, 635], [-23849, 5861, 1960, -218, 265, 84, 1008], [-46647, -5448, 4805, -1912, 425, 759, -541], [-21928, 422, -1588, 1176, -1582, -4144, 1054], [37994, -3536, 2478, 1686, 26, -572, 1928], [6605, -18740, 2519, 784, -497, -1775, -505], [-44048, -10795, 1684, 142, 681, -2080, -490], [23664, -15174, -3796, -1592, 346, -204, -1094], [-25795, -746, 2373, 1130, 1267, 481, -423], [3327, 9948, -2545, 998, -2637, -751, 2509], [41294, 12104, -4680, -1020, -1476, 222, 264], [35627, -374, 3721, 556, 2137, -1905, 197], [31603, -17362, -1966, -62, -1584, -1877, 2534], [9456, 15649, 2031, 1448, -2398, 879, 1855], [-34985, 5824, 221, 1940, -2503, -2635, 475], [10718, -4238, 8518, 184, -744, -302, -286], [1809, 3982, 839, 900, -111, 733, 2159], [-33498, 10569, -2349, 808, -1198, 2199, -359], [-2418, 14092, -1844, 1144, -636, 1596, 166], [15129, 17630, -6302, -744, 104, -2217, -88], [25823, 11044, -3943, -888, 1417, -1381, -1779], [-32031, 6934, -112, 848, -1070, -908, -958], [-59645, -2831, 107, -1604, -614, 191, -371], [-19267, -13954, 5219, 278, 197, 2081, -697], [41523, -11469, -3527, -398, -2254, -477, -581], [36952, 13444, 1214, 1072, -350, -1870, 856], [38325, 2649, 1559, 1176, 1238, -1611, -791], [-33144, -10549, -3826, 710, 1025, -1478, 276], [46034, -9426, -1368, 1876, 426, 972, 16], [-28223, -3658, -7195, 114, -465, 1339, -245], [-23334, 1876, -1032, 1504, 256, 1508, 1850], [4426, -952, -3897, 518, -911, 623, 1395], [32560, 9639, -1600, -716, -1183, 2434, 56], [-27374, -10439, -2941, 346, 94, 1826, 833], [-33770, 7896, 4749, 1024, 2017, 1282, -1351], [1832, 5820, 958, -1068, -506, -1934, 1284], [-21433, 17757, -2800, -1278, -355, 1392, 96], [-43749, 6406, 803, -544, -1553, -2167, 503], [-36842, 14942, -2440, -606, -1454, 2804, 78], [67766, -313, 792, 214, 2121, 1256, -1752], [-47077, 3933, 533, -2914, 2136, 4853, -1583], [-9564, 1746, 5887, -854, 521, 2112, -57], [12527, 11235, 1082, 2738, -511, -2638, 330], [-68373, -2285, -473, -566, 644, 653, 1805], [62312, -11878, -2003, -1762, 1829, 2525, -605], [-76699, 62, 4163, -856, 433, 1213, -317], [-49114, -13878, 2170, -352, -60, 858, -294], [-55954, 10146, 1890, -420, 2408, -134, -118], [53033, 351, -1190, 86, 829, 2010, -1074], [-69422, 1152, 2436, -1724, 652, 3546, -2536], [31703, -3986, -5097, -2692, 3003, 1505, -2017], [-27403, 8379, -4977, 2156, -280, -2875, 553], [23690, 12048, -1376, -2156, -96, 2992, 56], [51734, 6639, -1705, 1200, 632, -944, 1375], [12214, 21412, 2182, -866, -214, 688, -1312], [-33174, 17362, -1842, 420, -2364, 874, 1606], [45366, -22980, 3196, 1360, 1132, -450, -480], [-1528, -2261, -882, -270, 1005, 2526, 1188], [-28597, -5381, 2350, -1066, 1513, -2582, -2438], [-6523, 20316, -2496, -1600, 640, -379, -3176], [40220, -8957, -6329, 252, -1484, -2201, 121], [-75817, 15560, -4793, -1444, 1829, 169, 635], [-20544, -1314, 3458, -986, 392, -98, 600], [59706, -6880, 7042, -248, -2590, -1738, 2666], [14844, 16274, -3172, -876, -1550, 1128, -2020], [-58318, 13500, -3675, 1142, 201, -1200, -2769], [29258, -468, 3050, 2532, -814, -314, 3028], [4277, 13660, -2168, -92, -1444, 1188, -1840], [22049, 1806, 1077, 2702, -853, 3719, 223], [71032, -5309, 1914, 364, -1993, -242, 2370], [5236, -6327, 9190, -98, -3063, -66, 1998], [38244, 4843, -7652, -282, 843, 72, -480], [-18825, 33018, 4289, 476, 113, -1705, 213], [-17632, 26740, 1051, 1900, 1479, -2300, -2941], [30467, -19309, 5161, 222, -4014, -145, 1081], [-53679, -6642, 2657, -1482, 1811, -2287, -1807], [-34599, -451, -81, -3820, 566, -87, 313], [-37533, 5384, -2030, 1262, 842, -2871, 1772], [12459, 15959, 2032, -430, 91, 2216, 1788], [-73734, 4900, -2246, 2108, 1106, -3646, 1298], [57544, -1188, -3240, 960, -2204, 748, -1298], [17990, -807, -9224, -656, -1061, 676, 2528], [-43430, 7628, -5748, 478, -2988, -4948, 3374], [-52972, -1106, 2940, -860, -238, 2804, -18], [60258, -17590, -4429, -4966, 1563, -309, -3373], [7329, 1504, -3263, -2224, -1629, 2151, 511], [43968, 3529, 2655, 1248, 2746, -557, 1097], [-12702, 3257, -5252, 1934, 105, 2048, 740], [12388, 1910, -1583, -1872, -761, -1068, -4195], [-28144, -19453, 3726, 2702, -2271, -2470, 1832], [59486, 2101, 3302, -1300, 4569, 2708, -2762], [20677, 3760, -8037, -1628, -421, 1645, -177], [-64673, -5194, -9725, 434, 513, 1315, -2289], [-60746, 16704, -1170, -1808, 182, -1498, 2546], [90033, 12658, -4964, -322, -442, 2393, 896], [49731, 2694, 3358, -1968, 732, 511, 870], [9504, 8520, 2235, -330, -2191, 47, 3071], [-29639, -7288, 3359, -952, -1279, -5143, -665], [-50971, 33, -297, 646, 2170, -621, -1849], [-50238, 10047, 336, -38, -511, -2912, -3288], [-12712, -20048, -2920, 790, 1468, 406, 514], [-54456, 5736, 4346, 2220, 1106, 726, -968], [-41032, -13284, -614, 1384, -1446, 712, 2246], [107383, -23491, -5667, -782, -640, -2785, 1699], [-73333, -897, 2639, -1572, 2172, -2705, 629], [94222, -5078, -12732, 1312, -758, -396, 310], [-36961, 279, 2018, -1490, 2137, 2050, -670], [15319, -25925, 3861, -10, -566, 2967, -1239], [-26551, 15966, -93, 408, 1933, -1375, -369], [-11941, -36452, 219, 756, 429, -1923, -2341], [41957, 1101, 698, 2150, 1895, 4758, -2268], [-121307, -19682, 3795, 14, 2789, -1527, -697], [-1892, 15872, 6524, -652, 2612, -2800, -76], [33533, -18390, -1480, 1672, -370, 3096, -2702], [6732, -16679, 8499, 4044, -1454, -1550, 2523], [45994, 15520, -2484, -736, 3444, 1182, -4156], [-38935, 19373, 10937, 3918, -1920, -941, 1715], [-74402, -14612, -2042, 1968, 1290, -2162, -284], [-3257, -2165, 1124, 700, 569, -3999, 1968], [-8879, 6555, -4645, 3032, 540, -5143, 789], [45679, -3006, -4019, 3076, -1959, 3867, -951], [75634, 123, 1093, -3156, 2842, 669, -5027], [-22303, -9744, -1319, 1144, -4079, -529, 3159], [-71415, -9298, -1317, -1340, -1639, 373, 2151], [-53307, 37177, 13445, 978, -1260, -2105, 605], [86292, -10398, 6377, 2660, 883, -1532, 241], [85229, -31227, -5586, -3274, 759, 3778, 148], [23398, 29162, -2134, 808, -2580, -4994, 4812], [-9503, -10642, 8247, 24, -347, -1603, -569], [10565, -4057, -6149, -3038, 2400, 1691, -2617], [63579, -5268, -6869, 2828, 2265, 725, -969], [-11812, -312, 4088, 768, 2384, -676, 1672], [4251, -32127, 3998, -1110, -1455, 2767, 1400], [137428, 1308, -534, 1712, -38, -2282, 3178], [70893, -10510, 8451, -174, -4279, 1565, 1559], [-3072, -2004, -6528, 4278, -144, 1054, -1274]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_405_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_405_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_405_4_a_n(:prec:=7)
    chi := MakeCharacter_405_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_405_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_405_4_a_n( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_405_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,4,sign)));
    Vf := Kernel([<2,R![288, -1200, -460, 479, 74, -44, -2, 1]>],Snew);
    return Vf;
end function;