
// Make newform 1840.4.a.o in Magma, downloaded from the LMFDB on 24 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_1840_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_1840_4_a_o();".
// 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_1840_4_a_o();".
// 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 := [1044, 1212, 121, -80, -2, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [-246, -155, -44, 4, 1], [54, 155, 50, -4, -1], [-103, -52, 3, 1, 0]];
    Rf_basisdens := [1, 1, 12, 6, 1];
    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_1840_a();"
function MakeCharacter_1840_a()
    N := 1840;
    order := 1;
    char_gens := [1151, 1381, 737, 1201];
    v := [1, 1, 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_1840_a_Hecke(Kf)
    return MakeCharacter_1840_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], [1, -1, 0, 0, 0], [-5, 0, 0, 0, 0], [-2, 0, 1, 1, 0], [-3, 2, 1, 0, -1], [1, -3, 1, 2, -2], [-4, -2, 0, 5, 0], [-1, 7, 1, 5, -1], [23, 0, 0, 0, 0], [-47, -7, 0, 3, 2], [18, 8, -5, 8, -1], [-83, -12, 1, -9, -1], [-148, -28, 10, 2, -1], [114, -21, -9, -3, 6], [114, -18, 16, 11, -3], [-149, 37, 8, 18, 5], [175, -13, -44, 0, -1], [61, 8, 15, 52, 7], [65, 2, 3, 9, 15], [298, 33, -25, 27, 1], [-274, 41, -1, -16, 7], [-86, -97, -9, -37, -8], [375, -117, 18, -30, -13], [118, 3, -1, 21, -26], [-49, 16, -23, 48, -13], [-139, -73, -52, -12, 3], [315, -155, -32, -7, -25], [323, 122, -101, 5, -3], [233, -135, -3, -103, -13], [-287, 30, -23, 19, -39], [-182, 72, -44, -165, -9], [218, -49, 83, -26, -19], [-233, -68, 88, -78, -31], [-833, 30, 43, 70, -44], [1231, 56, -2, 74, -17], [519, -14, -93, 13, 6], [1377, -104, 99, 19, 9], [757, 14, 92, 19, 20], [688, -80, 108, 12, -4], [791, -127, 174, -25, -39], [-460, -47, 103, 126, 29], [1691, -35, 35, 21, -29], [158, -194, 184, 76, -8], [40, 305, 1, -26, 25], [9, 466, -103, 37, -34], [-1524, -189, -73, -87, -82], [445, -47, 30, -122, 33], [78, -122, 44, 252, 18], [-204, 301, 37, 251, 0], [2286, 529, -205, -41, 74], [-1364, 183, -165, 222, 51], [-337, -252, -71, -56, 94], [-782, 372, 222, 124, -20], [999, 214, 132, 288, 5], [-744, 161, 141, 8, 7], [2756, -143, -43, -78, -42], [2175, 427, -192, -193, -60], [-74, -109, -114, -286, 28], [160, 331, -255, 118, -123], [-3490, 17, 7, -155, 70], [637, 689, -106, 68, -101], [-1515, -721, -168, -100, 53], [-219, 1117, 72, 163, 13], [1970, 45, 379, 200, -159], [-1292, -127, -126, -118, -70], [-455, 260, -504, -294, 101], [1309, -468, -101, -62, -162], [893, 273, 321, -131, -153], [2733, 983, -46, -41, 57], [2763, -545, 4, 209, -64], [-3330, -795, -25, 10, -141], [3442, -1037, -11, 223, 56], [741, -227, -360, -218, -19], [-3312, 226, -394, 58, 186], [1391, -785, 162, -249, 207], [4731, 206, -267, 85, 135], [2863, -297, 102, -123, 295], [-2389, 466, 579, 493, -38], [-3496, 762, -146, -70, -42], [2466, -639, 222, -283, 357], [4076, -459, 167, -163, 180], [429, -179, 233, -611, 63], [7756, 809, -171, -97, 56], [-2340, -449, -446, -596, -84], [-767, -373, 595, 176, -228], [8361, -732, 164, -459, 78], [-858, -157, -108, 376, -94], [-259, 477, -786, 282, 193], [-4448, 212, 126, 465, 17], [2430, -806, 430, 524, 14], [2433, 207, 174, -288, 231], [-1632, 50, -184, 690, 208], [942, 1558, -558, -347, 227], [935, 1058, -631, -782, 240], [-5167, -1046, -719, -228, 196], [-2362, -423, -84, -504, -262], [4048, 238, -742, -53, 1], [-4170, -588, -124, 14, -106], [-3102, 1411, -447, 65, -194], [198, -1938, -74, -525, -329], [-6451, 1206, 286, 861, 56], [-1583, -498, -309, -369, 105], [3485, -977, 418, 1280, -339], [-1238, -1834, 18, -274, -60], [-10887, 309, -302, -367, -159], [6782, -667, -395, 682, 103], [699, 2231, 302, -54, -334], [-1354, 552, 262, 598, -368], [6451, 821, 610, -435, -221], [1400, -1025, -450, 21, -1], [-6228, 958, 154, 290, -404], [2930, 1138, -1850, 364, -82], [6452, -1005, -429, -48, 242], [-2043, -186, -410, -430, 407], [-15344, -13, 245, -23, -268], [-3660, -485, -1603, -1037, -164], [-10803, 67, -872, -888, 615], [5726, 2840, -602, 379, 417], [-3543, 2811, 471, 764, -14], [4882, -958, 332, 1012, -770], [5133, -1699, -66, 701, 251], [-7642, 1415, -809, -818, 313], [13741, -449, -544, -1258, 31], [-6945, -300, -708, -1205, -314], [-5950, -534, 1334, 430, -190], [-4935, 1515, 85, 229, 367], [5287, -1078, 7, 908, -481], [5802, -255, -1162, -318, -124], [1228, 1700, 154, 387, -350], [10151, -185, 1954, 162, -225], [1063, 564, -959, -150, -280], [-5159, -98, -514, 730, -33], [-12630, 1175, -805, -229, 282], [3435, -488, 395, 837, -87], [-82, 1589, -1110, -547, -275], [5164, 1884, -1326, -138, -150], [-7984, -299, -1733, -1643, -84], [857, 507, 482, -62, 297], [2041, -704, 237, -1451, -525], [-5516, -658, -1470, -1229, 466], [-14239, -58, -285, 1146, 116], [-1210, 1048, -372, -1484, 32], [-4296, -1620, 284, -515, 519], [10003, -135, 1338, 34, 343], [-18679, -1315, 1710, 376, 79], [4906, 3445, -113, 801, 218], [20461, -426, 24, 486, 313], [-11224, -3085, 1489, 1856, -173], [7401, -416, -379, 788, 92], [14016, 1892, 30, 917, 89], [263, 2335, -116, 1343, 177], [-5112, 392, 1168, 1944, -112], [-383, -538, 1072, 1818, -937], [14078, 646, -1010, -1035, 225], [3999, 1814, -1337, 1221, -295], [4940, 1365, -319, -1575, -474], [238, 3315, 423, 593, 26], [-19465, 1427, 732, 887, -614], [-5187, -2521, 131, -875, -391], [-10105, -1047, -288, -707, -645], [2549, -2044, 932, 897, -558], [19657, -1181, -1080, 463, 23], [19722, 1298, -842, -675, 659], [16495, -3309, 306, 197, -307], [-4430, -848, -367, -723, 166], [-2722, 352, 532, -1683, -108], [-22004, 2858, 842, 1531, -316], [-10784, -140, -2114, -1782, -454], [-13844, 4383, 1453, 271, 162], [-11593, 3308, 37, 1883, -462], [21218, 885, 1117, 1185, 716], [515, 5777, -1318, 485, 1084], [-16616, 1242, -2348, 572, 800], [-7502, -4298, 678, 1069, 502], [-1941, 1974, -397, -2265, 312], [-19300, 777, 1337, -269, -216], [-33482, -2255, 985, -694, -405], [-14401, 1675, 2142, -1041, 698], [10510, 3201, -2049, -18, 284], [-7279, 268, -844, -702, -369], [16140, -2224, -578, 1121, -695], [-26587, -272, 347, 1530, -119], [10481, -757, 2751, 622, 72], [24296, 2560, -2770, 1028, -274], [-13616, 1958, -716, 2149, -750], [2257, 3382, 222, -836, 683], [-9317, -4184, -150, -496, 999], [-10321, -6142, 1825, -17, 645], [-3372, 3472, 2522, 612, 9], [12316, -2146, 1778, 2565, 12], [-8834, 1767, -2519, -2812, 493], [14082, 3076, -1482, -2106, 82], [-4502, -6510, 1688, -106, -488], [-12003, 4001, 236, 2712, 223], [1012, 1780, -3690, -1974, 110], [39800, -1688, -563, 39, 694], [-33534, 2931, 837, 3837, -872], [16062, 3148, -2464, 1146, 98], [11946, -3402, 58, -1576, 678], [-7660, -4864, -528, -2967, -567], [41195, 4551, -1178, 39, 751], [-13481, -250, 1168, -1182, -11], [26773, -1624, -1585, -449, -50], [3984, -139, 867, 375, 1178], [15408, -5798, -298, 470, 36], [10284, 917, -825, -824, 1445], [34786, -3935, 643, 2477, 228], [1301, -9737, 76, -1026, -1404], [-13944, -6911, 1022, -909, 53], [-16240, 2163, -1303, 2248, 1185], [-17534, 1079, -741, 1384, 221], [-7778, -6210, -3032, -1379, 429], [7991, 1239, -2897, -1251, -155], [-10662, -5922, -898, 712, 372], [-7495, 347, -1438, -2564, -355], [19484, -6215, 913, -1901, -612], [-18288, 2074, 3148, -767, 95], [19505, 5943, -502, 67, -2], [-18556, 1205, -2288, -3032, 396], [57420, -2133, -1339, 632, -289], [-3317, -2393, 1756, -3647, -790], [-22568, 4337, 3469, 3443, 2], [-20064, -1192, 1314, 1198, -1523], [-9490, 86, -151, -91, -444], [-3138, -3468, -32, -1701, -315], [4361, 8051, 262, 711, -596], [31863, 1577, -163, -2789, -1013], [51482, 3548, 1599, 2154, 1649], [15027, 1814, -2690, 692, -185], [-17205, -645, -1788, -2826, 219], [1337, 10110, 1372, 1846, -359], [-29543, -8144, 91, -184, -727], [-25810, 6468, 2902, 3544, 288], [-5710, 516, 3346, 2577, -500], [18581, 4379, -1316, -3182, 1177], [21502, 1931, 287, 1261, 382], [-35138, 8290, 1722, -1838, 402], [20498, -2303, -661, 2463, -344], [-9443, 3122, -769, 3822, -264], [-38368, 11415, -117, 3931, -523], [44277, 3771, -496, 1114, 1253], [25387, 3506, -2539, 1458, -1346], [-18702, -5100, 98, 1379, -2203], [10140, 7080, -862, -3949, -737], [-10762, 7098, -3450, -1052, 1352], [11851, 3299, 487, -454, 1700], [69238, -1480, 1502, -983, -619], [-14643, -1126, -1240, -3874, 1889], [24697, -4005, 3752, -325, 255], [8036, -12106, -1336, 947, 1162], [21200, -2484, -2408, 378, -336], [-16376, -8834, 826, 366, 2106], [-18780, -1503, 3568, -2696, 1680], [-20216, -2785, 81, 2771, -2192], [11950, 4366, 3818, 1794, -1296], [2437, 11046, 1729, -412, -1306], [-8005, 3310, -725, 3922, -507], [39238, -3756, 1086, -4922, -1016], [21397, -409, 4867, 6038, 696], [-55564, 247, -2983, 214, 2245], [44106, -3934, 682, -2873, -974], [32047, 7758, 1759, 4257, 1391], [4579, -4903, 1310, 5786, 1165], [-4127, -11394, -1459, -191, 673], [48256, 1316, 1970, 518, -930], [-13825, -1414, -4201, -198, -967], [72429, 3224, 239, 752, -585], [3736, 3797, -4079, -1815, 604], [16273, 84, -1615, 1445, 587], [-195, -3213, 4937, -44, 1696], [40455, -1835, -534, 797, 128], [30231, 13147, -3456, -2164, -499], [-55808, -2194, 2277, 4639, -618], [-10484, 14569, 159, 2217, -1132], [-20670, -6801, -473, -1532, -457], [47104, -6438, 3640, -699, 915], [-14045, 6541, -114, 4689, -597], [20215, -14549, -1026, -1962, -803], [31700, -286, -4220, -1632, 166], [39603, -10984, -920, -1580, -503], [43010, -2506, -2358, -1557, -1101], [-33796, 13218, 2334, 644, -178], [-58567, 10994, -2263, 4570, -717], [-300, -4680, 1462, 1250, -1802], [48279, 4192, -3984, 1330, -1459], [55824, 4654, -1678, -599, 448], [25875, -9755, -92, 4086, 317], [42294, -2169, 807, 1409, -2140], [-16109, -15545, 580, -337, -889], [57755, 6071, -3192, 3191, 481], [-35962, 1212, 3252, -4216, -436], [-5281, -4649, 1544, -1192, 259], [32606, -926, -3324, -2612, 816], [-3513, 1963, 3655, -2413, -861], [-54431, 5602, 5097, 1235, 186], [35359, 5321, 4228, 2655, -319], [-15924, -7580, 3878, -106, -880], [-4933, 6168, -1931, -1123, 1170], [30945, 8574, -401, 5974, 2542], [33935, -69, -362, 1152, 708], [-11194, -5660, 677, -2589, 776], [75187, 3580, -911, 2699, -939], [-3366, -6442, -8588, -7370, 978], [-12424, 11258, -580, -1735, 265], [-42971, -14872, 2988, 484, 1091], [6160, 5853, 541, 760, -1961], [22157, -7593, 2970, 2041, -3931], [-32899, 2138, -674, -6740, 2131], [-4082, 504, -2100, -2702, 2292], [-56093, -11523, -2090, -3365, -887], [-7882, -188, 5198, -4163, 1477], [22221, -4599, 889, -8389, -595], [35774, -3014, -1736, 298, -1750], [15953, 2965, 4834, 4688, 174], [-8794, -906, 2737, 4047, 334], [42056, -20283, -2399, -3277, -160], [-52557, -4500, -6829, -1674, -1068], [63840, -12650, -1295, 3962, -983], [-14245, -4065, 258, 2918, -2941], [-4123, 5447, 3972, 2590, -956], [-39327, -6094, 6549, 2624, -735], [12594, 5463, -4863, 942, 2026], [854, 7876, -1878, -1109, 2645], [-2868, -8202, 2556, 6560, 1660], [20168, -22970, -716, -1193, 534], [-34868, 6500, 4788, 1024, 332], [7079, -18154, -1138, 3360, 2231], [41005, -14118, -152, -5813, -1772], [-19689, -7987, 3649, -247, -1557], [13303, -12173, 1794, 6504, 2171], [-11007, -417, 9936, 9965, -226], [-18145, -1066, -3797, 4863, 854], [-5715, 8356, 1031, 1476, 1122], [-39163, 4192, 1730, -2035, 248], [-67650, 1309, -5535, -679, -1944], [16891, -13074, -4110, -1015, 2110], [5045, 5093, -118, -3267, -3221], [35416, -2789, 8287, -1293, 276], [28483, -2107, 3284, -3496, -1790], [-70, 917, -3357, 514, 54], [-81040, -15817, 485, 188, 443], [69357, 216, 7955, 1688, 2029], [74286, -18592, -882, -7284, 192], [-32122, -3564, -10936, -2478, -52], [42477, -15997, -556, -1710, -1105], [-33453, -11861, 3516, 6178, 1059], [75201, -13539, -5076, -2657, -480], [14477, -11890, -1154, -5976, -985], [4310, 1942, 4550, 1130, -2348], [7651, -983, 7532, 6564, -1623], [-70065, 888, 4087, -4194, 2162], [-88802, 12189, 221, 3238, -1569], [8537, -14391, 3940, 1554, -4973], [25634, 358, 738, 2997, 1060], [6464, -7394, 2336, 5586, 808], [27212, -7776, -1746, -2964, 978], [66028, -10314, -766, -10284, -628], [14673, -15856, -4890, -5788, 3069], [36928, -8115, 4595, -416, -3459], [-15018, 12098, -8586, 156, -782], [-48163, 16493, -7032, 5146, 2931], [-9971, -8171, -224, -7915, 2278], [-56752, 10442, -7020, 3927, -731], [60603, 1035, 4506, 3425, 305], [-5911, -13193, 7148, -4584, 1486], [-34660, -15117, 53, 2374, 821], [42539, 14520, 5297, 2287, -782], [14701, -22574, -4849, -4259, -1313], [-12946, 996, -6832, -8498, 1100], [74545, -9536, 589, 6180, -2638], [20523, 4463, 2448, -4848, 1323], [112486, -7766, 1880, 2749, -3367], [14481, -27065, -1508, -1313, 65], [-152972, 4092, -264, 2260, -1684], [-141153, 4775, -2349, -7432, 2420], [-2395, -8508, -9807, -606, -670], [22502, 2869, -607, -12405, -200], [45086, -19028, -3732, 365, -2344], [-6350, 15488, 9108, 212, -1358], [-52828, 8655, 8307, 1668, 463], [-17569, -319, 4172, -3775, -4011], [70501, 22500, -8237, 42, 499], [-88738, 11220, 130, -6716, -778], [-107056, 2385, -5905, -4806, 1271], [-6154, -16957, -3553, 669, 950], [28370, -27920, 96, -627, 3315], [75934, 12398, 813, 8352, 4609], [-66003, 12386, -1278, -264, -2339], [-157, 7379, -9090, 5504, 1005], [-77432, -18805, 5140, 3370, -254], [-38678, -5834, -6774, -1556, 3534], [-57103, 2208, -2270, 10904, 1241], [52173, -5838, 5693, 5436, 692], [63552, -15568, 5280, 5588, -656], [24292, -4495, -659, 2013, -5116], [-5708, 27521, 2888, 6346, 872], [76304, 2133, -11439, -5591, 576], [-96218, 17545, 517, 4007, -270], [-89067, 16344, 2928, 7340, -2569], [-85339, 9561, 3910, 10204, -1281], [-4563, -13869, 3784, 8595, 780], [49986, -5417, -4235, -15358, 935], [3107, 494, -359, -5155, 679], [89296, -4815, -3262, -606, 1126], [-8917, -4585, -7834, -9737, -1074], [-46776, 20595, 3703, -799, 1583], [-129039, 5060, 6691, -6275, 471], [3387, 3740, -4052, 2209, 3394], [-91636, -7943, 8117, 3651, -2028], [9384, -29456, 5176, -6496, -4220], [5628, 14573, -9527, -6360, 2859], [-67891, -4358, -4563, -6025, -852], [-3070, 3759, -8741, -13177, 1796], [-29855, -9355, -8626, -5105, -2509], [62580, 7504, 2641, -5383, 2192], [-35450, 20640, -6002, -1975, 683], [-52335, 18130, 1752, 6574, -337], [-80418, 21858, 4550, 1190, -798], [-7998, 25325, 1583, 1186, 2878], [-8545, 6615, -8249, 11885, 2961], [33613, 2576, 2071, 15404, -683], [-22626, -6631, -4457, -3699, -2742], [-55000, 8482, 10688, 18112, -2008], [134386, 24468, -8256, -4420, 290], [13256, 16307, 6625, 4500, -4311], [-17122, -7197, -5585, -13294, 1793], [71086, -13619, -883, -5711, -504], [-76864, -20961, 5048, -4280, 76], [-113672, 3499, -10233, -4654, -4545], [-16860, -1205, 3611, -2931, 2639]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_1840_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_1840_4_a_o();".
// 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_1840_4_a_o(:prec:=5)
    chi := MakeCharacter_1840_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_1840_4_a_o();".
// 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_1840_4_a_o( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_1840_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,4,sign)));
    Vf := Kernel([<3,R![-2296, 1211, 121, -78, -3, 1]>,<7,R![161268, 49858, -2141, -484, 8, 1]>],Snew);
    return Vf;
end function;