
// Make newform 32.11.d.b in Magma, downloaded from the LMFDB on 23 November 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_32_d();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_32_d_Hecke();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_32_11_d_b();".
// 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_32_11_d_b();".
// 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 := [3348211684, 279415575, 12144527, -121569, 30855, -51, 5, -3, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0], [5414621036, 460044665, -3220592, -639715, 38788, 6467, -640, 39], [25703063380, -988760041, -64144, 4083379, -42820, -5907, 640, 73], [-56308982748, 270376211, -64144848, 10212255, -1067988, 81793, -2688, -51], [15161255732, 510138431, -8362768, 3373179, 472156, -8411, -128, 33], [3049502010868, 197013680079, 7067850992, 408149835, 1444508, 265557, -315776, 21393], [-1096096173780, -122965473463, 11780215184, -362453715, -492860, 1075, 131712, -8361], [1657680830100, 201729495303, -218631312, 200294499, -6817668, 246845, -2688, 6745]];
    Rf_basisdens := [1, 29360128, 14680064, 14680064, 2097152, 29360128, 7340032, 7340032];
    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_32_d();"
function MakeCharacter_32_d()
    N := 32;
    order := 2;
    char_gens := [31, 5];
    v := [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;

// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_32_d_Hecke();"
function MakeCharacter_32_d_Hecke( : Kf := false)
    N := 32;
    order := 2;
    char_gens := [31, 5];
    char_values := [[-1, 0, 0, 0, 0, 0, 0, 0], [-1, 0, 0, 0, 0, 0, 0, 0]];
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    values := ConvertToHeckeField(char_values : pass_field := ISA(Type(Kf), Fld), Kf := Kf); // the value of chi on the gens as elements in the Hecke field
    F := Universe(values);// the Hecke field
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),values);
    return chi;
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 := 11;
    raw_aps := [[0, 0, 0, 0, 0, 0, 0, 0], [-60, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, -1, 0, 0, 0], [-17916, -204, 2, 0, 0, -1, 0, 0], [0, 0, 0, 10, -3, 0, 1, 0], [-46350, 742, -245, 0, 0, 8, 0, 0], [-219164, 3564, -798, 0, 0, -1, 0, 0], [0, 0, 0, -554, 42, 0, 6, 13], [0, 0, 0, 723, -912, 0, -24, 56], [0, 0, 0, 5405, 227, 0, 34, 63], [0, 0, 0, -3906, 3803, 0, 23, 96], [11583666, -111780, -6734, 0, 0, 520, 0, 0], [1273828, 139815, -8364, 0, 0, -330, 0, 0], [0, 0, 0, 69297, -1713, 0, -234, -203], [0, 0, 0, 14504, -11091, 0, -231, -728], [120705252, 868761, 125888, 0, 0, 2384, 0, 0], [0, 0, 0, -48994, 31677, 0, -1543, -840], [153197860, 1721316, -48078, 0, 0, 2055, 0, 0], [0, 0, 0, 57878, 19434, 0, -3414, 1339], [350009090, -9329766, -143871, 0, 0, 3328, 0, 0], [0, 0, 0, -487634, -58670, 0, -712, 4884], [-231677820, 1106569, -983248, 0, 0, -8712, 0, 0], [770324514, -13252950, -1276583, 0, 0, 11296, 0, 0], [-1212232942, 36355206, -1671957, 0, 0, -13848, 0, 0], [0, 0, 0, -1317808, 263289, 0, 5085, -5712], [0, 0, 0, 1125902, 178162, 0, 10482, -6825], [-1729616700, 8472518, 1539950, 0, 0, -55223, 0, 0], [0, 0, 0, 1060875, -241724, 0, -1532, -15120], [2488614690, -20005960, 6091972, 0, 0, 78672, 0, 0], [0, 0, 0, 3791073, 1709343, 0, -2766, -3081], [18650165988, 34906714, -2135434, 0, 0, -38331, 0, 0], [-8165615310, 119813172, -1445594, 0, 0, 86680, 0, 0], [-28469689244, -81667545, -5217324, 0, 0, 192150, 0, 0], [0, 0, 0, 19148971, -910734, 0, 62274, 59880], [0, 0, 0, -2636786, -1050126, 0, 92758, 144357], [0, 0, 0, -8379536, -1402989, 0, 55111, 172536], [65342132740, -265094505, -17799420, 0, 0, -202818, 0, 0], [0, 0, 0, 6831401, 1612503, 0, -342264, 31164], [0, 0, 0, 22485652, -2695797, 0, 204087, -187376], [147163222596, 329827443, 35266604, 0, 0, -69190, 0, 0], [0, 0, 0, 47547117, 6325800, 0, -210144, 64344], [0, 0, 0, -30167163, -1177989, 0, 308970, -540197], [-43923926830, -226202490, 24743691, 0, 0, -1348440, 0, 0], [0, 0, 0, -69101413, -10533258, 0, 1326, -513536], [0, 0, 0, 50400471, 609065, 0, 361820, 90258], [302579703364, 1698650727, -140122908, 0, 0, 429502, 0, 0], [0, 0, 0, 21202543, -9679983, 0, -536714, 1457589], [665496918852, -1196766231, -56142352, 0, 0, -266200, 0, 0], [0, 0, 0, -116458085, 4373806, 0, 461222, 1741152], [27504287682, -2175293270, 857593, 0, 0, -2478112, 0, 0], [0, 0, 0, 145030142, 21399042, 0, 1332048, 14664], [-247682532814, 1431183990, -300383517, 0, 0, 723624, 0, 0], [-834291851676, 2396910461, 43727768, 0, 0, 6328996, 0, 0], [69017379138, 2421443496, 41495020, 0, 0, -753104, 0, 0], [0, 0, 0, -101549884, -17081028, 0, 2972982, -2505547], [0, 0, 0, -44245195, 10768818, 0, -3657702, -1487360], [0, 0, 0, -259585935, 70461327, 0, -1161666, 1199457], [0, 0, 0, -116947408, 66141357, 0, 3447257, 193512], [325365102882, 5290785338, 310950529, 0, 0, 2646432, 0, 0], [-1501389256700, 34549614, 64803102, 0, 0, -5110847, 0, 0], [0, 0, 0, 306972011, -97414194, 0, 536502, -3823792], [154821235300, 11316643764, -706084974, 0, 0, -6090553, 0, 0], [0, 0, 0, 160659591, 30348153, 0, 2308368, -1374184], [-695166809518, 2557341948, -536137182, 0, 0, -11343288, 0, 0], [0, 0, 0, -67068917, 184517616, 0, 595752, 462328], [-495508365116, -4257669870, -1138271562, 0, 0, 16385413, 0, 0], [-296096627230, -6532340136, -860691804, 0, 0, 10802736, 0, 0], [-379964011740, 4970690271, -255279772, 0, 0, -37963138, 0, 0], [0, 0, 0, 692948045, -65579674, 0, -5291690, 8838648], [-514595397438, -6778177536, 923168848, 0, 0, -4900640, 0, 0], [0, 0, 0, -1212167990, -60786378, 0, -459990, 1121627], [0, 0, 0, -36142049, -387047455, 0, -4745406, -1478337], [0, 0, 0, -1209896786, 243369495, 0, -8886965, -5414616], [3259484634916, 10585945203, 419435484, 0, 0, 29170850, 0, 0], [0, 0, 0, 1585618996, 192793548, 0, -4335864, -11053028], [0, 0, 0, 1199958278, 42429051, 0, -6180825, -2338992], [0, 0, 0, -658320285, -317942876, 0, 3419236, -12331536], [-54844307214, 39054645510, 281392411, 0, 0, 1096840, 0, 0], [2969216397074, -32489230692, 55438194, 0, 0, -78569016, 0, 0], [-9133410024924, -17310851672, -1904131894, 0, 0, 10110939, 0, 0], [0, 0, 0, 1421390957, -312147860, 0, 4240668, -8756928], [0, 0, 0, 367746044, -677055996, 0, -9739716, 13898866], [1648786892210, 54955239606, -93640029, 0, 0, 39928168, 0, 0], [0, 0, 0, 5087350063, 290953937, 0, -963072, 14734272], [12148194577860, 53385545472, -4985588470, 0, 0, 63381323, 0, 0], [-5495502373806, 26118938614, -6963131213, 0, 0, 36933128, 0, 0], [-1979139915790, 28012699452, -1016041566, 0, 0, 93536136, 0, 0], [0, 0, 0, -1159583675, 438833778, 0, -4159446, 16877392], [0, 0, 0, -7395870310, 924101734, 0, -21219792, -21574728], [-15844984280028, -33852412666, -1585104514, 0, 0, -13248239, 0, 0], [0, 0, 0, 1646302315, -172842603, 0, 81666222, 19790841], [0, 0, 0, 6085628463, -1268949551, 0, -4831964, -53390610], [13865326676388, -6974959635, 3581057144, 0, 0, 28326788, 0, 0], [-7440596476028, -14531875323, 2692052760, 0, 0, 68823396, 0, 0], [0, 0, 0, -5398970910, 1112610846, 0, 20312454, -46552947], [0, 0, 0, -5069096340, -1633610817, 0, -25674045, 32776408], [-14792427855054, 14403250516, 3633256438, 0, 0, -160473448, 0, 0], [18185923110340, 79846246002, 11849204598, 0, 0, -10267611, 0, 0], [0, 0, 0, 1961070114, 1290193729, 0, -13680995, -60057720], [-8009347369820, 154784209740, 3690296610, 0, 0, -144773457, 0, 0], [0, 0, 0, 10571159818, -1717197579, 0, -6566727, 44340320], [11259149549028, -257497620240, 8462919290, 0, 0, 136402643, 0, 0], [16509371437074, -113770435404, -23050958714, 0, 0, -176007848, 0, 0], [-10485760668092, -93451567980, 6689630082, 0, 0, -184007601, 0, 0], [-25094211504190, 109008818568, -2040273396, 0, 0, -479787056, 0, 0], [-24312996260220, 39891495936, -4364364214, 0, 0, 146255003, 0, 0], [2844665768610, 177765715344, 3740885848, 0, 0, -105394784, 0, 0], [0, 0, 0, 8220079509, 6352491, 0, -105989916, 169676654], [62022493981346, -151015425606, 4549360305, 0, 0, 176013120, 0, 0], [0, 0, 0, -11939423242, 375055370, 0, 60347092, -22865514], [0, 0, 0, 982458621, -1611703508, 0, 92074684, -157650144], [-27003266874942, -256609098582, 3568173961, 0, 0, 233502784, 0, 0], [-64140445600508, 51981725928, -9258575046, 0, 0, -9559293, 0, 0], [0, 0, 0, 9031991394, 351011230, 0, -110747738, -79208163], [-26608418003118, 256654800102, 35103654331, 0, 0, 415273768, 0, 0], [71659247329828, 120185305332, 34384029330, 0, 0, -474946281, 0, 0], [0, 0, 0, 12071632760, 1425881736, 0, 182081982, -182914991], [0, 0, 0, -8313821799, -5764935570, 0, 130115814, -285608864], [74092440311556, -159764892443, -22762530472, 0, 0, -617710620, 0, 0], [0, 0, 0, -33155020295, -2201697308, 0, -170054596, -79038456], [-43319963954158, 230294041302, 17939614083, 0, 0, 108244424, 0, 0], [0, 0, 0, 12681257218, 7156857975, 0, -307630461, -34463744], [-67683765048540, 310947143153, 27744304400, 0, 0, -430713224, 0, 0], [104240838974404, 91099499583, -27504623244, 0, 0, 780665878, 0, 0], [0, 0, 0, -26616112466, 5402795277, 0, 226086489, -68601208], [0, 0, 0, 12774420650, 3294813319, 0, -20590605, 665419296], [0, 0, 0, 2745656044, -1755375852, 0, -295963596, 490785302], [0, 0, 0, -37884256187, -3573900357, 0, 39625252, 234750222], [0, 0, 0, 59022949795, 2295006192, 0, 213514552, 101299464], [640626437572, 148511361405, -95775575832, 0, 0, -686448724, 0, 0], [0, 0, 0, 10244038547, -5268591507, 0, -511513044, -137659254], [0, 0, 0, 34180065080, -2167645496, 0, -96280284, 274145118], [0, 0, 0, 8773757955, 6634121794, 0, -368259518, 392617944], [227975602726866, 464598316412, 9379958434, 0, 0, 259747272, 0, 0], [-108592860311086, -350822658666, -48215629917, 0, 0, 1138957640, 0, 0], [0, 0, 0, 31299624446, -5765286621, 0, -514121313, -537883136], [23131149526852, 609417689367, -7764226428, 0, 0, 1696119022, 0, 0], [0, 0, 0, 64905722016, -9468912189, 0, -417477561, -614513144], [-275669914331982, -188109134564, -1887409070, 0, 0, 237728648, 0, 0], [62321418883588, -302946199032, 87244341114, 0, 0, -122340253, 0, 0], [0, 0, 0, 63351749902, -15241422393, 0, -307703109, -406727384], [0, 0, 0, 10578992099, -5120898019, 0, -753975992, -355293924], [81152733856260, 633514431090, 36722467382, 0, 0, -563553643, 0, 0], [0, 0, 0, -23054830980, -15326012833, 0, -275725117, 623405496], [0, 0, 0, 91861128233, -17928189993, 0, 14829696, 36723680], [0, 0, 0, -62675046004, 10652056769, 0, 796492621, -634180680], [474770137031250, -794867210668, -11722469066, 0, 0, -965875944, 0, 0], [93706376321956, -75124075677, -183542276484, 0, 0, -1314012366, 0, 0], [0, 0, 0, -41329843287, -11112645033, 0, 659003562, -92754021], [0, 0, 0, 55091199001, -18777599434, 0, 586285806, 541743360], [114385448837922, 1052322356184, 43671024292, 0, 0, -840966224, 0, 0], [-346954633556060, 1028207677542, -2295908802, 0, 0, 532027409, 0, 0], [0, 0, 0, 12784947485, 17229170403, 0, 493293900, 473704602], [363615029808292, -1742830427223, 44853077088, 0, 0, -1493604816, 0, 0], [0, 0, 0, 31483141071, -7739348943, 0, 864507834, 136873219], [0, 0, 0, -75387099684, 2614658084, 0, 1596305810, 593573607], [-373577576879982, 199245407462, -103810045157, 0, 0, -2222465688, 0, 0], [-470335515736510, -860898315894, 204974679945, 0, 0, -840468960, 0, 0], [0, 0, 0, 73114302375, 39214446552, 0, -817688856, -309400784], [-630897773085468, 1159441750872, 17428120682, 0, 0, -2787045733, 0, 0], [784213779804690, 327761422420, -31280574506, 0, 0, 2453450456, 0, 0], [0, 0, 0, -20476374787, -6227526909, 0, -2959648696, -380322948], [604467116938404, -1431247214127, -17637853744, 0, 0, -982592392, 0, 0], [464068928873970, 1095745871574, 36737375731, 0, 0, 4986628456, 0, 0], [0, 0, 0, 7836099715, 42205251453, 0, -839774976, -944119008], [0, 0, 0, -105389299092, -14980190828, 0, 1463259520, -2340422016], [0, 0, 0, -187234423018, 38178017299, 0, 314645727, -1750821744]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_32_d_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_32_11_d_b();".
// 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_32_11_d_b(:prec:=8)
    chi := MakeCharacter_32_d();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 11));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(997) - 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_32_11_d_b();".
// 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_32_11_d_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_32_d();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,11,sign)));
    Vf := Kernel([<3,R![1684044432, -9637056, -80424, 240, 1]>],Snew);
    return Vf;
end function;