
// Make newform 150.14.c.m in Magma, downloaded from the LMFDB on 30 December 2025.
// To make the character of type GrpDrchElt, type "MakeCharacter_150_c();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_150_c_Hecke();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_150_14_c_m();".
// 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_150_14_c_m();".
// 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 := [25651469713984, 0, -10129455, 0, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0], [0, -5064727, 0, 1], [0, 227912745, 0, -15], [-607767300, 0, 120, 0]];
    Rf_basisdens := [1, 5064728, 1266182, 1];
    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_150_c();"
function MakeCharacter_150_c()
    N := 150;
    order := 2;
    char_gens := [101, 127];
    v := [2, 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;

// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_150_c_Hecke();"
function MakeCharacter_150_c_Hecke( : Kf := false)
    N := 150;
    order := 2;
    char_gens := [101, 127];
    char_values := [[1, 0, 0, 0], [-1, 0, 0, 0]];
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    values := ConvertToHeckeField(char_values : pass_field := ISA(Type(Kf), Fld), Kf := Kf); // the value of chi on the gens as elements in the Hecke field
    F := Universe(values);// the Hecke field
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),values);
    return chi;
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, 64, 0, 0], [0, -729, 0, 0], [0, 0, 0, 0], [0, 6947, 0, 1], [2989602, 0, -11, 0], [0, -12353861, 0, 68], [0, -24259098, 0, 437], [-117921185, 0, 637, 0], [0, -390986646, 0, 2203], [991286610, 0, -14987, 0], [-1797573253, 0, 22751, 0], [0, -1882914838, 0, 43314], [5397085452, 0, -48939, 0], [0, 3774414949, 0, -109579], [0, 30378947862, 0, -130616], [0, -103096027296, 0, 540899], [164313570390, 0, 428080, 0], [494581181627, 0, -825966, 0], [0, -29856605953, 0, -855339], [1314837340332, 0, 1636749, 0], [0, -370921865546, 0, 5106498], [-2554776115640, 0, -5215032, 0], [0, 949966712214, 0, -1241648], [-5449933017840, 0, 4024860, 0], [0, 3446992682537, 0, -30264736], [6624566791872, 0, -39322211, 0], [0, 2088612720364, 0, 6049986], [0, 1211385135552, 0, 24958187], [-11976384641585, 0, -23196790, 0], [0, 14566284166164, 0, -28868192], [0, 36050484453032, 0, -30807882], [-30394955882808, 0, 88673585, 0], [0, 11188493348502, 0, 275817942], [-30465809473460, 0, 112951326, 0], [-59592690237690, 0, -345355758, 0], [-136144767383503, 0, 88782159, 0], [0, 106767560989007, 0, 35822818], [0, -266340447154841, 0, 338973787], [0, -91903186074168, 0, -1416168967], [0, -269837152887666, 0, -477898501], [-176610316015170, 0, -1560593018, 0], [-500703732430123, 0, 771425492, 0], [-208459488339618, 0, -1434869413, 0], [0, -713337308296451, 0, -575236194], [0, -349175419585698, 0, 2567917762], [453824397777475, 0, -4592201605, 0], [-957291620354143, 0, -2090771945, 0], [0, -1735091483949611, 0, -5208321425], [0, 815824158458892, 0, 1377408645], [-418599599708885, 0, 2860807054, 0], [0, -2940427743602556, 0, 3674689743], [-1697681426574480, 0, -3644871433, 0], [-698975676050263, 0, -10920823252, 0], [-2191683453274308, 0, -10545445202, 0], [0, 2773444767262212, 0, 4471116074], [0, 3495657392975844, 0, -8528107591], [-3952515712568010, 0, -13389437263, 0], [-1963354342951528, 0, 28092867762, 0], [0, 3755959057392857, 0, 18921906308], [-7699432044774558, 0, 15641839345, 0], [0, -3000319136579021, 0, 12930972445], [0, -2767865029017006, 0, 29901273720], [0, -866004903337123, 0, -1939306893], [-1797889038276318, 0, -77564708830, 0], [0, -796519539967331, 0, -80274271646], [0, -9349907399504448, 0, -54968492258], [567789933929372, 0, 27631714746, 0], [0, 650709103367897, 0, 122807304146], [0, -4606343562784578, 0, -106484908944], [46677371758932070, 0, -21211600716, 0], [0, 49660270351982214, 0, -68153583189], [38863637686838220, 0, -25672131649, 0], [0, 233683525666277, 0, -74651404803], [0, 45399296967250849, 0, 129684240832], [69717422409758725, 0, 126151701631, 0], [0, 87044470250571804, 0, 64329469510], [2267262811780020, 0, 136224229657, 0], [0, 13033327584605267, 0, -436877359060], [-26813992887026088, 0, -174336503013, 0], [92221272931584475, 0, -110006195978, 0], [-25036440694265880, 0, 149124171283, 0], [-63139122610570738, 0, -222622869090, 0], [57821461348440942, 0, -195161214915, 0], [0, 31757734914124189, 0, 242258905442], [174180100999074205, 0, -159655235691, 0], [0, 90503054325440304, 0, 312033342202], [-84978054729181740, 0, -774865286458, 0], [0, 178554932801562662, 0, -352329081276], [-42568427961517368, 0, 590146076055, 0], [0, 128485470865971064, 0, -629490614802], [0, 243092752451673882, 0, 67843874313], [-176967900001481850, 0, 661099797916, 0], [0, -107970485955059323, 0, 1024964996527], [171741342808974792, 0, -713710233716, 0], [54288684068869375, 0, 555042074475, 0], [0, 153483678814345044, 0, -946090266383], [150459089187914970, 0, -1112211710034, 0], [-548971475698516038, 0, 72759555525, 0], [0, -564035624219408981, 0, 1065397973331], [-718892732708711143, 0, -698161879328, 0], [0, -549389720805078448, 0, -277245055458], [0, 718621623364437762, 0, -547184640996], [0, -312384349782818886, 0, 3161317175093], [-333495416447428530, 0, 590530494923, 0], [-772893453755046703, 0, -1041913269593, 0], [0, -1243863376483622053, 0, 836608587996], [0, 519158624119017792, 0, 318369778935], [0, -806870241291583356, 0, -4321022422135], [-548895098199443100, 0, 3343250009310, 0], [-639596177972639773, 0, 419530764190, 0], [0, -1048003381002463168, 0, -4634481102012], [0, -1299450387485098946, 0, -2997923056524], [0, 986016844957484952, 0, 1111405863147], [936371025025244755, 0, 2800818840585, 0], [-168346757602486633, 0, -613792270735, 0], [1330591006001933652, 0, 3085712415426, 0], [0, 246572807010707884, 0, -1049693748162], [0, 253902043907112492, 0, 2910743915360], [0, -839675337908710506, 0, 6233284593172], [246454608725146020, 0, -8228119489589, 0], [46571591846389802, 0, -1221733717476, 0], [0, -1397610135923006366, 0, 9900556987794], [0, 680311852153128582, 0, -11309720953627], [0, 2306620794514007064, 0, 8087119479592], [561900566685397472, 0, 11662952643330, 0], [1135586085741790842, 0, 6887328060883, 0], [4489061453540436955, 0, 2580933973738, 0], [1047274602062829810, 0, -10598981321469, 0], [0, 537662231014860347, 0, -11713867096719], [0, 1442549278564809394, 0, -5659017786132], [5952519250676527660, 0, 4040621190120, 0], [0, 4507876010409591084, 0, 10248847778028], [2935615386563046392, 0, -9958805562522, 0], [0, -5918958306108677803, 0, 7522464729726], [1821581435533097292, 0, 24315958044992, 0], [5712458730951342805, 0, 15953118500030, 0], [0, -1384392401138486196, 0, -20128202914367], [0, -1638838777528949923, 0, -19449165901863], [0, -2565755680730553108, 0, -4006987562270], [-556309010225961840, 0, -47829029898381, 0], [6396198928479023177, 0, 21460878280589, 0], [2028110704322421222, 0, -14663345931368, 0], [0, -9117108005007499751, 0, -17617226594413], [0, -3967330287961754808, 0, 19017016339555], [7404389998964241550, 0, -18613043605344, 0], [-7806445473880726290, 0, 19792271558955, 0], [0, -3419781502506594911, 0, -27817508125314], [0, -8420024942323176708, 0, -27732506511410], [-6015869442355979840, 0, 55697176182594, 0], [0, -8396861502163703976, 0, -33045167703290], [0, -9458671776869764633, 0, -4250305936910], [-7532529222924398808, 0, -29897055994290, 0], [0, -2519243379343298051, 0, 10294815508309], [0, -7773129141142387158, 0, 67522425323240], [0, 10226378351405742452, 0, 8503927736892], [-19612567312479553998, 0, 41369835443244, 0], [-73756172759149385, 0, -103658909485173, 0], [-10617053113972347930, 0, -14095627035935, 0], [0, 16384395727283645207, 0, -4881078683462], [-6527404794714819138, 0, 13997294994248, 0], [0, 20310485555412179622, 0, -48144844431659], [0, -6988706661586949016, 0, -95825928704300], [0, 16002835860172239032, 0, 119218901839908], [1669503794416654542, 0, -129866076226954, 0], [0, 18729492532860242202, 0, -33878731286178], [0, -8375546537795274396, 0, -76168837224500], [-25832162766649675153, 0, 32875065832425, 0], [0, 12429106361667298682, 0, 16958967145308]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_150_c_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


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