
// Make newform 460.4.a.a in Magma, downloaded from the LMFDB on 29 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_460_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_460_4_a_a();".
// 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_460_4_a_a();".
// 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 := [72, 255, 104, -55, -2, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0], [-1, 2, 0, 0, 0], [348, 58, -61, -1, 1], [306, 361, -107, -7, 2], [118, 68, -51, -1, 1]];
    Rf_basisdens := [1, 1, 30, 30, 10];
    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_460_a();"
function MakeCharacter_460_a()
    N := 460;
    order := 1;
    char_gens := [231, 277, 281];
    v := [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_460_a_Hecke(Kf)
    return MakeCharacter_460_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, 0, 0, -1, 0], [5, 0, 0, 0, 0], [-5, -1, -2, 1, 0], [-12, 1, 0, 2, 3], [-22, 0, 1, 8, 2], [-10, 3, 7, 6, -2], [-44, 2, -7, 3, -5], [23, 0, 0, 0, 0], [43, -11, 13, 3, -6], [-107, -5, -10, 4, 3], [-16, 26, 1, -24, -21], [-22, 1, -1, -23, 9], [-63, -31, 6, 12, 16], [-48, 0, 52, -25, 9], [69, 45, 1, -46, -5], [-295, 21, -15, -38, -3], [-144, -7, -30, -42, -15], [-84, 30, 31, -92, -63], [-309, 26, 45, -95, -35], [-163, -57, 26, 79, 1], [-599, -47, 6, 6, 6], [-87, -95, -1, 84, -9], [-243, 89, -34, -112, 32], [-308, -35, -148, 16, 25], [373, -113, 59, 50, -17], [-219, 96, -68, 88, 5], [-554, -60, -171, 50, 47], [-644, 8, 51, 107, 5], [492, 48, -17, 116, 13], [-168, -30, -34, -105, 51], [185, 63, 178, 63, -33], [249, -15, 65, 151, 101], [-40, 56, 63, 61, 108], [-225, -129, 49, 263, 79], [-442, -45, -30, 243, 204], [618, 24, -115, -228, -127], [-711, 57, -123, 188, 0], [-336, 36, 88, -124, -96], [1019, -72, 42, -212, 175], [-953, -89, -134, 225, -97], [-196, -108, -295, 97, 209], [30, 192, -136, -434, 8], [1253, 247, -216, -193, -125], [76, 151, -104, 33, 58], [-453, -79, -222, -108, 104], [-495, -283, -141, 156, 91], [1706, 170, 170, -292, -42], [-295, 273, 88, -354, 86], [281, 343, 100, -218, -244], [1659, -151, -144, -359, 245], [-2102, -96, -11, -41, -214], [3356, -100, -290, -54, 76], [1791, -123, -131, -13, -129], [-1511, -37, 168, 81, -139], [-1017, -350, -351, 620, -62], [-1003, 135, 383, -253, -104], [-1672, 278, 136, 219, -150], [4993, -173, -4, -227, 51], [-911, 289, -258, 394, -212], [3035, -237, 445, -34, -181], [-1497, 123, -413, -520, 163], [249, 192, 64, 238, 369], [-691, -267, 16, -483, -97], [3294, -52, -246, 171, 372], [-1903, -141, -457, -151, 259], [-34, 74, -27, 361, -238], [1920, -20, -265, -409, -455], [-4201, -16, 946, 190, 161], [-3327, -123, -483, -85, -164], [-1863, -267, -144, -489, -159], [-4125, -11, -20, 868, -46], [-1995, -105, -457, 930, -343], [5334, -332, 438, -50, 14], [-941, 614, 168, 944, -307], [-5836, 430, -343, 202, 253], [-3731, -152, 2, -304, 39], [1484, 535, 686, -705, -342], [-1990, 264, 570, 358, -186], [-458, -126, -440, -768, -89], [-6577, -261, 280, 1260, 546], [-332, -760, -545, 739, 965], [-4343, -255, -172, -546, 110], [1322, -384, 366, -909, 14], [-3630, 426, 337, -1412, -858], [-1631, -251, -1183, 440, 1086], [-3950, 146, 402, -1983, -492], [-4783, -251, -445, 348, -185], [2280, -42, -812, 611, 805], [2620, 42, 240, 202, 922], [-2025, -289, 49, -1200, -753], [-3844, -466, 1154, 1734, 168], [274, 276, -558, -2033, 459], [210, -448, 889, -1257, -140], [-1424, -614, -1345, 787, 80], [1070, 50, 486, -25, -712], [-1600, 352, 698, -575, -251], [4290, 756, 2248, -190, -526], [6731, -51, 728, -122, -748], [7750, 146, -428, -2093, 167], [1791, -289, -715, -482, 108], [9602, -256, 693, -934, 173], [7871, 65, 1663, 1006, -863], [-8572, 882, 320, -1096, 508], [-3395, 1222, 500, 580, -489], [-4925, 705, 266, 509, 501], [187, 1068, 162, -1105, -562], [-10384, -986, -492, 978, 424], [2845, 220, -710, 2622, 1143], [3128, 40, 1434, 1424, -823], [3602, -314, 368, 312, 1160], [4868, -274, 348, 2218, 498], [-8399, 970, 759, -1688, -638], [5755, -287, -1189, 1507, -279], [-3723, -1573, 294, 1320, 1070], [-6527, -1419, -812, -1760, 98], [10993, 27, -117, 1570, 175], [8162, -260, -714, -2313, -1091], [9172, -730, -683, -1000, -582], [-4618, 594, -726, 928, 1222], [6579, 1552, 290, -1174, 7], [-8903, -553, -2958, 815, 215], [-4065, 927, 1971, -1410, -747], [-5797, -1533, -1273, 2876, 410], [1252, -1888, -166, -402, 454], [6112, 1372, -561, -1127, 125], [-6014, -315, -842, 156, -1471], [14620, 1190, 760, -1891, -794], [15436, -195, 2279, 128, -1140], [-7097, 715, 925, -1108, -1075], [3494, 824, -1943, -3, 412], [-13209, 1209, -213, 1923, 565], [-10255, 1647, 644, -1700, -1452], [-2304, 1054, 523, -2436, 761], [-12510, -810, -684, 912, 1167], [-1414, 1856, 862, -2340, -394], [-1449, 299, -1232, 2676, 1614], [15143, 183, -2291, -1042, 297], [48, 320, 1767, -404, -1089], [1024, 2077, 943, 594, -1272], [2162, -1460, 779, 3489, -1076], [-12094, 968, 568, 1372, 172], [-1558, 2048, -52, 875, -1105], [1577, -1175, -753, 102, 799], [11091, 2019, 477, 1070, -145], [4253, -927, -746, 5082, -232], [-9479, -2569, -481, 4599, 827], [2021, -1265, 1860, -477, -31], [21628, -1346, 1759, -67, -1396], [3288, 626, 2040, -1133, -1611], [1609, -200, 2692, -64, -1045], [-10268, 1556, 2212, -1900, 392], [-2901, 283, 583, -4005, -1049], [1790, 302, -1172, 1705, 2025], [-6602, -640, 1541, 3966, 387], [-11507, -195, 2840, 4620, -1036], [24169, 2569, 2662, -2260, 452], [2821, -1759, -215, 6233, 886], [-354, -1382, -1653, 421, 203], [-7925, -460, -1668, 1236, 1199], [-9647, 585, 5165, -1164, -1818], [-28455, -618, 594, 174, -741], [32870, 1140, 82, -1177, -885], [6395, -706, 1132, 2818, 2067], [-18673, -3359, -1180, -3731, -346], [15552, 1045, 397, 2332, -410], [-29172, 1089, 1011, -1972, 130], [-11002, 1328, 1322, -4, -130], [-18699, 947, 1906, -370, 424], [5426, 457, 2206, -3517, -50], [-7845, -1089, 1470, -1026, 1470], [9751, -259, 899, 15, 1400], [-18208, 368, 3456, 170, 144], [-24106, 545, 1123, -1290, -1892], [19394, 579, -50, 1169, 942], [-5387, 845, -160, 94, -2162], [-30385, 1081, 54, -583, -591], [25643, 321, -537, 4411, -242], [18167, -2408, -643, 1212, -1152], [2439, -1609, -3269, 581, 2627], [12576, 3594, -252, 1547, 765], [-19194, 2425, 422, -1584, -4095], [12844, -3958, 557, 1278, 2496], [-35858, 402, 1052, -1500, -1262], [-25630, -1437, 1995, 724, -32], [19129, -47, -4013, 2445, 2067], [10501, -1849, -1879, 129, 177], [-25288, -834, 753, -5292, -673], [-962, -1291, 427, 4039, -317], [12576, 743, -2031, -6176, 318], [-27061, 2697, -1146, 2109, 2151], [8756, 3136, -122, -8116, -1394], [2530, 506, 1762, 2278, -2624], [26181, -449, 2263, 52, -2157], [7830, 672, -1750, -4400, 994], [-8863, 2247, 3782, 785, -2654], [11023, 1531, -3366, -264, 722], [-15262, 360, -1944, 3942, -2326], [14116, -998, 1768, -2166, 1734], [2218, -2954, 3202, 1329, -31], [-167, -2774, -436, -5152, -449], [421, 2565, -1187, -1287, -623], [-9666, -2195, -1700, 2493, 3794], [-15085, -37, -6084, 3634, -1332], [30578, 1866, -852, -1844, -2044], [23583, -107, -1040, 1069, 619], [-5655, 2871, -3604, -6912, 1050], [-22909, -1330, 1742, -4929, 988], [43536, -1384, 1542, 2320, 99], [-4635, 957, 5238, 3269, 2447], [21669, 553, 5136, -1589, 127], [51380, 338, -3218, -1493, -951], [10842, -1152, -5727, 2195, 1549], [-6852, -304, 1530, 6424, 5004], [29585, -485, -211, 130, 4395], [-22103, 449, -2420, -1430, -1334], [-25786, 2076, -1940, -487, -3069], [19693, -4095, -2217, 3863, 1270], [-21352, 956, 388, 1357, -1894], [9033, 563, 744, 5971, 3129], [5629, -4465, -3673, 6621, -122], [10601, 1447, 3930, 8204, -2140], [16074, 2463, -2231, -6781, 371], [-4701, -497, 2750, 1307, -5360], [27492, 4300, 4264, 3037, -1599], [10145, 4623, -5143, 4573, -188], [158, -5430, 1921, -1641, -1519], [-20471, -2901, -410, 70, 3477], [-299, -3477, -3291, 5023, -67], [-50115, -1337, -569, -2234, -2907], [8829, 523, -2281, -6781, -2281], [-42274, 223, 5392, -2780, -227], [-17136, -2192, -2982, -11162, 600], [26490, -235, -4065, -5270, -834], [-12511, -2797, -185, -2520, 509], [5465, -3163, 3430, -4280, -924], [-21512, 3264, -994, -9190, -446], [32209, 3609, -1274, 3184, -922], [-35146, -36, -1961, 6021, -3516], [-12983, -2138, 1181, 983, 1785], [12093, -917, -4237, 6372, -1183], [-3934, -1550, -2781, -7795, 98], [-15202, 1244, -2794, 2927, -943], [-9024, 502, 1048, 57, 4647], [36920, 6928, -250, 2620, -1012], [-8108, 7220, -1885, 9004, -554], [42646, 478, 4188, -4173, 649], [5325, 3639, -781, -6749, -533], [-9289, 3846, 7366, 2978, -5275], [-10226, 6153, 3285, -3160, -5620], [-29080, 1502, 2394, -9884, -1640], [39202, 648, -5458, -4758, -2498], [-24104, 4600, 4608, -6383, -1630], [697, -5475, 2280, 1720, 2506], [64904, -3874, 536, 1920, -2864], [-4228, -980, 465, -1851, 4806], [-45886, -499, 7146, 3850, 2851], [31696, -4258, -584, 10858, 1760], [2948, -3382, -1667, 6406, 3180], [24217, 3267, -1532, -4695, 83], [-38662, -4399, 4963, 8634, 3124], [-10234, -5794, -2325, 80, 493], [-28523, 3887, -3091, 1512, -3755], [53928, 7994, -959, -9844, -3151], [-20402, 648, 282, -9556, -3102], [-26640, 1893, 3402, -3346, -2611], [-6264, 1941, 9126, -2766, -4539], [-3795, -205, -6426, 5422, 2994], [18430, -1210, -8239, 840, 5665], [30642, -3556, -283, 13856, -808], [-25725, -4043, 2847, -2993, -184], [-9053, 865, -9095, -1216, 2045], [-21615, 3151, 1598, 11531, 2422], [3411, -3417, -9148, 1272, -1390], [-5195, 7559, 1626, -3319, 3481], [6634, 1392, -6384, 9385, 187], [-35967, -2964, 510, 11778, 3879], [-64887, -2713, 4641, 6666, 3485], [-69396, 2306, 1822, 1208, -2578], [19475, 1929, -2895, 7633, -1405], [1770, -3114, -848, 17483, 771], [-46518, 3030, 5840, 5334, 2258], [10220, 1883, 2606, 7134, 4407], [10602, 4040, -398, 152, 1266], [-58295, 1193, 3161, 7419, 3553], [17952, -4205, -1615, 1956, 3290], [-52771, -4691, -939, 11018, 2183], [27937, -4753, 3028, -1186, 5182], [-31949, -2534, 2410, -10690, -3657], [23849, -2996, 1448, 316, -2225], [50890, 8328, -588, -5248, -3868], [23819, 3795, -1557, -8210, -3005], [-31526, 3972, -10168, 1458, 76], [-37246, 2216, -4111, -1647, -2001], [-7148, -3, -6818, -8019, 1414], [-11349, -11980, 1720, 5850, 2209], [-53826, -9122, 5628, 13282, 6964], [39474, 3723, -3056, -18601, 3282], [26494, -582, 3993, 14399, -2482], [41919, -1016, 1950, -5267, -2836], [35431, -4027, 280, -1289, -560], [29450, 124, -6873, -6954, -3207], [-45510, 4260, 4500, 3848, 4246], [-2942, -1470, 2418, -16381, 897], [-43843, 3807, 1723, 6095, -3747], [-3903, -221, -10204, 8189, -695], [-52365, 5738, -6224, -4158, -331], [-211, -8383, -6469, 3821, 479], [-67034, -5142, -2106, 3524, -628], [23199, -6372, -54, -6040, -4005], [16846, 2606, 3004, -1477, -8215], [-32164, 5168, 3887, 129, -4453], [46234, -4068, -5468, 2464, 5138], [10237, -350, -9476, 581, 4438], [3455, 3731, -2606, 7873, 2214], [-26283, 5605, 3000, 9082, 5818], [42672, -4016, -3573, 2915, 2280], [37913, -6637, 6628, 6022, -1719], [-25837, -5437, -17111, -864, 5593], [43801, 1878, 6362, 2463, 7102], [18552, -433, 4738, -340, -2119], [76161, -2612, 10299, -2618, -4822], [39702, -5500, 3466, -4665, 6561], [31944, -8808, 3396, 566, -5384], [19814, -3729, -1573, 7280, -4908], [-12560, -4724, -4808, 15212, 1380], [-12947, 1091, -7691, -5561, 3429], [7389, 13953, -3035, -11084, -3884], [-32288, -3698, 7581, 205, 5043], [24175, -251, -5657, 11112, 10137], [-33013, -11605, -5181, 16933, 5762], [24036, 4437, -540, -3105, -6942], [40182, 800, -5417, -14191, 2558], [46283, -6073, -6379, -2904, -2124], [-78801, -5233, -1458, 2322, -5026], [3625, -4895, 2511, 9220, -4110], [17471, 3008, 3094, -16014, 267], [-28645, 7129, 7258, -17446, -5258], [27243, 7070, 6098, -5549, 1840], [-11609, 5446, 11319, -8130, -6866], [-37887, -6657, -7192, 14955, 2109], [6160, -9865, 5920, 11864, -133], [86228, 2908, 6430, 8306, -2328], [46762, -174, -6922, -16672, -644], [60227, -85, 10535, -114, 1637], [-2151, -3521, 4603, -16250, 37], [-57629, 8359, -2185, 3949, -6404], [-38847, -4839, -10133, 6157, -6545], [53848, 7242, -4496, -11804, -1408], [10289, 7435, 9367, -4870, -6401], [45376, -5090, 3049, -11911, 3518], [-38285, -10027, 8694, 17921, 2725], [48449, 2033, -2179, -4440, 2811], [16782, 5441, 22067, 5272, -8898], [-23352, -1270, -6286, -15914, -264], [8154, -2578, -6536, -3960, -4634], [-8730, 2448, 2370, -12492, 720], [-30481, 4917, 5239, 3399, -29], [14019, 2409, -3600, 20073, -1437], [-14796, -1878, -9816, 8634, 12846], [44251, 2927, 7495, 14500, -1327], [26535, 4279, -4121, -2693, 5938], [-45542, -8156, -9808, -97, -5939], [-9621, 4282, 8388, 1874, -6357], [36223, -6346, -11970, -10111, 8770], [12881, -2541, -128, -9643, 2263], [15390, -3639, -3826, 22627, -2250], [-79092, 6746, -7805, -220, 6077], [-9526, -12658, -4010, 14916, 5936], [6380, -2804, 19505, -13637, 2346], [-59031, 3585, 5849, 11622, 1473], [-44428, 5374, -278, 14567, 7805], [-54859, -9936, -3988, 15236, 9793], [-33648, 584, -5928, 624, -4896], [-27578, -8604, -4057, 25538, -1304], [96660, 1214, 2531, -9505, 9878], [-81157, -819, -1772, 10770, 7894], [-57736, -8965, -2141, 11052, -5646], [34342, -8510, 5118, -10670, -970], [48731, -797, -470, -4415, -2343], [13231, -1386, 10290, 28442, -4339], [-89344, -15605, -13568, -1102, 1353], [59132, -11310, -4476, 2736, 13482], [-54269, 1009, -3040, -9745, 441], [35809, 5453, 1902, -24352, 7196], [-14448, -14160, 2236, 2939, -1577], [-69281, 6801, 2834, 3710, -7079], [-8145, 7037, -8481, 921, 7519], [-16083, 1281, 20763, 11738, -6335], [73732, 180, 8, -20955, -3012], [-14676, -7402, -6852, -21558, -470], [-51941, -39, -4165, -2781, -13721], [-6404, 11438, 6795, -19881, -11288], [7500, 88, 3264, 10552, 10460], [23285, 3183, 15598, -15366, -2586], [-53552, 8326, 1926, -11889, 7798], [-18195, 607, 10726, -3018, 7714], [-41209, -6257, -15970, -15164, 1296], [50753, -6381, 10695, -2877, 9801], [-43393, -6577, -1911, -14038, -5769], [-6757, -977, 5455, 2719, -1824], [-9721, -2331, 16782, 21235, -2279], [81464, 5726, 14661, -3518, -7287], [-11938, 4068, -2402, -19533, 6108], [-39041, -3027, -2313, -385, 5390], [-35403, -4574, 825, -26519, -1261], [-52566, 3108, 6613, 3310, 7807], [-90863, -8297, 815, 2690, -2564], [41813, -9051, -9572, 5150, 11430], [-43476, -16060, -2688, 6160, 4884], [-43187, 10087, -5792, -7639, 7125], [-136540, -573, 13508, 6299, 4256], [7089, 9533, 3582, -13574, -15222], [7673, 6666, 3996, -13458, -11191], [79265, 10239, -2042, 14447, -1100], [-51870, 4760, -5558, 11685, 5683], [-16105, -3341, -22841, 15155, -421], [-61564, 5964, 15174, -462, -10774], [56919, -512, -10235, -13142, -4230], [-17038, -11804, -14347, 12151, 369], [-56552, 3219, -4396, 20160, 3135], [46069, 4185, 4498, -6750, 1884], [-95016, 5700, -1592, 19010, 312], [54910, 9574, -6462, -2750, -4682], [54341, -9651, 2334, -10059, -15177], [58109, -12877, 4170, 23135, -7157], [-61829, -4249, 9094, -9502, -10510], [6428, -8768, 1480, -5293, 11082], [-39593, 6021, 5280, -16835, 7981], [50489, -2406, -15727, 10589, -2205]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_460_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_460_4_a_a();".
// 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_460_4_a_a(:prec:=5)
    chi := MakeCharacter_460_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_460_4_a_a();".
// 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_460_4_a_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_460_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,4,sign)));
    Vf := Kernel([<3,R![12, 123, -385, -58, 7, 1]>],Snew);
    return Vf;
end function;