
// Make newform 26.10.a.d in Magma, downloaded from the LMFDB on 05 September 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_26_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_26_10_a_d();".
// 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_26_10_a_d();".
// 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 := [-66096, -6144, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0], [-1, 2, 0], [-4092, -13, 1]];
    Rf_basisdens := [1, 1, 24];
    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_26_a();"
function MakeCharacter_26_a()
    N := 26;
    order := 1;
    char_gens := [15];
    v := [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_26_a_Hecke( : Kf := Kf)
    return MakeCharacter_26_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 := 10;
    raw_aps := [[-16, 0, 0], [0, 0, -1], [79, -11, -9], [-972, 40, -51], [-10568, -380, 246], [28561, 0, 0], [302251, 1525, 1059], [575952, 1540, 210], [706512, -15720, -5208], [128502, 13080, 936], [-494212, -37860, 40572], [-929769, 20365, -119877], [-2518892, -131870, 115638], [12023940, 1780, 152121], [2378488, 102580, -265575], [-4911188, 278110, -95478], [-13270312, 475460, 926754], [76865436, -114170, -359142], [67145768, -15780, -336906], [-33256684, -604480, 2178279], [-117507622, -1579920, 201096], [47076584, 2435160, -1809864], [-453969672, 2560500, 1487136], [-236347886, 393400, 2877840], [-119261706, 4404580, 6250404], [410330864, 4147010, 7947006], [493863024, -4059560, -4302132], [565819164, -9382800, -1188768], [428543247, -232355, 11219619], [188717754, -3202200, -12115800], [2405456224, -6752080, -1359876], [2246152292, 7967660, 16643973], [-2662304252, -782990, 13420278], [1757511016, -5486680, 18027069], [-5145511662, -15313620, 16365924], [1638800008, 39134420, -46233669], [2367103646, 7117920, 83343312], [353743136, 34125180, -7615188], [7906871196, -54025020, -21871104], [-654367796, -3287450, 19289394], [12853240536, 63203760, 8449413], [3310241264, -87024270, 73157454], [-4177124872, 4734320, 133905306], [11081728248, 32673790, -126986118], [-20415556491, -19679085, -16504779], [10876154136, 13942360, 156745614], [38600205340, -62481100, -67927107], [-26093267392, 137087220, -326037033], [787836496, -125679860, -117955044], [13019689521, -222174545, -331569411], [42009973743, 48973665, -64114965], [-10019780460, 405210720, 13518645], [35495916702, 23514940, -99757788], [9348979844, 356427800, -258149340], [13014478119, 444352305, -416567985], [56255981008, -205811240, 644088180], [-108165568660, -174481210, -229155174], [14401488512, -134450820, -347787999], [-77720838432, 366522370, -468962754], [24653701922, -322958200, -363282192], [-16940802652, -945466200, -241830288], [5222070067, 657835225, 192936711], [-162776446896, 727933060, 348112722], [150008462736, 31485600, -68117394], [4003555573, -273642145, 1834716309], [-119842998174, -1448088780, 259824252], [1125121640, 1401769020, -722575908], [-97262405867, -968059225, 1630293765], [169699031688, 1022009400, -36735075], [164417687167, -472711315, -1123596849], [188410405708, -2730590, 2726770134], [22634573340, -1077480060, 1736429760], [-171630051456, -644121800, -4256501442], [39010394176, -2605048030, -764074650], [19339390744, 1806405740, -1315878096], [305128745688, 1935878220, -2302884513], [58281799658, -561744940, -4725755676], [-265454440130, 1217963600, 3523899984], [180440922120, -1094939490, 2768715714], [-100936340836, -5575969350, 1556538102], [130604999288, 2230013240, 900686439], [-486362766261, 2886607585, -915864693], [385846255724, -5476307080, -3552436203], [-630266014163, -1202550625, -5048476923], [224454749712, -5094673280, -3668985834], [461520026836, 3019896460, -8531445], [596762416854, 387018660, 3277602228], [414023595022, -627766540, -3689761908], [-27849694017, 1789690605, -11360326701], [56813239428, 6954968260, -2774020272], [71009088508, -9050117240, -1237092288], [-131964896336, 6725641180, 2992016145], [53561407524, -2490748820, 10693758720], [-1254339350964, -803830500, -1861787535], [720827760256, -1253768500, 9848530356], [987576943328, 8644528400, -8009354322], [939966308958, 13579507200, -6310664304], [-2025338591419, -901363585, 6196495245], [905894693292, -7175028800, -1092886728], [634265005997, 5432608755, -14596552539], [222374195384, -5916679080, -14905817793], [-1211255663475, 26319530595, 11408071677], [432365966672, 13277181560, -10566941727], [-1922636897463, 8040932595, 2673941517], [1743632960640, 12125180440, 115450995], [-868660857506, 8781639020, 2424431076], [-1199504321032, -13535316340, 6857618604], [1746722191722, -1162260840, -22154565456], [-1559095913640, 18233281080, 3579512874], [172448248211, -1756543755, -9813484485], [6969618344, 19268386560, 1316201850], [2792300898822, -11428161920, 2653616064], [-644157029892, 12764419050, -30035651778], [977392513496, -2733407460, 45291277584], [-2013937785632, 19329472700, -15412520721], [675431299558, 25376319700, -1121503284], [-537928473400, 9848219580, -16130691594], [-3287551801008, -5317728720, 10623072678], [635607049972, 21978984430, 1162086882], [2073371548836, 7366439280, -24980905128], [3189801424242, -15052260980, -12464266956], [4316803203795, 2590611085, -11899347981], [2276973687748, 14571270790, -23767725990], [4865673766960, -30160700, 53853021276], [4258877774952, 20101984180, 24566541204], [6302515874204, 28576728230, -11525972286], [2899606453042, -3714159460, 5948752596], [-4748390231616, -204817560, -38888872062], [-2746664983216, -27799909680, -12672813366], [-4076444577555, 68404968355, 8150776617], [4882209089232, -6640775300, 13082746872], [-12381887206704, -15543480540, 6141853965], [798064624832, 41835673200, 8820297432], [-3024347129708, -96646718650, 55050794538], [-6959059488382, -20961928120, 3984512784], [-12000684084676, 4224169170, 32785850862], [-9171185471205, -52312110735, 11938955619], [-8307731077584, -92910980, -11028028524], [-6289560686074, 49831462760, -77445382152], [11731474366573, 19956303655, 18726505461], [-1112509294232, 24916095500, 118830010848], [-4637867850873, 5469499965, -29856289545], [10543976704304, -82908472080, 895374450], [15056469036608, 22220763020, 59355924090], [-7632208557810, -130157944880, 93553611672], [-13177746847412, 42238768660, 5796050688], [6288166449, 91192771615, -46529704059], [4884607389918, -4539550860, 81135651900], [540847417260, 52595290960, -33197780256], [11575204457804, 10955951480, 29558893569], [5792178769281, -98042992745, 29184936789], [-1883895082733, -107521384355, -72038321829], [5191264132356, -27591118940, 3066952107], [11154990461256, 62344913040, -23738302824], [20501092629972, -132664779500, -37391829171], [-3628430605240, 140064002480, -24247455750], [-19190334517864, 26556600960, 96373101672], [-13058665091920, 94178098550, 65491348674], [2799389187158, 200571777660, -13515470028], [-2681977760807, 34602824335, -87173738451], [19847581934056, -35918663060, -62157410610], [-9534333506415, -126349679685, 173816364765], [26527123776180, -87937792400, -152674528749], [10644730253404, -157665990620, -127831171773], [8569129002114, -1497119280, -39273569592], [17142055553220, 252781969800, -36440965419], [-11401461884144, -98680521160, -275507677146], [936055145346, -121713541460, 251585285052]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_26_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_26_10_a_d();".
// 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_26_10_a_d(:prec:=3)
    chi := MakeCharacter_26_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 10));
    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_26_10_a_d();".
// 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_26_10_a_d( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_26_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,10,sign)));
    Vf := Kernel([<3,R![-1012908, -19093, 0, 1]>],Snew);
    return Vf;
end function;