
// Make newform 144.14.a.e in Magma, downloaded from the LMFDB on 18 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_e();".
// 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_e();".
// 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], [0], [-615884], [0], [-17048302], [0], [-231547688], [0], [0], [-9862529036], [705453830], [0], [-64738556072], [0], [0], [0], [766606866494], [-1380765177776], [0], [-2490400654570], [820761767284], [0], [0], [-12352800515314], [0], [14835929406460], [0], [33200058986642], [0], [-94435507923140], [0], [0], [-45440094248624], [0], [247674063414964], [371198271133886], [403274921658328], [0], [0], [0], [-918119491707574], [0], [1156736853732098], [0], [-51515565781652], [2469658503574096], [-338391878203988], [0], [3992143705870298], [0], [0], [-1220435709030706], [0], [0], [0], [0], [7916343993426988], [-11898658387102006], [0], [10185541807319392], [0], [-3489096191136176], [0], [-21484463620235638], [0], [-47193269136773792], [-16840363856726626], [0], [-64874038644651586], [0], [0], [91539201932326516], [-72685864101470218], [-50335120105714088], [0], [0], [-102984293266847026], [0], [-31438623279641722], [0], [-200699072927393062], [0], [160478874115874498], [-26409999944044052], [0], [0], [-28248770310939370], [0], [-101083164502340], [0], [0], [-307466641381051196], [0], [562944589214716768], [0], [0], [0], [-706938462150639272], [424544284196519714], [871581422412923080], [0], [0], [0], [-1594417956188541104], [1398401175890339666], [0], [0], [0], [1922664218555152826], [1851387206271155260], [-1255220249724146170], [0], [-943645561193462432], [-3060630403667076284], [0], [-2450760588685150520], [0], [0], [0], [-4215893417450835082], [-4489624789935667150], [0], [0], [-5237162785038431528], [0], [4595371106599793498], [0], [1267608405927912004], [3340800599121694850], [-5981684867560059824], [0], [-4992294204723243548], [1181423105669137994], [0], [5183142911470218242], [0], [-9257758418819540504], [0], [0], [11788428443538932584], [0], [14606224303640192548], [0], [9561633212818748834], [0], [-568005623918342122], [0], [17103460954452032104], [0], [-26827123639825755826], [0], [-27691266541280588072], [0], [-563153440041934520], [0], [27020598948698649892], [0], [-22744297557060966406], [0], [0], [0], [45649939020054904060], [0], [0], [0], [35352035876168771716], [-54534217733921867770], [-64368038474056174978], [0], [0], [19336149097225112894], [0], [-68965979011204320922], [-29113215858200270108], [0], [-43563103886343525056], [0], [-46208664127928208788], [-47416335871765245778], [77197546386749264116], [0], [107602477137265494362], [0], [0], [0], [55523809334659013666], [-25072065215780559008], [139051423274535102278], [0], [108998842719774099518], [0], [-729824483460683456], [0], [0], [0], [76217596477963012802], [-184729495909604209150], [0], [0], [0], [242940596522426908492], [-71656362561336855190], [140155826643218131214], [0], [0], [-272259024377684788052], [0], [0], [270739999794288154984], [-139577362554606919534], [0], [90610762787566506508], [0], [0], [291611583154422891338], [260548546275567334516], [0], [0], [0], [180279082791876322874], [-430884609995124558068], [0], [212621232670008860860], [0], [599865389710114666262], [0], [0], [579460107071135476444], [0], [239973427627746308498], [704100241792657251304], [-151257635143558397924], [0], [596778629610430743880], [0], [290262475777108685726], [0], [0], [0], [0], [-117851487379811377856], [22552306317341878948], [-761181325284443066578], [0], [0], [-1150292477939154902396], [0], [961648908481961481568], [0], [790007608612883278850], [0], [0], [1227963905085578562662], [0], [0], [-1322830902095182443574], [162114486913588547440], [0], [-1306803610867169207590], [-426370680621490301492], [0], [1465977749323313182394], [-886255929701535805858], [0], [-1680629935131280223936], [0], [0], [542342475927387102280], [0], [1711656067397676407246], [1841303380928710345840], [-2429775027405877001770], [1661228982763107816292], [2193960191817611835086], [-2576459810103543379988], [0], [2763156994976801732318], [2700006772350309458474], [0], [0], [1895661389370931050892], [0], [1798780054922395992806], [-941164747975326577304], [0], [1710950499053099164142], [0], [2154462485851721288884], [0], [0], [0], [0], [0], [-3121392355514104233682], [0], [3816433867957388168476], [0], [0], [-1275041560941663147320], [4212335565154871088410], [0], [5575828949319416664292], [0], [-4844582391666418521032], [5713355925396894273374], [0], [1789182293508598519442], [0], [-6724929602439470363770], [0], [0], [0], [-6994119459454357085768], [0], [-4951066591376277896122], [0], [0], [-8044544063178069423058], [0], [8592817686182674439008], [-4246083530922679231894], [0], [-971223232101970747628], [0], [-615445240621027078018], [-2819988716734789760072], [-9607731774255055887272], [0], [0], [-6521576408628947069134], [0], [10015730290092553462732], [0], [9961877989352396278096], [0], [-10269690690271290642082], [0], [12229363864798653474806], [-5367185982015382390340], [-11465462123520395490922], [0], [0], [-9612924788248326745124], [0], [0], [-15107283499655756681926], [727478264156679689536], [0], [0], [-17196250370047384577816], [-17103735638210643982570], [0], [-10674110574401090923988], [-16137547024423048202122], [0], [0], [0], [0], [0], [19113711990291234480614], [0], [0], [0], [8623410042356463856240], [-5452893332877172998838], [0], [22153970640137001447700], [-6703997642631704469574], [0], [-23188218613411603358888], [0], [0], [18904775339960147055652], [4073844507083841711266], [0], [0], [-27993668610241361978398], [0], [13150348003791437913014], [0], [0], [-35351677067671495112300], [0], [-33686283038475082710296], [0], [20155123064748400288516], [8814242350074105388010], [34364402546941048720240], [0], [34848159518588373135422], [0], [0], [-37168997818930633367816], [0], [-41122217294939562346618], [-16102584227734412269652], [0], [-11819210217121639856264], [0], [44602413734530038769214], [0], [-41411847410421402528356], [0], [0], [-45989036364719111161772], [-50434105121099135824846], [0], [9555601153872004175032], [0], [26522362393906512055202], [0], [0], [56580430411165466463736], [6901471264383639713846], [0], [0], [28953000185496109016116], [0], [0], [0], [53986267673071115879846], [0], [0], [-23162550572471989180390], [0], [0], [0], [-50005064737952469905816], [0]];
    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_e();".
// 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_e(: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_e();".
// 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_e( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_144_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,14,sign)));
    Vf := Kernel([<5,R![0, 1]>],Snew);
    return Vf;
end function;