
// Make newform 448.8.a.c in Magma, downloaded from the LMFDB on 14 March 2026.
// To make the character of type GrpDrchElt, type "MakeCharacter_448_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_448_8_a_c();".
// 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_448_8_a_c();".
// 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_448_a();"
function MakeCharacter_448_a()
    N := 448;
    order := 1;
    char_gens := [127, 197, 129];
    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_448_a_Hecke( : Kf := Kf)
    return MakeCharacter_448_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 := 8;
    raw_aps := [[0], [-46], [160], [-343], [6840], [2900], [16566], [6718], [-976], [61662], [-69236], [533062], [183158], [-966864], [-190268], [785010], [-2893594], [95896], [991644], [1068160], [2523458], [285848], [-7094938], [-252390], [-1824794], [9618848], [-16775316], [2724284], [-5398250], [-25129562], [9641456], [22016046], [51643714], [55526818], [-20437782], [70022296], [80519860], [14998072], [37176964], [107405116], [-113389884], [132257532], [-3877528], [-147799314], [195010826], [66803844], [167507580], [-79848632], [-12868338], [286473684], [98531658], [257316216], [257738918], [-304338206], [-213793294], [77525920], [-503407684], [-443691728], [81266626], [455683434], [431324310], [835265416], [128957854], [-549014904], [347991942], [-773188702], [755430032], [369427758], [-383442832], [676699948], [-884640430], [273898680], [-718777624], [557666762], [-350444120], [2097675956], [370722550], [-2158866244], [199648270], [1950022174], [645883146], [-265901982], [-1874486760], [1267946062], [-2614086264], [2214424372], [-1797374126], [-1143516986], [330188580], [3571890992], [2079362758], [-2368319604], [1505478304], [-3419908044], [1706426204], [2402570784], [476642796], [3351418902], [-3050606658], [-3712906942], [-1337843584], [-6967156158], [-2246472462], [-3522364938], [-3332824744], [7439897826], [-2941106310], [-5804811174], [7637049000], [943486970], [7515671296], [-8822486330], [-402928938], [3231781926], [3341620912], [-1711538002], [6408997922], [9494489668], [9512266566], [9056165280], [-2082271640], [10340021690], [5873332988], [3394047604], [10555285806], [-658559450], [-11425691850], [-762102916], [10396837820], [18930586504], [1987445816], [-8470190648], [-17028280008], [-8182361690], [289321278], [20924166046], [12113860808], [-556243274], [-4667067972], [6083203094], [8275844830], [3652295154], [-16509931816], [-17612653012], [13847510920], [-24002656836], [3922695076], [8870291102], [-2651798494], [1975075384], [15975704846], [-19343322870], [27800975300], [24082632972], [-31656443204], [5153759472], [-23905075240], [43631908662], [4675541986], [9723495352], [17288824560], [23144796250], [46263523632], [-17964229114], [7070403002], [39105823244], [21391497312], [42678642296], [-27852152610], [18378631572], [46426020100], [-18429672492], [-47296693280], [-39968294934], [-28912582388], [40421813378], [20641909660], [25073457318], [-3637344816], [-34643013864], [-16093786168], [17132162898], [-79453742338], [-10159476646], [-76390901488], [-35236833364], [53733001322], [26578761198], [-63790652830], [-43891499228], [-53799951358], [54606614148], [32407990052], [40075149620], [-32510938300], [-40337110590], [52274577646], [-93574661826], [-55977225094], [86904341096], [47626178314], [59949048340], [-71000493624], [-35057505158], [-31684028818], [-120384022392], [-73967774748], [-111076485144], [-25690666546], [-576626102], [-23046458306], [107945184688], [77014884248], [105011346902], [-109839578360], [-16712367474], [47360693776], [-18614738242], [-75887095128], [132070326614], [29209595710], [70883100056], [195233280466], [114280636504], [205532846814], [14153974190], [5245815722], [-51031646504], [135107215296], [-64335963192], [150159326310], [-117016334230], [125300379216], [-164098183062], [-112010150098], [-13437015744], [50265507638], [-164934730566], [7047235028], [-55564535488], [-55105751088], [269483965598], [-248751737152], [-244235019254], [28286848746], [102541259172], [84688114672], [-197586209442], [-75074938688], [200468685776], [-100019782430], [245304834690], [-76093824912], [146205060954], [298437076712], [-78485918508], [-180079972482], [244406814874], [76730279072], [-252118445074], [-262165485464], [145636987320], [249848066784], [273115437544], [161588431910], [-70467069542], [226001195090], [13706256090], [-226181467028], [132531846830], [-316576318500], [-275657017424], [-164343531758], [20391867936], [11934040274], [124042241968], [-48630486800], [-439375880078], [-310138424754], [-172023746698], [-173106852952], [-497401680872], [1296542268], [376930725720], [172074281614], [47397512464], [-174145103582], [137039744010], [-420538218148], [116381358450], [-308645329990], [-575735320202], [-109561366362], [-43071094178], [-415416756118], [-307643771748], [244965183008], [217967060396], [163790983026], [466923481442], [-369889183266], [-50473912538], [-56096879360], [140548651320], [105501756704], [293918960026], [619374160032], [-581675423360], [-486634527888], [-462320888014], [50482088760], [22191082566], [-545493267382], [-563657561688], [729143616448], [-437585519590], [417031552338], [-322546701696], [183515153754], [-81687337406], [-571280349958], [-56148992126], [110181212584], [561008131720], [557337565830], [-395456216882], [19086822272], [669771013262], [864316600816], [409455259230], [17183999442], [110478359238], [119855138580], [-405647441510], [-449466772052], [358294544174], [7016904374], [-731377644398], [-1044504640566], [-430023179420], [-452126906774], [-153937980858], [903607565436], [-32565806880], [-378964178410], [111791334768], [467551879996], [-367745382808], [-376834635000], [211392813240], [550901367746], [634622883114], [482345078058], [-809811909900], [966359042762], [415294556274], [-361740762036], [869590854710], [443096143794], [-524633148928], [-1201775189766], [556725445218], [-111330963888], [-818318475412], [239647258622], [479433675910], [-409032525604], [-62954679488], [22108670550], [1098828647508], [-1109928056078], [183976538032], [265787683066], [565504915352], [533478332482], [1198933744366], [612931456424], [405675523098], [534332447174], [-1220192013122], [975773033580], [661897853526], [-69262928072], [967784397906], [-1048917954270], [-1285619356712], [-104795671400], [-956349728992], [1495402442932], [137246180292], [346666005694], [387851214480], [-1416379084404], [-1631248619014], [-1102446284152], [-686995455758], [-1858297476676], [651636403878], [-1216756668308], [1334871071334], [1697580210440], [27236128242], [1163559320624], [299997615582], [-2239997462060], [1510861697260], [1193425560426], [-103050943202], [930374431034], [-1532321781390], [1641571070842], [367577741598], [-691521572872], [1080291539948], [-47289392006], [-1456586790204], [1983160849368], [-1819676693476], [1950018218118], [1709967412992], [-891708474266], [-1462061434104], [-991589021648], [1120315546730], [-1280869895018], [394000487616], [104088425232], [-1579377029382], [1852771861290], [165598333012]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_448_a_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


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