
// Make newform 936.4.a.l in Magma, downloaded from the LMFDB on 26 December 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_936_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_936_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_936_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 := [-6, -16, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0], [-1, 4, 0], [-21, -4, 2]];
    Rf_basisdens := [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_936_a();"
function MakeCharacter_936_a()
    N := 936;
    order := 1;
    char_gens := [703, 469, 209, 145];
    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_936_a_Hecke( : Kf := Kf)
    return MakeCharacter_936_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 := [[0, 0, 0], [0, 0, 0], [1, 0, -1], [2, 1, 1], [-11, 1, 0], [13, 0, 0], [-50, -4, 4], [26, -9, -1], [-56, -4, 4], [-74, 6, 6], [16, 15, 9], [-28, 0, 6], [-33, -14, -9], [46, 14, 12], [-119, 31, 2], [108, 6, -28], [-349, -7, 6], [-64, -8, -14], [136, -49, 5], [-543, -39, 24], [-324, -16, -14], [236, 40, -28], [-775, -1, 14], [229, -18, -15], [-284, 8, -102], [458, 50, 38], [-58, -66, -80], [-596, -36, -60], [-706, -40, -16], [-72, 12, 94], [-1144, -22, -66], [-924, 108, 52], [903, 58, -9], [-1122, -4, 94], [811, 16, 201], [-2088, 9, -65], [-364, 148, 42], [-554, 5, -115], [257, 71, 122], [1750, -146, -50], [426, -146, -40], [532, 32, -10], [-1734, 78, 108], [54, -52, 232], [-419, 272, 139], [-1444, -42, -178], [356, 228, 132], [748, 71, -179], [-845, 43, 44], [-1786, -84, 188], [-1628, -76, -310], [-187, -35, -368], [1196, -248, 18], [22, 126, -164], [-2336, 12, -202], [-2690, 26, -180], [322, 70, 34], [-1078, 289, -15], [-2302, -84, -312], [-1841, -374, 95], [-236, -34, 146], [4187, -140, 37], [-2744, -231, -325], [-3284, -44, 208], [5122, 144, -88], [1677, 460, -377], [344, -221, 201], [6210, -72, 56], [3072, -680, -292], [-1736, 172, 6], [-4389, -138, 375], [3173, -125, 258], [2202, -236, -186], [166, -204, 548], [4518, -77, -137], [1115, -79, -126], [5576, -122, -400], [-1712, -20, 494], [5409, 34, 129], [-1916, -108, 262], [-48, 436, 472], [-2090, 660, 36], [-4565, -71, -38], [-6664, 368, -250], [5310, 466, -380], [-1988, -252, -292], [9413, 98, 373], [8004, -492, -234], [4185, 412, 243], [-7714, -75, -335], [10066, 298, -44], [9307, -177, -236], [-1780, -137, 37], [-5934, 666, -372], [-4736, -413, -167], [-1642, 826, 884], [3393, -452, -565], [2548, 296, -602], [6750, -116, -306], [242, -16, 316], [7526, 280, 450], [6827, 600, 73], [4822, -798, -624], [-20644, 96, 198], [15552, -194, -386], [1746, 528, -544], [-23523, -5, 190], [-763, 1626, -19], [-6394, 1022, -320], [626, -728, 1312], [-9690, -116, -310], [5832, 272, 1210], [-2181, -1518, 371], [-4392, 833, -229], [22784, 353, 79], [6034, 1396, -608], [5672, 1459, -959], [-11908, -660, 104], [-24122, 474, 338], [10288, -600, -508], [-160, 204, -1434], [11332, -1488, 2], [-16168, -718, 148], [-2175, 1417, -220], [14932, 191, 881], [-76, -1198, 568], [-7326, -876, 336], [14732, -668, 648], [1548, 1378, 1826], [4918, -76, -484], [-17056, -935, 835], [-7575, -559, -1944], [-4854, 590, -340], [7776, 900, -418], [3751, -46, 783], [-3278, 996, -436], [131, 1920, 257], [8036, -2207, -1105], [-404, 1310, 420], [-7072, -1032, -1886], [10946, 1559, 415], [-12865, 1784, -171], [-27114, 226, 76], [32761, -259, -424], [-9708, 1780, 490], [-11581, -157, -800], [15380, 268, 1658], [-6704, 1768, -622], [-16620, -488, 168], [2779, -1787, 1102], [-11100, -164, -1102], [-4280, -2284, -442], [5288, 1086, 1086], [5026, 590, 604], [10676, -678, -1274], [-5538, 586, -604], [-25704, 1716, 76], [8907, -210, -1553], [-9852, -2696, 1154], [4895, 1636, -943], [25063, 9, -1086], [-3748, -2176, 1830], [10396, 367, 1437], [18360, 100, -424], [14817, -1822, 705], [-12917, 1519, 300], [-20498, 940, -1806], [5526, 2032, 1224], [-19508, -952, 530], [-15018, -426, 1470], [3631, 983, 1156], [3088, 136, 2498], [-29416, 2008, 712], [-3228, 1032, -1758], [-21462, -1790, 1816], [-24834, 312, 880], [45340, -975, -257], [-6357, -2636, 885], [18498, -1998, 504], [-3754, 1932, -364], [-17950, 993, -2087], [-20402, -1514, 740], [34424, -564, -834], [26665, -10, 3069], [-2091, -21, -926], [-13188, -2202, 1012], [48996, -784, 638], [27442, -1041, 623], [-12112, 3580, 1786], [-18899, 1627, 1658], [22176, -936, -1962], [-39251, -769, -2806], [-9034, -632, 3410], [-20433, -360, 1501], [-7422, -302, -1284], [12860, 676, -1518], [30298, 1336, -592], [-1506, -1080, -176], [-24079, -1158, 841], [-18770, -1438, 388], [20913, 104, -1633], [11318, -4196, -742], [8454, -1264, 1000], [-15536, 4568, 1254], [855, 1497, 522], [-20852, -1490, 2772], [26812, -717, -2447], [21252, 2264, 1512], [63977, 278, -1059], [32204, 1770, 3310], [-11688, 2176, 438], [3496, 802, -284], [-36044, -1644, 808], [9145, 185, -1380], [-53041, -1463, -2986], [-7874, -1632, -572], [440, 4652, 172], [-24606, -3436, -1248], [13913, 1465, -640], [-15393, 4728, 1517], [11626, -3788, -1544], [-15570, -2267, -167], [42341, 1250, 1045], [-57636, -1277, 2353], [21030, 486, 3276], [9826, -1488, -2300], [-12394, -3232, -416], [56706, 190, -2316], [26888, -518, 662], [-26897, 189, -2082], [10148, 1616, -3538], [-58354, -1936, -1246], [-43210, 1335, -25], [38142, 808, 464], [15594, -2864, 3414], [-30791, 5257, 824], [-8264, -2968, 1758], [1323, -1164, 581], [-47034, -1806, 8], [7310, -2410, -4080], [-12283, 2139, 2110], [-27612, -2326, 3158], [-53524, 3092, 2288], [-57176, 396, -1818], [-32295, -1454, 713], [-19556, -4684, 4768], [64806, -3399, -667], [2131, -4391, 430], [-26190, -4401, -969], [34040, 2972, 1020], [27518, 3132, 6844], [67203, -2234, 239], [-49353, -1685, -2644], [-12046, -1328, -5528], [-43522, -1690, 1406], [55229, -3771, -484], [-13554, -3480, 472], [36502, 179, 4455], [55960, 1306, 4268], [3086, 1552, 756], [-35380, 718, -4610], [-2652, 2688, -656], [26998, -5904, 776], [9702, 2680, 3176], [38989, -4270, -3795], [-52448, 2356, -1760], [24597, -3884, 3607], [3375, -1806, -3017], [5356, -463, 719], [-81318, -282, -2110], [17560, 3360, 2642], [-13696, -3121, -4883], [47848, 2912, 5022], [-89658, -178, 2296], [38950, 2592, 7444], [-41442, 1067, -2381], [-41245, -481, 2448], [25920, -4808, 2242], [10998, -2700, 1256], [-86318, -1090, -4704], [29186, -2062, -2928], [29306, -6063, -247], [-12234, -2982, -2620], [-10508, 4056, 3710], [-7824, -4119, 5291], [60588, 6564, -4648], [10720, -7232, -834], [55299, -7856, -2207], [33504, 1517, 9219], [-61192, 2172, -354], [-23148, 1834, -4560], [11128, -800, 2196], [-9323, 3702, -1159], [-85505, 133, -2778], [-88228, -2804, 2218], [55576, -338, 2656], [9994, -6156, -4026], [-2260, 2490, 16], [-44208, 3444, 272], [153244, 341, 195], [-22678, 512, 3472], [-37187, 3664, 4739], [-41666, -34, 2672], [63448, 128, 788], [-48026, -2356, -10906], [-22272, 3328, -450], [-69558, -570, -2328], [-106782, 3540, 1464], [38927, -1141, -2092], [-26694, 580, 5432], [39214, -10290, 0], [-43939, -4224, 2507], [7888, -7216, -2238], [-108944, 1904, -2476], [-45223, -4621, 6598], [-59330, 880, 3316], [-49473, -721, 260], [2411, 2065, -8974], [51600, -2460, -1974], [-24030, -1560, -6036], [63678, -5002, 1116], [54230, -5936, -5636], [-23776, -722, 4808], [-3084, -6575, 379], [-31799, -6866, -3707], [-133536, 192, -3426], [-66522, -2263, 1145], [-62360, 3643, 2737], [53084, 440, 8356], [80482, -1582, -1698], [-35958, -444, 272], [-1930, 4322, -2646], [59828, -944, 3412], [46313, 1649, -5172], [16358, 3043, 119], [-2763, 6759, 698], [-64500, -3092, -2214], [-27753, -6066, 6875], [35912, 768, 3950], [76334, 3234, 6780], [-60324, 7324, 5330], [6608, 5672, -3662], [36659, 8492, 7717], [-5822, 5130, 8768], [76261, -628, 895], [-34842, -6730, -4836], [-68378, 7320, 144], [60810, 629, 7865], [46001, 1671, 7906], [48476, 6610, -6456], [-39864, 10279, 6061], [-1236, -340, -6938], [23467, 5676, 9845], [-38672, -5646, 2766], [-120408, 3264, 106], [-156876, -1692, 1754], [24201, 4031, -5134], [-77841, -4701, 5416], [39852, 5080, 11366], [19731, -2951, 1050], [-44708, 1188, -4262], [-65298, -8640, -3928], [-5494, -2838, -416], [24879, -5053, 1208], [71366, -10094, -3464], [-152512, -4032, 310], [39845, 56, 1827], [13156, -3999, 7715], [58812, 1576, 7386], [-38336, 2280, -10060], [3162, 2682, -6004], [16833, 9123, 7030], [-14068, 5886, -1492], [61100, 7036, -584], [-53126, -9268, -216], [-16911, -9429, -6118], [2412, 540, 3312], [135146, -72, 3888], [-70178, -4508, -7828], [22336, -5152, 2278], [-28293, -3096, 7353], [10203, 7794, 467], [96662, 3781, -479], [38197, 3010, 3493], [76918, -1151, -9359], [89659, -897, 8092], [-16454, 2071, -12965], [168684, -492, -3782], [-113162, -497, -2997], [-29574, 3010, -280], [-79704, 2356, 434], [14387, 5936, -1599], [-65047, -9043, -5976], [75136, 3908, 15264], [184737, 575, 530], [-1392, 4000, 9334], [70650, -1129, -8789], [-61946, -868, -3292], [97752, -8720, -5660], [-93727, 4636, -2189], [-71588, -7568, 2662], [-112858, 5516, -452], [49510, 7861, -4807], [204421, 494, -1327], [-56015, 2524, -3053], [127860, -468, 2208], [141370, -2348, 3056], [28473, -1358, 11369], [-74736, 8173, -3057], [55273, -863, 572], [110090, 6848, -5480], [17648, -15518, -6196], [12344, -14032, -2116], [-51806, 3790, 2840], [71158, 10256, 2348], [-143564, 5734, -396], [15425, -12295, -3456], [99020, -5236, -5768], [77925, -7590, -1971], [91592, 7628, 116], [-46726, 8918, 5338], [51520, -13696, -3870], [121445, 321, -3956], [71816, -2712, 3300], [24022, 1696, -11300], [79107, -180, -9875], [-40694, 1602, 10708], [-79819, 5782, 3097], [-121334, -5823, 1629], [20582, 9026, 9676]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_936_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_936_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_936_4_a_l(:prec:=3)
    chi := MakeCharacter_936_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_936_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_936_4_a_l( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_936_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,4,sign)));
    Vf := Kernel([<5,R![-832, -284, -4, 1]>],Snew);
    return Vf;
end function;