
// Make newform 936.6.a.h in Magma, downloaded from the LMFDB on 23 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_6_a_h();".
// 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_6_a_h();".
// 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 := [20, -60, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0], [-40, 1, 1], [38, 7, -1]];
    Rf_basisdens := [1, 2, 2];
    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 := 6;
    raw_aps := [[0, 0, 0], [0, 0, 0], [3, -1, 2], [-14, -4, 1], [271, -1, -11], [169, 0, 0], [194, -84, -24], [-494, -44, 43], [1250, 34, -66], [2012, 94, 96], [-1436, -82, 183], [-3292, 650, 72], [3467, 331, 670], [1374, -750, -470], [521, 33, 345], [14554, -1600, -808], [-4579, 1025, 1337], [-4046, -2088, -806], [-4984, 3230, 1175], [12273, -2595, -165], [6012, 406, 24], [-25900, -1940, 888], [22503, 2699, 607], [32477, 1777, -858], [-23928, 4986, -908], [33588, 2990, -1928], [12786, -1262, -5866], [104570, 5678, 1290], [5802, 5260, 1052], [102164, -2510, -1784], [1180, 7128, -6122], [186158, -422, -1034], [-97069, -12077, -746], [-163446, -62, 7716], [-96947, 15453, 11362], [-11744, -23618, 2501], [10542, 5684, 6374], [53666, -4160, -2923], [142737, 4401, -11615], [-233184, -17502, -4036], [264984, -4396, 3912], [484010, 2432, -826], [-160800, 10240, 17040], [637050, -3304, -3096], [-135589, 11055, -26562], [263176, 25004, 11794], [66008, 9356, 17568], [688264, 1290, -4929], [388901, -9923, 35475], [788662, 4776, 26572], [-135860, -2502, 24028], [469061, -967, -6937], [502116, 34358, 23384], [188830, 26810, -782], [-220728, -47802, 20276], [73326, 47590, -25834], [297984, -31094, 17240], [1176846, -3776, -26947], [838022, -10176, -25296], [-71953, -4721, -28038], [1023080, 18160, 1850], [-1002439, 82529, 24986], [841704, -57766, 17761], [1391838, 34022, 48326], [-904650, 32044, 24964], [1057939, 118775, -22318], [632412, 105666, 27335], [-1312330, -76044, 11020], [1383372, 29488, -48060], [-104644, 66554, 10160], [1140483, -102021, -24690], [864537, -79239, -67943], [-375458, -46046, -2620], [-36630, 142876, -8696], [1545794, -160788, -65045], [359363, 31859, -34057], [850582, -237820, -142104], [671992, -160170, -5148], [1821413, 234865, -31322], [-1153948, -246074, -13564], [1029730, -206970, 23006], [-1005698, 58400, -73764], [3148647, 218647, -36349], [-1485510, 211796, 31682], [1618706, 282314, -55694], [3770478, 244098, -62074], [-1146623, -101755, -123906], [-4197792, 50482, -7152], [-123805, -73457, 11878], [3716910, -52560, -73579], [503430, 75898, 241490], [478315, -281713, 46309], [2300296, -248670, 64663], [-889206, 64902, -87786], [1768980, -237278, -210161], [1299574, -274898, 157590], [-2978169, 295187, 267618], [1080812, -58846, 49752], [1494718, -176074, -98632], [-2060554, 525888, 166332], [-640482, 442822, 114812], [-4220379, -452739, -173942], [-1588444, -64352, -442380], [2531188, 337370, -47664], [1218884, -63820, 394882], [-4591042, -61508, -403124], [348595, -848897, -95893], [-3703267, 61633, -9790], [2798290, 749602, 71238], [-4838306, -211260, -420188], [284886, -48350, 434016], [-2108988, 4082, 194628], [-4174205, -503461, 262682], [9162664, -18126, -201439], [-6715492, 19226, -295887], [-7292634, 92248, -136768], [5010712, 183942, 247243], [3939464, 303760, -372064], [-4032732, -609378, -186748], [-2232384, 360556, 180584], [7304468, -250470, -238560], [-8775210, -382536, 39394], [-9369182, 75016, -455688], [3458331, 41123, 8949], [-6528316, -161742, -796801], [-6649526, 872272, -41580], [5751282, 180716, 636900], [-2593134, 116578, -51014], [-5079972, 45976, -920478], [401210, 256180, 233528], [510904, 999498, 241657], [8519089, 323613, 530843], [-22671446, -40662, -97918], [841922, 276760, -97346], [5415891, -581773, -239794], [-17336778, 456700, 169696], [-15720631, 363769, 400406], [-15962896, -439750, -541347], [-20330010, -387660, 93788], [5572200, 919606, -483320], [-15561382, -115212, 76611], [6382709, 282141, -168802], [6031478, 370238, 127534], [-4277213, 752547, -121943], [-5161246, 30568, -580310], [27260371, -563785, -187479], [4188356, -243118, 516588], [7931288, -928618, -397272], [-7444748, -1623128, -281872], [-12673617, 1061239, 429911], [2003412, -307654, -177636], [22758124, -185830, -338408], [-11221852, -954724, 392154], [19076288, 1166200, -302760], [-20048892, 1126052, 104258], [21857724, -1619476, -520020], [12894796, -964228, -53800], [-7489729, 550695, 375346], [-13854222, -1423252, -498234], [-10919447, 345761, -52914], [-9539263, 1700485, -30831], [-4265524, -72654, -1428088], [18488852, 953246, 250715], [-8383488, -2033556, 629772], [21352837, 710225, -272698], [-4814345, -1016925, 230305], [6610010, -1112522, -252388], [-2814122, 713680, 801464], [4763384, -99958, 542108], [-11029584, -1340870, 1211460], [-14184091, -331499, -1077189], [-750140, -418806, -384444], [-7596766, -767078, -964966], [18522744, 785170, 469860], [31002962, 1152746, 906286], [28181378, 1451452, -9140], [20333360, -55294, 469469], [-6842755, 1912485, -1083458], [-27627630, -1312846, -510570], [-2226734, -1419412, 547576], [40406022, 1342136, -267811], [-8496292, 3368240, 955128], [-11404654, 1739960, 260622], [8302353, 2515757, -1089778], [-38980939, -652995, -1823939], [-37127038, 637224, -1008992], [-742286, 3245616, -258994], [22026822, -1371400, 123727], [10960132, -1879906, 816112], [1304681, 2168817, 955401], [22236330, -414220, -1511358], [11698375, -1185173, -843869], [-12305230, 3747114, 2012640], [-8877295, -213695, 640258], [-47327944, 431372, 141508], [60846624, -1184738, -103496], [21416254, 2018892, -1943172], [62955094, -574040, -156472], [31648881, -3109411, -889238], [-8379136, 2282632, 1487880], [-15263317, -954913, -552758], [24470570, -3498522, 436356], [19487646, -3126136, -802128], [40236666, -454652, -1418846], [-79556559, 111741, 582561], [37126870, 912100, 1356844], [42662144, 523978, 110051], [-45207794, 1376194, 1130594], [36095489, 392093, 4110782], [8091600, 5408032, 287078], [-24410534, -3430348, 1368626], [8002494, 1257460, 1624676], [-5867824, 2788136, 1915784], [-2567613, -2849493, -2570299], [-1990985, 3515111, -700665], [3960770, 3906304, 3907988], [-8137312, -4909864, -1157868], [52745398, -2714408, -1746832], [23096353, -801683, 1320867], [67913857, 2505105, 1121282], [-58948770, -2269112, 994552], [39415130, 2452884, -957287], [7870057, -1483667, 2046726], [-17533516, 4555790, 750055], [28198602, 1050814, -1835418], [-56238526, -1553564, -567688], [97725130, -627964, -417900], [-25309618, -5394562, -2030930], [43614380, -2781200, 480294], [-40109011, 5707937, 2198793], [-82108110, 994496, 1984430], [35822502, -509474, -2950972], [-79175990, 774072, -2247293], [36162534, 854064, -2223456], [-84703994, -29698, -88192], [56658473, -3493251, 1812075], [32392512, 3573194, -892232], [40826221, -1543291, -1074466], [-44384132, -2416656, 1802156], [30144728, -3280040, 460772], [78288195, 249367, -1743101], [-55972496, 4196192, 564734], [-5243088, -453912, -106624], [-20914256, 6388606, 3324708], [10662057, 4180773, -3435438], [20745158, 5784430, 606558], [-85001566, 1427196, -2589275], [-26326587, -143999, -4378255], [41392122, -372700, -1030869], [21845702, 3536206, -2042590], [4733082, 7932052, -2117272], [-77063277, -1502053, 505254], [-30009957, 2677959, -4278963], [52124662, -979364, 5290708], [101089980, 3898718, 1733080], [-134611861, -563813, -1001347], [-73093106, -7724680, 1101536], [-106679022, -2977828, -788213], [-1978726, 285904, -324168], [138024234, 1217912, -1220740], [-60386216, 9644068, 2299642], [-66113860, 805696, -2220752], [40885218, -1367588, -1689836], [-110898090, 942232, -4217040], [-120785967, 329573, -339082], [88347960, 697412, 2995132], [-94621529, -2819653, -101194], [-15901609, 1871847, 1202266], [-101362672, 1988802, 1052717], [4843552, 2039458, 2225648], [-72546882, -3174540, -3455978], [-49808596, 5408834, 5893011], [-6600108, -2816842, 5497588], [43720146, 1738890, 3255750], [-89170678, 3529536, 1282052], [-89513574, -366600, -6113529], [18304289, -5137511, -5548717], [25476908, -410574, -5116148], [23229146, -8990160, 2730160], [54690954, -7935370, 2923322], [8646524, 2985956, 1198232], [-173952914, -1947096, 1705525], [170961544, -6472000, -2495536], [15646824, 9342334, 4947508], [105778292, -8891522, -3564131], [-45340652, -5765116, 1240196], [-18615574, 8747732, -148870], [-22956899, -819747, 2231258], [282392, 3919166, -5185031], [-185477252, 926634, 2702544], [62962790, 2740652, 9425080], [-153708140, 8858336, 1093804], [-800667, -2357559, -2313514], [39749401, 12346045, 3037117], [-46768226, 6898516, -2188298], [-75004578, -5300412, -1894648], [47028706, -8113002, -7203000], [98371086, -3529924, 5154424], [-104772260, 3525128, -3604000], [-107373144, 8070378, -1048079], [-6573694, -3824712, 6351720], [85592447, -5395077, -5757846], [142427054, 5714438, 156602], [-71652032, 1796204, 2127784], [15944150, 15435214, 4306904], [69910900, -379570, -3422692], [-18009540, -15053296, 1358580], [-29353266, -12566832, -1601952], [-39019905, -8103989, -2362343], [-240771114, -1285952, -7103856], [9075266, -5750038, -5771058], [-127424437, 16960015, 7831598], [94016196, 13267818, 1618316], [151512356, -1262728, 2408324], [42916393, -9354847, -5296179], [-16166814, -7126336, -7614620], [-4086331, 14544429, 7933939], [31177231, 7254335, 2579139], [-144318168, 5977898, -1705764], [-115753074, -6289416, -281580], [-134393902, -1799362, -2679578], [-145715210, 12923572, 6055792], [71939386, -3337552, -791460], [72346496, -4571570, -8617631], [236786733, -1262151, 1850690], [14152050, 7283452, 4642146], [116101378, 9596248, 1934249], [-150843036, 7925322, -3734105], [16143040, -5643848, 10548468], [201467820, -4125738, 6954536], [47995682, -3308972, -10743956], [150671840, -18948262, -9449608], [224260996, -8896180, 3162904], [121501031, -604649, -6557359], [-202158742, 9463044, -169965], [2238511, 7644227, 4116059], [113198080, -16300026, -9852928], [109363063, 3924695, -803362], [64002508, -4667394, -5006612], [45426638, 4225118, 4877118], [-212948508, -1158398, 4346772], [215433724, 3824954, 10463340], [124471057, 6199929, 2460354], [-22452030, -7310638, -2895458], [260874323, -1370361, 2215674], [-239931584, -8602556, -1181980], [51656446, 16173832, 4919112], [-339397946, -8453964, -143419], [242089197, 7739941, -3876611], [96789426, 19443440, 3272068], [198325220, -17360470, -10437029], [-219689928, 18491146, 7188360], [-266838663, 2121977, -6699526], [77382352, 7376764, 11774058], [-30415010, 10507964, 8265830], [51659404, 3882410, 918380], [40318013, -5725883, 8169949], [187992365, -16869675, -6212081], [-235890576, 16584110, 4383924], [362912927, -4803273, -926525], [229463900, -10800934, -5531452], [100614646, -941360, 3463784], [-282056922, -4029698, -9048854], [157027829, 18670989, -569705], [83014954, -22669858, -12885854], [301947222, -20466792, -9853162], [11197379, 7035423, -10828690], [-155151732, -20162766, -2028491], [-45310658, -20435400, 3953114], [-43646166, -6049658, -1834870], [-111108706, 4244930, 8017906], [-49226383, 16941649, 11500909], [-247149946, 11077596, 8898716], [303423208, 5380288, 5117344], [209513454, 9778208, 10442608], [-235014893, -16072017, -5690977], [182991960, -2890680, 5943408], [-125685994, 20513332, 14678052], [-76839598, 13825196, 16364496], [140534518, 2774152, 2285238], [160960317, 9778149, 13373874], [-259387841, -20200937, 4403558], [-36441302, 23717140, 5037745], [26514957, 3233905, 478058], [-111673290, 27672604, 9626773], [236025043, -32401, -2668019], [304278894, -10734204, 1568299], [-29086046, 13303056, -13319374], [119463350, 2331560, -6568549], [60831582, -5533098, -2959638], [20381100, -10522690, 1436424], [-99115747, -30037523, -2620486], [9553367, 20091399, -11209555], [382404924, 14530168, -2885792], [307028525, 14346093, 8112997], [-196230886, -4674580, -1872710], [367892286, -4841020, -10188789], [102519082, -17225460, -15485336], [113990768, -10550628, -1849688], [253668779, -7419697, -1149538], [571229328, 4685470, 3295132], [76242790, 9357296, -17928300], [-154508018, -25960256, -519363], [213132337, 5348965, -4199606], [-437109585, 428355, 3091922], [44082228, -7745780, 22595220], [231300538, -9034772, -9437628], [222507381, 921137, -7795794], [374654044, -8585802, -3717055], [57254351, -25749889, -2268759], [-423189910, 11426888, 11693280], [-22490390, -14212240, -7144296], [-235281804, 7349944, -8293700], [-314153978, 21360842, -3517098], [80440118, 16936260, 22202480], [-229559462, 2093624, 4788064], [168208625, -15852923, -9813109], [-220140580, -11474908, 701652], [138208353, -13776411, 9729270], [521682978, -14133246, -3513170], [-18187292, 15126958, -8195052], [-202671024, -28043058, -669896], [-91606359, 33792565, 17379727], [-301560470, -1150210, 6721842], [208067334, -895340, -11167568], [-325257895, 15410953, 1664002], [-155858150, 30100334, -4625306], [-257281819, 16782249, 3354518], [-785842898, 5064052, -324663], [129267256, 9444608, 32573976]];
    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_6_a_h();".
// 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_6_a_h(:prec:=3)
    chi := MakeCharacter_936_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 6));
    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_6_a_h();".
// 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_6_a_h( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_936_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,6,sign)));
    Vf := Kernel([<5,R![67264, -4532, -8, 1]>],Snew);
    return Vf;
end function;