
// Make newform 1911.4.a.l in Magma, downloaded from the LMFDB on 09 September 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_1911_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_1911_4_a_l();".
// 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_1911_4_a_l();".
// 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 := [104, 6, -22, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0], [0, 1, 0, 0], [-11, -1, 1, 0], [24, -11, -3, 1]];
    Rf_basisdens := [1, 1, 1, 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_1911_a();"
function MakeCharacter_1911_a()
    N := 1911;
    order := 1;
    char_gens := [638, 1522, 1471];
    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_1911_a_Hecke( : Kf := Kf)
    return MakeCharacter_1911_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]];
    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], [-3, 0, 0, 0], [6, 1, 0, 1], [0, 0, 0, 0], [4, -5, -8, 3], [13, 0, 0, 0], [-2, 6, -8, -8], [84, -6, 0, -2], [0, -6, 20, -12], [6, -4, 20, 12], [44, 26, 12, 18], [-70, 34, 32, -2], [82, -31, 28, 1], [-48, -8, -76, 24], [208, -93, -16, -11], [142, 66, 92, -46], [76, 59, 36, 29], [326, -80, 96, 12], [-140, 182, 44, 10], [-144, 31, -72, -1], [386, 4, -8, -24], [160, -132, -80, 44], [772, 41, 44, -29], [-278, 7, 124, 51], [482, 28, -208, 28], [2, 244, -112, 58], [156, 38, -176, -6], [804, -56, -80, 66], [-554, -156, 60, -132], [234, 378, -128, 54], [-312, -160, -128, -200], [-580, -238, -56, -2], [-810, 155, -328, 57], [8, -192, 4, 112], [1314, -85, -24, 17], [-424, -206, -416, 98], [714, 530, -92, -98], [-1212, 452, 316, -8], [448, -25, 16, -199], [-910, 332, 312, 194], [108, 354, 720, -124], [522, 18, -204, 130], [-1168, 460, -220, -90], [-1122, 212, 348, -132], [1010, -151, -8, 251], [324, 990, 120, -190], [580, 404, 464, 272], [488, -98, 264, 50], [44, -41, -316, 297], [-706, 1048, -144, -12], [1066, 138, -216, -22], [792, -957, -16, -1], [1962, 824, -264, 220], [564, 490, 424, -78], [1958, -60, -48, 30], [-3648, -494, -4, -308], [2938, -768, -264, 26], [-412, 32, 956, -212], [-1014, -976, 84, -276], [2014, -1429, 432, 241], [2624, 1180, -412, 268], [4774, -945, -736, 39], [180, -396, -944, -396], [2760, 66, 232, 498], [-2654, -926, -508, 674], [5466, -935, 104, 163], [3916, 1138, 92, -530], [4390, 102, -308, -494], [3652, -342, -952, 396], [4646, -1150, -656, -422], [-1278, -431, -1436, -43], [64, -17, 1880, -169], [2992, -510, -76, -234], [162, 2078, -172, -142], [-1188, 840, -772, -636], [1528, -1611, -312, 95], [5790, -734, -340, -98], [230, -1086, -272, -10], [5358, 625, -160, -661], [3954, -352, 472, -864], [-4964, 1378, 192, -230], [7346, -348, -904, 460], [-2408, -2031, 1064, -619], [-1302, -3342, -92, 306], [1744, 650, 524, -1474], [916, -416, -1520, 286], [3054, 2341, -168, -773], [-958, 2758, 504, 578], [-4434, 4237, 96, -31], [-3456, 144, -640, 592], [2772, -1490, 184, 422], [-2392, -519, -1112, -297], [-4112, -3542, 224, -470], [-7740, -264, 440, 1230], [-4748, -578, 1084, 2], [-160, -2034, -1248, -1510], [-8138, 2125, -336, -467], [-6538, -776, -232, -1562], [-4784, -4508, -692, 1172], [2810, -3580, 1392, 284], [-5464, -2072, 412, 1036], [10962, 2011, -560, -551], [4484, -2460, -344, 360], [1170, -2050, 248, -786], [-3300, 964, -848, 284], [-1710, 2246, 1304, -390], [8204, 2053, 1516, -109], [-3342, -2425, 388, 647], [-216, 814, -1252, -660], [-1334, -418, 2132, 62], [9352, 2274, -1012, 78], [-4674, -1674, -1052, 1634], [-3690, 503, 920, -331], [7496, 1136, -1988, 28], [11400, -2218, 2008, -18], [19402, 1616, -256, 796], [-308, -2320, -4296, 608], [9760, 2604, 704, 1112], [6086, 2464, 1420, -280], [-4748, -458, -4424, 1460], [-7202, 4102, -528, -402], [3734, -2364, -3044, -136], [370, -2206, -3928, -900], [6500, 1687, -1432, 1331], [3032, -4120, -1612, -284], [18374, -2950, -2364, -258], [-9306, -1224, -868, 416], [-1520, 390, 1208, -910], [-9016, -1706, 3604, -1814], [-914, -2168, 2600, -1668], [3620, -4022, 620, -354], [-17520, 299, 2144, -637], [-4892, 2552, 740, 2216], [2946, 2266, 5388, 238], [-4278, 3785, 3556, -415], [15602, -4810, 3408, 1214], [5142, 4007, 1552, 2711], [24224, 624, 2428, -1068], [-11950, -110, 2448, 1460], [25026, 3702, -856, 1874], [-14528, -2966, -1228, 370], [-1854, -6065, 696, 301], [-13812, 10136, 1620, -252], [-10108, -1037, -1728, 99], [-730, 3548, 392, -500], [-18640, 337, -5280, -305], [-2762, -586, 3464, -1046], [11030, 1144, -968, -1918], [4928, 2920, 3556, -2288], [5832, -3531, -696, 2581], [7750, -4258, 3940, 778], [8710, -2284, 128, 82], [732, 2068, 3336, 1920], [4944, 2040, 5928, -492], [22084, 5364, -1856, 1128], [-9104, -1480, -4164, -3422], [-6648, -5204, -1192, -2352], [33682, 2269, 932, -1043], [6130, 2966, 1492, 1566], [16342, -3429, 384, -233], [-6644, -3915, -7656, 569], [10706, 7902, 40, 442], [-22312, -2414, 3640, -702], [7580, -1900, -8024, 508], [-1394, -8887, -3840, 2435], [15824, 2293, 3424, -1953], [-17572, 9132, -3948, -1900], [-19726, -2490, -4500, 74], [23822, -6150, -3804, 110], [21314, 1288, 1728, 3222], [-26300, 581, -2720, -1487], [8446, -6750, 1976, -970], [4512, 2098, 3708, 560], [17198, 4762, 4412, -1826], [19536, -2582, 1524, 2174], [14590, -5430, -960, 1196], [-17404, -1510, -6508, -3378], [5122, 5535, -4248, 257], [-36748, -154, -3144, 314], [11646, -3836, 2856, -2112], [-13856, -4020, 4880, -596], [37972, 2752, 408, 168], [-18026, -4962, 888, 662], [15474, 483, -3908, 299], [-23960, -1205, 2912, -97], [-1390, 1290, -1576, -1244], [-1930, 5500, -8056, 2076], [-16344, -1882, 700, 2422], [-37194, -1254, -3380, 1230], [-4104, -7033, -672, -331], [-2186, 12724, 2288, 1728], [9620, 703, 6312, -2641], [13000, -4396, 5964, 2196], [-33634, -5473, 5992, -1473], [30708, -4254, -4392, -1392], [20686, 9088, 864, -3858], [-6746, -8512, 932, -248], [-3730, 5782, -9640, 2686], [-3246, -5213, -5604, -1033], [30128, 3664, 4880, -1724], [32514, -6443, 7696, 975], [29504, -5950, -1668, 2246], [-11090, -3244, -1776, 2504], [5214, -3516, -7288, 1144], [22540, 3455, 11972, -3315], [17322, 5982, 1432, 6912], [-24408, 7582, 8432, -2182], [-19076, -2848, -712, 490], [21710, 4433, 3808, -3105], [22184, 1940, 6292, 2772], [-7610, 3902, -692, -2334], [29298, 2710, 4176, 3092], [18400, -11324, -5480, -3248], [-25412, 8681, 5524, -557], [16336, -13935, -5528, 2103], [-14054, -6218, 3632, -4750], [-63224, 4796, 2208, 1976], [-8418, -1462, 520, 1964], [6640, 6111, -4856, 2435], [10058, -9981, -8008, 2301], [-27650, -2960, 4272, -2128], [-31972, 8400, -4524, -316], [16462, -7555, 2280, -869], [-24832, -5666, -10664, 3646], [12084, 7594, 4680, 4054], [-16486, -8092, -1532, 400], [4398, -5226, 2400, 4884], [-1808, -4554, 3404, 5504], [-31688, 2842, -5924, -4866], [-10796, 8933, -11424, -995], [50950, 1216, -48, 2336], [-7668, 248, 7680, -2192], [29784, 10412, 3856, -3284], [40498, -7320, -10168, 992], [12860, -7660, -11992, 1628], [48160, -8645, -6624, -863], [3658, 5432, -10920, 4300], [10642, 4635, 8984, -2871], [33908, 5210, 3416, -3540], [7224, -1288, -17024, 5672], [-38852, -10209, 5128, 371], [-38716, -2924, 624, 4516], [-15764, -7918, 8224, 1838], [13538, -6090, 8552, 1466], [23586, 83, -3780, -993], [41824, -8806, -112, 2410], [-26940, -11348, 6036, 1496], [5916, 8411, 4396, 5669], [8124, -4956, -10836, 808], [17768, -9386, -7572, 1200], [23454, -17740, 3252, -2148], [3354, 16993, 2092, -4043], [-19664, -10187, -3336, 2649], [5306, 8630, 1356, 1050], [35242, 1844, 4976, -5678], [31948, 4783, -8392, 3495], [21790, -7990, 7864, -1678], [-11764, 3434, 2848, 1630], [-22798, 23090, -6024, -1716], [46514, 1490, 7952, -3318], [-13392, 5308, 5552, 7092], [-10116, -11986, -2104, -5456], [22158, -4460, -2896, -4380], [2594, -482, 3156, -10046], [-26366, -5621, 28, -1885], [-38012, 20304, -2488, 184], [12746, 15169, -5816, -2045], [8898, -25643, 2572, -2591], [67412, 6890, 1460, -6546], [-370, -7036, 12412, -5908], [21766, -7536, 648, -8500], [-18652, 3042, 20188, -4266], [14138, 7672, -2768, -4644], [22076, 1508, 16980, -1684], [53738, -6766, 6172, -4634], [16708, 4624, 11996, 3876], [24996, 6805, 12880, 4393], [51706, -186, 416, 418], [44286, 11824, -4772, 3600], [-22492, -25518, 1232, 2026], [43904, -20, -10792, -1444], [-18200, 17992, 13960, 1280], [-8880, 15612, -8512, -2116], [35598, -16070, 13152, 1118], [-47888, 11268, 1380, 4760], [-27176, -404, 556, -3234], [-27642, -5666, -12116, -10710], [7906, -6573, -14776, -3991], [-71788, -2542, 2756, -1798], [-42226, 1580, 3576, 1454], [-978, 18298, 8732, 7570], [12612, -35124, -3016, 2028], [40286, -2843, 5992, -6057], [-62964, 11315, 3900, 1725], [-10650, -2524, 7928, -4100], [-55526, -4282, 200, -1736], [9048, -20902, -924, 5862], [9594, 7882, 18904, 616], [20060, -22248, -10416, -2500], [69280, -6280, -14084, 3764], [-31778, -3200, -6152, 2792], [32554, 10837, 13768, -525], [31916, 23872, 2820, -2548], [-54340, 19014, 15448, 3572], [-75960, -5284, -5252, -608], [-47870, 2134, 4696, -3854], [-40092, 6030, -12712, -192], [47394, -17394, -5364, -5074], [-400, -1587, -776, -4223], [-5490, -6870, -10272, -3566], [29312, 7490, 2680, -9074], [-44790, 3421, -3392, -149], [5026, -5362, -3280, 1278], [55172, 16852, -16560, 9664], [-11584, 6187, -8960, -5441], [-46854, -2494, 14004, -1858], [-70908, 20835, 16196, 2073], [-47288, -12571, 1536, -8547], [41922, -26036, -23672, -2060], [-106390, 11464, 11624, -1004], [-50932, 26104, 5648, -4592], [-16170, 17916, -18332, -4836], [33882, -6238, 9832, -940], [-30248, -16554, 8160, 814], [94, 9161, 14944, 8687], [-10334, -5806, -21196, 3646], [-45940, 24088, 2892, -1572], [-9532, -15884, -2768, 1900], [18632, 26404, 13084, -8338], [-87554, 11444, 7452, -4036], [-49290, 12264, 6812, -1288], [-15698, -9780, -1340, 8980], [69648, -3362, 16516, 11114], [-29788, -8727, -18124, -3065], [44892, -11912, 12196, 5540], [-63468, 6565, 16132, -4365], [-2514, -2666, 13572, -10686], [72682, 12365, 9812, -13795], [58834, -12468, 8128, -1340], [26956, 20018, 14384, 6702], [45638, 23798, 7204, 6674], [102306, -1150, 10344, -2070], [43966, -24045, 6328, 7511], [-96852, 17896, 4108, 4952], [-2534, -23931, -328, 3659], [78220, 3726, -15136, 10532], [81190, 3320, 8616, 6928], [-55524, 10164, -10972, 312], [114120, 8871, 6600, -555], [-163166, 1834, 1032, 4860], [-27676, -36800, -1744, 5488], [-7106, 24262, -17588, 1890], [-17350, 11411, -4040, 5593], [111172, -15042, -19448, -318], [-18814, 38006, -6780, 4378], [-70130, 27708, -18336, -1774], [73720, 24679, -11616, 1549], [-52724, 14071, -4388, -3347], [-23262, 3818, 9632, 1734], [-64160, 4169, 7304, -7555], [-71234, 6690, 17324, -1330], [12566, -20018, 3880, 8828], [-105920, 11166, -15084, -7404], [23876, -11067, 12896, -2391], [-38856, -23676, -9020, -4356], [-96866, 1228, -16228, -3320], [-86890, 18209, -18528, -4855], [992, 17870, 6616, -15714], [-39914, -35020, 9380, -6512], [41148, -28460, 0, 2506], [-104972, 26700, 17376, -2628], [-86824, -32057, 944, 7599], [78166, -51098, -2764, -114], [-14568, 30946, -5708, -5178], [181794, -10880, 21532, 4868], [29596, -36975, 8076, 1883], [-69864, -17776, 11524, -106], [-24958, 19302, 21992, 2826], [5782, -35590, 14576, -2516], [-119626, 13696, 15832, -5380], [-57642, 1083, -27168, -5805], [-3658, -18921, -21296, -1759], [-42576, -29924, -4304, 9532], [77358, -5027, 24408, 851], [25736, 6098, 20988, -13510], [65448, -22431, 24440, -1957], [-111360, -26140, -6528, -2676], [-160266, -4252, -6368, -2876], [-20836, 19168, -16740, 4260], [-57560, -8994, -2192, 3982], [7902, -7702, -49084, 9462], [84246, 4887, -3288, -501], [-37388, 27103, -2440, -1649], [-49752, 28076, 9180, 7396], [-56944, -17225, 19344, -12297], [23582, -9922, -14532, -8054], [-29616, 15440, -13768, 12968], [-56802, 19674, 39200, -7476], [54748, 9612, 12400, -17364], [31698, -35295, -15160, -3001], [3134, -37626, -14728, -3094], [15834, 5312, 8480, -1864], [39608, -8940, 16032, -8172], [80986, 32579, -892, -12145], [-80234, 30165, 13192, 10517], [-35388, 25558, -18200, 1450], [55050, -30648, 16688, 6376], [28334, -10943, -2040, 10279], [-97216, 55292, 13948, 1400], [48852, -12963, 12756, 9971], [11054, -10700, -5528, -19668], [90798, 32450, -15380, 12230], [39588, 25918, -17680, 16128], [-27832, -19616, -21036, -1392], [-157402, 4768, -18876, -1084], [24314, 4074, 37040, -7104], [-47640, 40931, -7832, -8809], [102528, -11554, 13660, -10150], [27610, -29541, -7916, -917], [61816, -56258, 600, 454], [-11394, 34896, -3692, -3120], [-101530, -6622, 10488, -7190], [-72872, -12193, 31144, -6713], [-70268, 25334, 16120, -5830], [96666, -57726, -20536, -7142], [-44290, 8871, 19888, 12031], [19876, 8312, -21984, -6826], [91062, -16899, 15200, 9879], [-75184, -4902, -22468, -11214], [-106000, 1552, 3912, 17852]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_1911_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_1911_4_a_l();".
// 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_1911_4_a_l(:prec:=4)
    chi := MakeCharacter_1911_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_1911_4_a_l();".
// 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_1911_4_a_l( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_1911_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,4,sign)));
    Vf := Kernel([<2,R![88, -37, -19, 3, 1]>,<5,R![-2112, 1504, 44, -24, 1]>],Snew);
    return Vf;
end function;