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


// To make the character of type GrpDrchElt, type "MakeCharacter_144_a();"
function MakeCharacter_144_a()
    N := 144;
    order := 1;
    char_gens := [127, 37, 65];
    v := [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_144_a_Hecke( : Kf := Kf)
    return MakeCharacter_144_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], [0], [-3990], [433432], [1619772], [-10878466], [-60569298], [243131740], [-606096456], [-5258639310], [1824312928], [-3005875402], [49704880758], [-58766693084], [-42095878032], [181140755706], [206730587820], [-124479015058], [-95665133588], [-371436487128], [-1800576064726], [-1557932091920], [2492790917604], [-2994235754490], [4382492665058], [5661103299978], [21610430889016], [10934823426588], [-4206822356770], [-28765024146354], [-47801294415488], [-103693704636588], [-50538262349418], [-21487752160700], [87974080244250], [20743522235848], [-227522725788082], [141533307998476], [55799971905288], [-126777035126814], [308976432380100], [-474335729440378], [-658450343765568], [210092454662594], [-1565591114474838], [-366803879539880], [-1344847324997732], [2040830210528416], [291994379357748], [-2814848786784010], [-4393774620286794], [-4409529963591120], [1929397247427122], [346330697094252], [-459506466032898], [-8089657193951256], [-5060589068340990], [491452915256368], [3929165996758118], [-11441731284838842], [-2122458566592524], [19904981098076106], [12661051360200892], [1086779606388312], [21338344665108314], [30097120490396562], [-10046812884491132], [4004874143133458], [60627264503628], [30757831702864910], [20889663448536606], [-24636638117826360], [52865058749411152], [-6445692106547386], [65878722779659540], [88745679897654144], [-62746427689257750], [-98626099602657922], [3660882400499118], [141674536806418490], [144389625186388980], [132169256453691062], [-180535240406715408], [-133562817873339406], [-234588273429423320], [-126521740137981396], [191606761445794110], [-262243232425677142], [69496129015518018], [231197913974997616], [170771382851372388], [322879998550800480], [24156170451130552], [-461063651229506148], [585158129454996220], [-503072917124812776], [-239180645026210350], [-584938651103209962], [138090764553408196], [28730763018322382], [-177510090358098548], [-670558256920318878], [310510773508535364], [258365085562536870], [-991258931637668012], [-999359466177127102], [779667709167908988], [-886852492014836754], [-1566128865746044680], [1441861250492277242], [-408279638223527648], [-1013864799275684746], [2387636276891589942], [805525467979639780], [-2640345608223966872], [1064290620407953278], [-681097184977260884], [2044569594697118568], [-2081955274082093694], [2119078637477401380], [-1464593699730624538], [725357520895214114], [-422901813407040438], [1374691301994994524], [3239180040514932028], [4327295383699107858], [3722108478963896150], [-2697427753135732080], [1303379099981623432], [1232141483066728334], [2379984280955451340], [-1713421718031510456], [-8155762506038273072], [-4088185976132339002], [-4833395052014788122], [-5137684853959848190], [2819476732432206186], [5906004638161456732], [-6004645534665006798], [10328053161182757750], [-2374885951617386972], [-6177412576278913542], [3842459230884091816], [13592581271691290028], [407966203464814190], [4609302694997853480], [-5134957188287044186], [-8291277963445810938], [679619354044679860], [-21187480015448495136], [5292431009453678558], [-2318315269207038642], [-13896076792985526404], [-16848370811275660392], [25485385669930828612], [-17564079678607797168], [-2762909748223398200], [20225174145943400670], [9124093360956590858], [-9470050245008047902], [-10706014711945900092], [117295666306367526], [-14819588502913514408], [30368691683219670012], [34220350538321078382], [-21977824437178008456], [-17234839188798296672], [53036552658967308278], [-3580739886413141710], [31911876585768470586], [56395540606624795500], [-69120668753260196818], [-36884643149993290008], [-57367091684634952726], [10838782201076376880], [-16768031583720321210], [-13582716021777678092], [-5970855924410404662], [67568584372568916856], [96168877121943858590], [-33668721254004008768], [34937199946333760532], [-5559315095188559146], [34574959615069964502], [50749468095348612624], [70300465615511604570], [-71224169192977863922], [77682010201276922956], [102524382757498406090], [3286014631753767552], [118451008701203536514], [22691707356290488764], [128126880875742417628], [-68176223356195736142], [-24072840397683006732], [-65588747844769716234], [-79889436238913471758], [108120580113093765614], [-143844513872643530178], [-110028317231960807256], [-151069666886162912190], [177576858759359060848], [-15492602993638076122], [65996278002585499490], [-89197589627592139620], [163234466495910016722], [-207266692041869000960], [-76437881609081247276], [48649474778457667350], [93202378101004515268], [100768817992663087058], [-134188294389681346662], [-102366836942971786424], [-90541112865256817652], [-315337558051857077880], [-30851583457240131958], [268347417586270740112], [-208217101506832091922], [-45599795893889449992], [417963011963265320946], [445505689862286156662], [409232267089116770920], [67278668450788184190], [-455219458027120602704], [300184061592681196068], [221443885411151255270], [281435821612361903046], [329701347733453166880], [78035810844700385272], [171058447545138066012], [496675353320363235614], [255153939351716984380], [207906162818475189568], [377866791479251608918], [539569623369834742276], [783103733088334819728], [235031840228818792850], [-213604205327898943014], [-782596279630133001780], [885878424848802159432], [-149769541912582055676], [-585227690615010854252], [249945764679757549336], [84743963941347807230], [628019857425118749486], [646605602021593416120], [-182559603714146238368], [-678471563060676575628], [-66800790889090416860], [-235586056212644827536], [-251083249796291119762], [1111340346587848683198], [962208548692512017448], [538199858403579277610], [-288119006351813623614], [495860928507845244900], [1260647169200532008102], [1077133930488370393012], [795690005661983641482], [-766715550474057548902], [1326431376449459456896], [202441503620930905428], [-892685628245057979370], [-1457544113811817913266], [-1125808022919268857378], [-450333243626729307380], [1129962791511245130210], [-1032964047091001450202], [-228619733711810415404], [-735092258815457813334], [1458917210943700356542], [-1239724940291431741028], [68374145739602906234], [-5023820712171256160], [-361936476044496525262], [-1468366335504129839384], [1101483668888700510828], [-474263445545324293330], [-1703642382802754247958], [755058482606205453732], [1026799603121673227424], [79822000107238325368], [-1919984986629546664872], [-2088446468670925159978], [2168899430283968059012], [-2249804131176892021488], [-2721630334578206366446], [164148754106281846362], [-2640197291038817049080], [-801326431419158231010], [-1742626732801530090462], [3908740703975133828228], [2867878265719693557606], [-2133996733973000892228], [-1059681208483384820866], [-1464369273593301979470], [2094001234377521614048], [-1331154929840929838214], [381435486431441913900], [-4012055333687192224148], [829154340293884099754], [-4299239708350596827838], [2327993630525451629680], [5330822386969923670884], [4717275783509124105268], [-4335648965899520801182], [2023174041755852059548], [4154279216534571967070], [1924031471164957441560], [-2415913911032465111146], [-3642390150819530289456], [1597834034588716568730], [-1552060404503578118562], [4234508791979403528076], [-2302524849499264995192], [-5837455401194332949110], [6127273609593167544900], [-17605924711023092928], [6598528100538187336514], [2274819406627689420270], [-1411323648217484014052], [-1539553693041075152902], [-464687144324938501902], [-6973624888919118474464], [-2853439489020461791434], [-3893763727972436884558], [-1129046202377132777300], [8578991983924291059316], [3631494515180680216608], [-4830155488925295477174], [-7514411933688465031138], [1836543046759918047762], [-3584301983109381947840], [1387888911787085774484], [3755468319257047689988], [-2547511204892021016372], [-6527190935671676678770], [-4938458323521238387554], [9775769113662993885002], [-7390801981115256435248], [-2384801255628340885306], [-1336034959195346824218], [-6035730308789416535190], [7240308665712171649048], [-5314391244081975897294], [-15588532774006410979980], [1095193571385695449142], [-3938808884755931592668], [-6479853624077618440848], [14286170361366875332602], [-14557859713833620397332], [12104081265142501892138], [-12280933240643320890942], [3794433092550408626416], [-3446057570844884270170], [7424649593734655066886], [-17145434487770386974240], [-6156392448210467389668], [1653448992512296529742], [14520087170479702327704], [7792837731542956331798], [16250276624629904084118], [-2347898046201293921712], [5384276092980352990860], [-11126657220294095836148], [-12793806520146723489526], [11370545958987280073442], [-13419181997713130015144], [10985949302129966734202], [-8705100798327796214988], [-1251023130776523763100], [12248539885443150118704], [12894987462834684119610], [24976152345463379863528], [-8259548809680582092242], [-22700506586410714932060], [-5656057297403820690528], [3224806369363953466274], [-28074127657127457041010], [-17565418333022878784422], [-31726944211183873100142], [23821672203914301666006], [17073534621279423405832], [-13531558816195449585378], [17254611238001692184140], [33425563296713271887304], [-25970449049639629522352], [6139308557534383080518], [18882340383122431195156], [16175253860285055477888], [-37193942160274587146110], [30294914532785992757226], [32087767943526871820220], [14066101180428531827932], [-3805946047252462613448], [23199543496097708743994], [8199902860069305165280], [21613039000572871528950], [-37312967896210401657692], [17612369087070991246458], [23065946001490936874990], [-15801108365798623794114], [12370893611931675659632], [3982032804890752661382], [-26696264700735862301430], [5687858118046138270648], [-31965914470911526766242], [26215078131328237042638], [-12520171412319037934084], [6574428699075182557140], [10465439667261544373714], [-20418532122782381200998], [-15747935521644571473396], [-19897346063234503708532], [-50225996498133352145782], [-34602333318699149277342], [54441591280628326908480], [16594043461449661928152], [-17134433929110762789138], [-17885070577956467880456], [-34572334273882435565070], [34076317407041709810038], [-9781088174950333050192], [-6720466148082243869460], [-23041023503867993115286], [-43725041121910052405118], [-32299403843396290455516], [24294473186638690835910], [39255552519815700277108], [-61520382183312231799080]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_144_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_144_14_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_144_14_a_d(:prec:=1)
    chi := MakeCharacter_144_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_144_14_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_144_14_a_d( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_144_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,14,sign)));
    Vf := Kernel([<5,R![3990, 1]>],Snew);
    return Vf;
end function;