
// Make newform 3.26.a.b in Magma, downloaded from the LMFDB on 25 December 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_3_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_3_26_a_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_3_26_a_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 := [148321440, -783420, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0], [-522432, 455, 1], [1162548864, 1708315, -2227]];
    Rf_basisdens := [1, 42, 42];
    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_3_a();"
function MakeCharacter_3_a()
    N := 3;
    order := 1;
    char_gens := [2];
    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_3_a_Hecke( : Kf := Kf)
    return MakeCharacter_3_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 := 26;
    raw_aps := [[-1226, 1, 0], [531441, 0, 0], [-54384250, 43676, -12], [-3207524248, 3973036, 676], [-1982332710260, -398988488, -290328], [82712591469230, 6520110088, -730664], [2213628400415058, -120931939176, 14873352], [-1427572986360172, -839383716840, -17877624], [-18186318650521384, -4247981439784, -255718968], [-168783618890594, -231877876918796, -27546130116], [-40198486317117952, -117865532741348, 76747695988], [23708009755490611142, -2198827671598752, -259144083168], [-59412632811749142742, 20814364543552520, -264410428968], [77910715263985000748, 12542497254509704, -1161139853480], [-192991635813983602064, -100308014136338360, 20298709187736], [3018670208643055252086, -123056057069269020, -30109878830196], [7923108267519267649532, 463557317096698784, 70020321310176], [-3790572231791025003106, -422487516587392304, 430417432514032], [17404587084440495413508, 7770440088092160928, -347254212217376], [87651787290221868872712, 2932710170227808376, -1364710659252312], [-3917573641392148876534, 18136518967415958912, 3282880162757760], [-166847701918888161251920, -18460520919225292724, -9806787941675132], [-19685276479187223792428, -29155446461563785512, 22771868367189960], [-1119958353128849849339622, -162071554916830382832, -38200822640016720], [-4009810408414755856513822, 508459596907506270928, 18084146264215024], [13554396847696401316070950, -332104170186193476092, -41755187811900180], [2557631070649316743595528, -1133359838562353589740, -216623206236842852], [1563003188303773912941996, 341406101035515205584, 52513168790627568], [24368667785286385976905358, -117728074713763544424, 263626396293473544], [-4413418047775302354525838, -4173039358235720512048, 49682329134700272], [-29605741757218940164898272, -35607522640787917775916, 2442657779283145692], [-202583161638001268355408316, 15510226439621279008064, -611702485520345664], [-145453810886281329122009846, 20672876981881641660184, 2488731458263705224], [310043398401947219525537612, -22191699503956076132096, 15282570170572116736], [-142507884019639053637908586, 33862693051473783563228, 36942231883014312372], [-315571249981433479900563208, 175233725409933669093484, -1784538764841345308], [2097499103977746846888451454, 23850035620844057837344, -9218727837993853856], [4206281396381601013775232164, -38322906367564772253240, 62763512615421455640], [-316559369861077151874785368, -304372320415047819989344, 26134535062400814816], [-1061833182520889327744159378, -557633184368313594189044, 17501138149691625924], [-19508270032099358788978677900, -687662510103910361209632, -49143580754822615136], [8271528939008988930861467798, 177532121445229893478008, 501602979288412854696], [-19619643031031429641720723520, 6290676034185255989335264, 524089948229838864288], [14346129847442364997099976642, -2787441052643378162921984, -455179065953857127936], [3514152154927199062542296070, -4091315449962237717936684, 180961245855639003612], [-12443558931927551092888882456, 1779866271066725187392676, 383626411128927105996], [39351420832540448610510595988, -6926869526918700846309920, -1239171923575626444128], [-117297372048479096024248157440, 4036657614565546448121316, 389367874161636926860], [-62950362828087851187980519708, -2401648217913075211771256, 3020703559292962257240], [142293239802107760295791878342, 27651725816983491260070184, 2492233908846836940856], [303251227459228621253581514538, -12543141573973510274689008, 767521019869877064624], [-98278959022683396007062658192, -2720275417589862005013616, -12146203484088058897872], [208362119395696261600751140850, -37692047913650753198046992, 548439140397557968720], [-1101341076460701001623152326788, -31901248459890479493649992, 5845932010317498415464], [1411356406563897997692371207426, 9206790408152979626516864, 25999576237388811581568], [106908701852832045251341266184, -12192362617852649223834944, 11077556439370235155008], [1485487714147787424082717963278, 183566579926044242327032116, -31613472775567279853316], [1130730559042626164365843438640, -103543172410170276269612604, 38943605017544811235884], [269611121644072945638178152950, -23377823526723247653254600, -23327891156641254885656], [1015666804777563495086554291546, -637553725940696960413035200, 3072197960981149844928], [-652677062238791448462840331300, -629640497146276026280952960, 5143258568120091375232], [-2749235665617674491293261555226, 321039144793125999169557860, -97221670568882154012660], [-319059280385515766912147733004, 642553041672693064552055328, -222432495577707664110240], [-14356376010865930758072779346760, -314743600963287316113790864, 48914107777971321457104], [-12873780978774426557884663588486, 643366597875237821117112640, 95466076956981229996480], [-7037162810865113988174805405634, 242674328851571965674663652, 368811946657689922035852], [1317246482064876738630566794892, -348699950076615178557767216, 748881727293215001252592], [26312217240367718073725226337490, 2387814475303252626718609408, -173137500329560153690112], [18226770642220196305929981027548, 6812903490175886282466668120, -791699134765715527460280], [-30375938119277403100517510146114, -4233031193062319513650340912, 1042502417923931907199216], [-45742441678734515348659446414110, 1684677202429607421978582352, -114903486615106407863952], [59022759340736603565749346344232, 1022025289441690198535359992, -62289855525339497221080], [74231634378842611238955761740880, -10410947093847049164810583556, -742861686850638591372524], [-23927301468962135921118157593322, -4546348165293876455198933456, -4041809247875039377134320], [-50609289338688559983511434652420, -5926701466897770977621410344, 2161786823284271396728008], [-34785363469690138189735934709376, 4328860914217844846877365504, 492404366689369941219072], [176919546531701199419751800586502, 22618986623014545465092327068, 2210106215510666144609268], [111227913696288871374644240960366, 8894924738651778702920077296, -5125558645028396894821296], [342704558641414969036386446782034, -5323552956489397068750681592, -599041399292157567429672], [471233843326708228330927933287002, 30611804922114746364171286576, -2930007037018627295065328], [-201772823231333280644002556553052, -51564795132683712207979307992, -2130648227143672992018120], [-194315844170894601181846991464954, -28528376016912857792669177480, -1108048897229679438394712], [-397119827461293483367998385133712, -17604275017835158588605357000, 13105010443814873767654632], [535462801976834257285453990700594, -14628675893228057622833506464, 11651705436651622265049888], [-706186022586700915664864327978920, 83893729868495863170442776820, -12045748461438836926430660], [-913251979962398348680418062419140, 14500057374679556836270576024, -11791095731662666975798776], [-45929036605843211396556875186046, 103866299668752945470163965496, -13245854020393198791148824], [-1346222994266374887417109421685238, -124151415156795856169485973744, 27677917148022203465492656], [-225475120809665572918310228989298, 148917963111728919340660844140, -48910523693192334424362780], [-510822798875499349658649388171792, -38768732807521581063287743772, -34741100827567274734517108], [-237570280748085857492050051045164, 199266765218944665171857325096, -10684007623151479982051016], [-1915701925549270913862424530596960, -331050407300995525139202605960, -31253012995722784754127960], [-215397203848246509647290000693432, -39071826942570966678125827380, -60756251011166521320004860], [1608244875662599676305563924376364, 400690701053031231319861722320, 62859999716949169085393904], [1313360502614417088440186807130548, 64506313965215498173083698176, 144846100174748671473593344], [-4919840260479724101098079954816840, -113508900367264959504600529896, -56210097605169040858169976], [-2852646739743823467117404408646658, -511164629720464015128513759676, -63995308221562018402483284], [3409742120328657511995453758190858, 3284776146530694338617488360, -53372313755963158706247048], [-4796036382223834176312095568091252, -808422674934336818707309636584, 88745210806899815613083016], [-2744267379944840492764989546121282, -1508160057748528943239241026056, -249151263223148826032198616], [11714780448800815919770025861353892, -412034967265298944168799504072, -85693049586370860307395608], [7695710831102010580729498996185198, -1934142268282612970560477098180, -86054958676714904400822060], [2420351115770000388108175577541812, 2163658005898618607028077573144, 125721497163377478836571528], [7660212087625672861491069275909818, -1832815881249876081980017463672, 649290756376987024737320280], [4572527781785125591996316803246460, -1453624823990286844156267242608, 189392183754195504015368752], [11367251314278470066326458937974338, 948211134866687877323217571008, 846684441076744366473236544], [-44634673864698705718457379690985844, 385079148779807934351025524400, -553663445518495238142494064], [37384819176707680156036710820591698, 1105629284986170567595785119952, 486381987358911472538521584], [2615781949239803730973257076784024, -1063540417763699989071846178456, 359679892980964891137951480], [-579785962708194544461312942420070, -4447543156582715028426597180512, -547749588944408134632411680], [-59008769174256357429948609212161792, 3140634680617066589383643180020, -207542160655395455755961540], [-23652766483069011367245713331217018, 3438980211653710147952688546000, -277808062528895961185527824], [21053635427721421825924488415768874, 4651536801820171682009521728416, -1509726652993511027998663200], [-10043158460993453012233302376722388, 6852963655574896447794637934944, 450776611679788440752632096], [14494619116381091773543592114694872, 10906928923436096824213365894636, -2000465473461414214019552412], [23339380785481403583196624409907778, 4332398975854415759713600506136, 3234478801341891074432820360], [38140222181872843179719749670673668, -16657447892121816445401691833704, 698331281569378040995351816], [-100445451420488114632791531265046712, 3074845183194081034166562157464, -1825722569058308410442633208], [47101219340536044784010271742752974, -1963636451810961808921587369892, 2505180147930120422127110964], [-15544089002282743090675781241647660, -8188527964785869138195748953360, -2172753961483948804885625520], [21927460149006036954851245969044662, -9344258867873978779406267958560, -542537989806741932667928160], [57059723917677420369805439856495266, -10629582953807978256782181941504, -4536744079032905153440348928], [291051822906180632994864944906671270, 18531698945400377719187385392524, -1111531857457465953434077884], [137626184313512136284149453790369964, -25781011999715010080435513746008, -4600802789963517495970862664], [-222795835761972202622914319917350220, -9730335054740287416360219633080, 5656841653813417195061932696], [141722456806164933227264638506954174, -16720287230478714846571860197724, -811696491758571344629423668], [-293946099832151099142575054286725722, -35241789810424889771270380741208, 4745675349893193191146514872], [-207361712885242714573864750610781936, -91854427263907800846596839067832, 7035864567782738841381587352], [-262781317343456092834162119095031496, 52486512026133648197106997803052, -4446026228329269668332279772], [274861036577961956997822647958737918, 41212068380970236391893436776680, 12361800983514166960933742968], [649917255804549337278148557758064932, -3683773894832360811611710665648, -7573742852298873884790210960], [322783199144908193412139323591347048, -139338443704550975887442322352, -15412803337058262302622323088], [492258465206365503515409284123454800, 40839588528246824084270922456172, 2904384756749350539386643172], [-404233182895140522130312246975191466, 13455821648917788338845505138472, -22519724371886396490695003592], [-322123609984384844587314018291977734, 47151670110281135382187378850840, 14510274154514953741078046088], [-785516489899768862895168131620846846, -110334983828602465408173297031328, -6933057343831546804973878496], [1542198595370655302358513362742189894, 63471693650637623048798720848500, -8574263570605658603872798020], [1113659748809149551363348579121380116, -7946586629662248941495134961336, -7389925743647570859961356392], [-309176360802577555084792988973661474, 244276006068995745249551379911900, 38018830019349528200012553396], [-1026034828230168645716662351737666390, -361900956254006102493843863135784, 29983485587012342500664025288], [-214017690881668610123531838208200148, 133882039851505293579275332640712, -22483818980159245490212554984], [1648015534212104146460460535985839606, -267532611869950004297240894585612, -6578609448948365979153596868], [-1089061180671698127788161628142606568, -178309113953923504520346837698852, -65508877484493265255334612300], [-3263597951874883799565323346164160132, 237288251858766700312098104450160, 30895778182127664000452249040], [3047104002822165587826559648527992030, 107778386224014839339779238938392, -32788868712286918653094842744], [-1244809502777268160484909045559856760, 304935282501101615098786382666056, 43169141237797464273828902808], [4012494132285553724815215560199410294, -149416187992501545102834615046784, 15826095901268917200892574848], [-3410255959334093865282929313576612134, -195837830017112552101186461947384, -26185320968487167894736997416], [-3146195044239200701800871746821615140, -400984432253782429256634337921736, -37968536909804857756774375448], [1761360877472400798205408019857477728, -768175065455369781535716166428384, -45442643558542447861649057184], [2685414067749717975578659423141735502, 346322073128160283723325527026736, 127971949399590708227340076816], [7468728324218044087375118335612146, -131313829010968561458948452017440, -13215676912255635296867114592], [-4099845520392476100145033943814954892, -166620623533972697387398068994200, -83727784536866356665089699592], [-2651411081590949581834679191297379464, 300478632379573328921183722085504, 17079000140593619682554794368], [292079787210915923139891062601069836, 1721764303296580183893226705976344, -75058249875553724344179825272], [-3125913137977616360815071562211806448, 416416784810266771306617771657904, 67815711700847691979288432272], [-5860184237462504883752152498413187720, 363528232923799356360462037698588, -254235581283429570080293286796], [-2146770480381006549629460690873174302, 1283567690445780595600692410848936, 239194596381739646918437883064], [1161937793060891722971909970560166250, -1859195678651873359416558753791424, -157496310451440329165567400768], [-2028122467956953959728537698784072082, -1557152288416387146473952364787956, -185574285980170565601646803516], [15994791096633621753832115199620684404, 465428903125102999011371541890656, -36228142065040795528844859360], [-19116696563518698814505980627932260550, 597395701581399542622021625491432, -124434808029945907032755814792], [-2105371091823816265326315468603518872, -2390136309525329390112002559317900, -339156770150660893896839369540], [13717253901165555845057846871572742348, 834398554812037273908749605310856, 333650076635339875141012393560], [-7044382241249480002245107599918741102, -1473697059648782140841445371424664, 468320931222898268468770405368], [17306688387093067816607482456258685656, 2264314351625757935876124595762144, -155805049401597939712822057824], [-3578230356579892196429394623644362688, 4637872438782111585009756925005420, 6119179747853279063710820580], [10162859518715562934430364196146725894, 146929784966638311535658709635248, -397266412474116261517849530224]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_3_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_3_26_a_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_3_26_a_b(:prec:=3)
    chi := MakeCharacter_3_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 26));
    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_3_26_a_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_3_26_a_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_3_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,26,sign)));
    Vf := Kernel([<2,R![-172099067904, -88941600, 3678, 1]>],Snew);
    return Vf;
end function;