
// Make newform 100.14.a.a in Magma, downloaded from the LMFDB on 08 December 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_100_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_100_14_a_a();".
// 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_100_14_a_a();".
// 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
        Kf := Rationals();
    end if;
    return [Kf!elt[1] : elt in input];
end function;


// To make the character of type GrpDrchElt, type "MakeCharacter_100_a();"
function MakeCharacter_100_a()
    N := 100;
    order := 1;
    char_gens := [51, 77];
    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;

function MakeCharacter_100_a_Hecke( : Kf := Kf)
    return MakeCharacter_100_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 := 14;
    raw_aps := [[0], [-468], [0], [-333032], [-6397380], [-15199742], [-43114194], [-365115484], [57226824], [-46418994], [-5682185824], [1887185098], [-7336802934], [26886674980], [-101839834224], [-278731884294], [59573945772], [-27484470418], [-784410054932], [-360365227992], [1592635413718], [-23161184752], [-2050158110436], [-3485391237126], [-6706667416802], [10653736099446], [10924465533496], [-12587565522204], [-436641848098], [31831198952526], [-39407680341632], [73744029229140], [-85410026296938], [-79782728036164], [189340621038054], [283931821277240], [-27493181043278], [374651855577100], [-126476544252168], [362732128582626], [-317214254387772], [455668962760070], [-966029530347072], [182063056758334], [-862598124343638], [324819447518888], [-703122653862556], [-1508649743016800], [-2503060674367284], [-1221116802675466], [-3537908036396874], [-3112798054881744], [-4570914891142606], [-1663317001905300], [3740522836521726], [-2506157776421352], [-81129982670082], [-2291408802506800], [-998960307482726], [-11758003102314054], [-3812373638412044], [-18983079522948150], [-15202097546210372], [19648629162159192], [19994252842377382], [24456461290397586], [-33992443483613572], [2887183035494638], [-33601121683234380], [-19052688341090290], [68547375932093982], [-11515414775891256], [943078961967952], [-27434453204114246], [65132658943109612], [87834445767126144], [-40928249341090026], [-25377606630246782], [-81198461546163630], [156903059661641786], [-19165867577647884], [22062861443818166], [-136346835968196624], [43494919999192078], [-208497563333221672], [-249282611233714476], [145109873387955906], [198127166900027734], [-230381995342550850], [-364296360673153424], [21717482203717020], [-198718990347079584], [-471597862471979336], [-114636339459987300], [12879360668887556], [272812154344161768], [408824236278402606], [-468975502839432726], [-612358729613548604], [468270288292416974], [-1116108302757722996], [278972996588388450], [497446108616742588], [1156535003004963930], [88014962752765868], [154048129795441342], [-1461113904643961724], [-1323717200623180818], [-1543250474746700040], [266564324178438650], [1032813282165950752], [451541280745588618], [1868698635269928246], [-1237237618430421220], [602949442486809752], [2687833301629079682], [1922605140695672236], [-1548294892937413992], [2118678527719586178], [-1713757470500782044], [-339226139764007962], [-19960663323281954], [3267444788377428042], [-980130018496892508], [-2721452079908411452], [587143117623057390], [-3678038066296362154], [-2246089731903594864], [-6280820086726448504], [-5840677960868928398], [-6402491090486212300], [-6617169652386922056], [1097599476209942576], [8916992483146692922], [-8551667918713393638], [-3404202799496751358], [-4271867214173115030], [2010200967685144924], [1681311643363833138], [8897418238258646154], [7391518821461146844], [4725754002670149126], [-2480898418352227928], [10202605667477005140], [-7916032028703180178], [-13707611597228931288], [-9046006856817082790], [-5969414824479999738], [10355010557739735116], [3959227035493399584], [-4384031090314337246], [-4000583698570364238], [9474501965671045756], [12210143957657149032], [-3273050939281057724], [25069385557117868112], [5265471710300882744], [1827193373979186978], [-37261453685003018], [40875511169879907102], [25048939926347127612], [-28898055405610176474], [-39569284620897394088], [15385483855769992956], [20046487543543693422], [5840067887528590728], [32168704058142394976], [-2941734610476942326], [-53543792333210300110], [1049296796530433082], [67962785269293347436], [-52569031491698726866], [-40822590142382847768], [12885164088147680278], [-10550431869875454256], [-25371607026310047558], [-40936898853585416692], [-37672963875013489866], [-51662674390719952520], [-11462630050774189666], [86741432849683302592], [86515043580477392148], [-15709946076562568918], [1754364413518340310], [-55616697441011896848], [93502444983322279590], [13313815721282054386], [17118836438502562636], [-112909310286912219958], [-46826221538743256448], [46789491977426273662], [70296783976469003076], [72306414480797448740], [93658569257071806030], [43480584306868890636], [-163284006289985552394], [161949131475740539634], [198818151754674366994], [73228275689698943550], [-494829948194867880], [100307753010981322686], [39044729902845360272], [-186836217403859078438], [131626901266473613154], [220818698063234744220], [91324557883630312146], [-126664735560446787328], [250252432889645092140], [90953831228630077674], [111817768598788027196], [-134468244285246922706], [159791623826185651302], [139699083972114552136], [144755125964520953076], [24354300645002191752], [-76749691213605902710], [-85518220684407770480], [199129329520990237458], [242233617078568589832], [-72822248933343130638], [-139892788732879630474], [-29093739192893441128], [142701865258364319618], [-200965750780272554576], [584615969649443784924], [368484252630742061798], [-292728667168406838330], [-67114424554603020000], [-495588216352131709448], [-597965225555085499044], [-704763902851505149214], [-397606068834373902652], [-127957288777810998592], [-19697263484981198166], [506026876744352450308], [86459024236330531440], [203962939217819802002], [-576499182660942498342], [-207762907908225490740], [-551680516361089481400], [108326769770016186876], [643693938245577836], [-120314573837019816680], [-79538866057719047170], [-4615875357957012690], [1000626278493035943864], [-224140766638972798880], [368618059323134209908], [-664882367862736841764], [-450506310458790304368], [843524637682631274130], [858245414359827870018], [-333728635684180135464], [-57279365882197919446], [299377898590790198466], [-21532638198608587548], [78223654886917421222], [-1327139276628392013644], [-651189106976248024182], [-848511104255140416410], [1275254442144453258112], [-306663837203072306772], [505044627717320783894], [1046959964590969765810], [552067305545683681758], [772661483140248505844], [1507341984182374765086], [-857719667074712623398], [737174774518660480468], [545649718733693083818], [910493680629614033342], [-670114491695971816292], [437393916228205464454], [-37089208634142445216], [-2406066398528904972338], [-1946661117656050949912], [1269822568238446360212], [825507746782280744750], [-39580634988977952022], [-685791307246025395548], [-2090647896319101375648], [-2385384789426923897464], [1985701098566043321768], [-81387167508393980458], [1924637155428459084676], [-508234003132674049776], [-2957587646515908201746], [-714873499960166806950], [2762153671359140773880], [1013754551508482562018], [-1696889680851478458402], [-1108570850639968754052], [3382650599282385319782], [1955671456532705401788], [-2586375846812202940286], [-4010431803042438931122], [-3077258524957627409632], [-114526505769213288582], [5113114660549117386540], [3206330954604849227116], [460056108511169295190], [-3068205200556590675646], [3911459314017117364112], [3346267417472572714908], [4672665922192104708812], [-2640594206196223348322], [-70756434611897095836], [-543075591524026847650], [-572645984292847334376], [3075929151718713941098], [-4756479747164230202064], [-5879724358495095121050], [-307797547325810372190], [5346654453331239245452], [-3436157309132190984840], [-3147620289703630914166], [2755592206225565898564], [-3668207170296791602368], [3172670957948609148094], [-988609409235796170222], [3242260740415740055268], [-6608630397304296286202], [41411636864179038990], [-5434246175960683103456], [7905561028274207045430], [4008604967107581553586], [322687942157916883028], [7414789314364384358260], [-2476144099178097977376], [-4838807913820085480886], [-6085848982765689410530], [-5217504680091042408942], [2776851847223958188480], [9603647184697113913452], [5842771347731945607164], [-2331867441041332320204], [-6438958706457352500850], [-2452482161187934235490], [-9688639329716398026934], [9619662370663414084048], [-11246568810186680628422], [2540357554635558093798], [4443534493820877029526], [1618435369344773794280], [-4011362526382191327438], [-4543050554925787257228], [3167199534646557572150], [-1981583431823582063324], [-4804680118298802273936], [-9015441819701160963078], [-10426284346709290682860], [10656191972509135802326], [-3806095783480425336258], [-12205590409988376138512], [11909668822123004972966], [-17092209952657464108282], [-14674098995344583896608], [-194522450941277724132], [10778859206807715874638], [-7919017889739132120984], [5272645676186387771626], [17491469869691604335466], [-10262665936759854163536], [-9676401893093970956916], [-5310840592758004090100], [-12188202601079387087114], [-3498460516176433670430], [-7521308361077367450536], [-4116515164098447512710], [-5639889173744953314252], [11122273289822224289948], [8427326433633680712912], [-3905065653457735634490], [-477978517540367587816], [-2856106643106341492270], [-3536314573499697665628], [16745294531059146636192], [22323995589754964493406], [6786708518036597740146], [-13512063085766044316762], [11992216012687660533102], [935483381895034970838], [8164550477903975545096], [-11131002577823189991138], [19508442534747934593716], [-28053239584312968384456], [-11021713337325764361808], [21130900731562893762490], [11296056498912743674132], [-8355167217734277843072], [-23727225543406082078590], [13703900314759042339818], [-15378203073828994256196], [-1542427665696840280100], [-11370284983071529909704], [13277237596139156443846], [-37455120027860784889312], [12416668040854840016394], [19978230798557301388892], [-39571259895823759992954], [33997347925638025192430], [-16827843334714818255810], [7311362582584546802032], [16835298685049975465862], [-19674899121746404102410], [-33495599591923000187320], [3400405702828144941730], [18651464718363373923378], [-27613397686549855784708], [9075393238569510166740], [-12429177100470852042194], [-12134466961023962190438], [-50593619130914536085772], [23780850170525668663412], [16189686012210336676726], [11486505181267356722334], [40333972638124837048896], [49824370523099206193368], [14953047858163104415470], [-6267769876960924857336], [-25130237091331617734130], [-11801881001153966742902], [32430198481571054285136], [-12314981566165553198100], [11848204515267653188246], [6743077743067946120322], [29750363260917812976348], [4356084060660778543674], [-57916821108095467477108], [19765928534360562754776]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_100_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


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