
// Make newform 150.14.c.j 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_j();".
// 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_j();".
// 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 := [33395130437904, 0, 11557705, 0, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0], [0, 5778853, 0, 1], [0, 86682785, 0, 5], [693462300, 0, 120, 0]];
    Rf_basisdens := [1, 5778852, 481571, 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, 118456, 1, 0], [2009280, 0, 0, 28], [0, 6695558, -91, 0], [0, 23807526, 259, 0], [45284824, 0, 0, -1015], [0, -512885100, 1505, 0], [-1036155114, 0, 0, 16576], [5864203388, 0, 0, 7189], [0, -23889424358, 15771, 0], [33935784114, 0, 0, 41286], [0, 38807206364, 13496, 0], [0, -53451351660, 5369, 0], [0, 2275615266, 19894, 0], [2167173120, 0, 0, 979132], [443705842430, 0, 0, -295386], [0, -733922890844, -2570232, 0], [468075666240, 0, 0, 987504], [0, 406968467978, -6267030, 0], [624314707372, 0, 0, -119091], [0, 301932155628, 14981120, 0], [4008129584742, 0, 0, 6636294], [0, 841271190142, -27067600, 0], [3871131065778, 0, 0, -20993084], [0, 2714430667784, -25087545, 0], [0, 4469324219988, -20228390, 0], [-15917326197350, 0, 0, 26853904], [0, 884524296498, 12451481, 0], [0, 27709755185680, 118461861, 0], [-9297722680680, 0, 0, -3236758], [0, 135890158499166, 42017577, 0], [-11018022884816, 0, 0, -106870281], [196497003311286, 0, 0, 208764528], [-45948160592452, 0, 0, -668125731], [0, 76342646898082, -591139787, 0], [0, 115430006239964, 719703040, 0], [0, 22604519361900, -193170425, 0], [0, 264468604666242, -642980576, 0], [-271328034846144, 0, 0, -1423044854], [-33329625509026, 0, 0, 1689517984], [64228288392216, 0, 0, -3571946140], [0, 440663142982082, -644643594, 0], [0, -141856608917346, -1643603542, 0], [-432678197947388, 0, 0, -1318747493], [-1405662032814040, 0, 0, -145749751], [0, -1752761348390200, 2495339497, 0], [0, 654083401025388, -1770343848, 0], [-36681041003870, 0, 0, -9255184918], [0, 1105319344372218, -2453729229, 0], [-3774975919914384, 0, 0, 6225102338], [-482881688661118, 0, 0, 701990800], [2793673811371776, 0, 0, 7163170210], [0, -401147289569778, -2374561721, 0], [0, 920656861013820, 14806154587, 0], [-3405573496219434, 0, 0, 14741445488], [3308613134595284, 0, 0, 9874527537], [0, 4114042705723522, -11915196475, 0], [7767279544309338, 0, 0, 6230987098], [0, 10845537125895668, -8327842460, 0], [0, -6522823770642654, -6178318986, 0], [0, 7548411141626020, 13033429710, 0], [-4850478223043880, 0, 0, -67651409098], [0, 5526026306189258, 38533693114, 0], [0, -3697096445566122, -73603568458, 0], [-18930897998602408, 0, 0, 26754625401], [0, -20473397644660994, 27051540614, 0], [0, -16969620846683748, 92832317970, 0], [7918180386719410, 0, 0, -6429009930], [0, -3414424777553406, -128440641273, 0], [34347654460749864, 0, 0, -79713396532], [0, -31751087279356088, -105533926617, 0], [0, 37458386686184294, -45342289937, 0], [12227303012824, 0, 0, 124192628609], [0, -59607022830457620, 196250447183, 0], [27518734461635766, 0, 0, 180232890880], [0, -88608479633341982, -57710260657, 0], [4385437063801914, 0, 0, -81062028768], [30333484482463654, 0, 0, -415889575528], [90307424866998360, 0, 0, -8201053574], [59927386899842270, 0, 0, 45309954438], [64526126570372880, 0, 0, -586670820372], [0, 41678542237147394, 690155035850, 0], [214888440218574772, 0, 0, -24211113129], [0, 13251800599761708, -448990252648, 0], [175806934984922646, 0, 0, -65479328236], [0, 275701202465496166, 241411746744, 0], [-97138802443727550, 0, 0, 879633364428], [0, -24238745383620856, -192079927137, 0], [0, 42138519247745964, -949689969102, 0], [35207833289764824, 0, 0, 385238779072], [0, 260458455506873512, -208725367529, 0], [152535510089568504, 0, 0, -886933663868], [-228846410014545536, 0, 0, -1588750892589], [0, 530975335198761876, -545837847877, 0], [-139260389203116714, 0, 0, -1481188245936], [-220495019794413822, 0, 0, 300546538740], [0, 420434396220819980, -363147093330, 0], [329695076298502310, 0, 0, 1380419546912], [0, 533899297376759692, -682279596852, 0], [0, 443284435796521518, -2730557301780, 0], [0, 507860862781828572, 1619668331218, 0], [839594185507971582, 0, 0, 1887477911564], [1283793025962243320, 0, 0, 789302940965], [0, 316424634668919502, 2967243610548, 0], [0, 374824930714753188, 1004740290078, 0], [0, 97828516906134450, 1843382285773, 0], [-1368790623287927256, 0, 0, -994883972628], [880509515600631818, 0, 0, 199838090144], [0, 1367570386201295056, 2384157800031, 0], [0, -1002339676669070122, -123607823199, 0], [0, -1282993786352861130, -1746006123771, 0], [273043803596892256, 0, 0, -3578280217953], [1976015219101826732, 0, 0, -1776491648141], [336170932281906090, 0, 0, 5029011839922], [0, -936248861195160916, -7462072906092, 0], [0, -2427177647711531676, 3952243349467, 0], [0, 282646435936354242, -2669927481088, 0], [-223874614549572048, 0, 0, -4472087864468], [472955398394605574, 0, 0, 2967303556602], [0, -2865267087793358446, 893257954974, 0], [0, 474452925898345974, 5234989155424, 0], [0, -169697504568581988, -10536005790646, 0], [-1847873964814785136, 0, 0, -12308325161139], [-1296866193632701446, 0, 0, 2074282692916], [1753195792204578082, 0, 0, -218065474186], [-2401098383059999560, 0, 0, 5816945367534], [0, 2937120291702046072, -1273988931957, 0], [0, -3461158059260681578, -4685552351361, 0], [-692483421313543808, 0, 0, 10242226087527], [0, 261237521034967404, -14456416232307, 0], [4886161969608147020, 0, 0, 290460822981], [0, -3557855757418152878, 5161134446937, 0], [-2866609662892777182, 0, 0, -15782771107348], [-4345976884164856082, 0, 0, -11206756128932], [0, -1081306924393468542, 29737219074962, 0], [0, -1513762021202708084, -393082067742, 0], [0, -2911307655825564210, 22147104232232, 0], [1280145246230513934, 0, 0, 17934971863662], [-1396610643098188144, 0, 0, 48505428621265], [-5493630370818065262, 0, 0, -31459103703524], [0, 3061671722888600240, 41768980748411, 0], [0, -1781784905624327868, -176831170180, 0], [-6441128080480845398, 0, 0, 4669760610480], [-1107425543801683704, 0, 0, -15150655656864], [0, 6146336114232761366, 1128126952365, 0], [0, 4177529928886845822, -17776013442901, 0], [11654887997288646184, 0, 0, -1448470655163], [0, -12377649370075245204, -19474402454647, 0], [0, -317544503228089118, -23226831477899, 0], [-6073494500047068414, 0, 0, 27037757463486], [0, -12939258089055025396, -23939696892692, 0], [0, 15995363987712059580, 1255556131963, 0], [0, 22248842733218534284, 18989843189814, 0], [24112035797629290792, 0, 0, 17576977679982], [-6443472328859461124, 0, 0, -76277020150317], [-16057977539273436474, 0, 0, 14749150904320], [0, -6824635553661985274, 90037704131536, 0], [21483417062010361938, 0, 0, -8591405905180], [0, -7054425315680165004, -89715511044586, 0], [0, 3599257488387391074, -47843965533385, 0], [0, 5916909746427473056, -99016183832517, 0], [8815210232206003104, 0, 0, -127349036011330], [0, 5675864345509411158, 142782420730467, 0], [0, 29322147720522329964, -79520551807123, 0], [-14638305295291284196, 0, 0, -40677836223549], [0, 16340391562337113546, -8776052795475, 0]];
    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_j();".
// 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_j(: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_j();".
// 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_j( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_150_c();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,14,sign)));
    Vf := Kernel([<7,R![4786377214790329559296, 0, 194494592672, 0, 1]>],Snew);
    return Vf;
end function;