
// Make newform 300.2.h.c in Magma, downloaded from the LMFDB on 13 May 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_300_h();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_300_h_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_300_2_h_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_300_2_h_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
        poly := [100, -280, 392, -1056, 249, 1102, 1514, 142, 92, 110, 134, -42, 0, 10, 2, -2, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-10270163750249780, 14624860944800330, -45360331854531752, 92126916463550883, 153977461783007987, 137702325798693503, 19033663501635251, 14374316628170093, 13146910202250305, 10233411926272021, -3370500862960355, 354154580025869, 900030238567851, 128073458413399, -139763456245741, 86636170065458], [60325741155284360, -75746447756853470, 61116823485676360, -273431781394961159, -414320011727745050, -368774423844636464, -54356774154451946, -39308416851880182, -34750790799689754, -26719779381795744, 8648250714000762, -999218931322158, -2354611158042062, -336891024322778, 357846443441218, -226346343508237], [-369876607405151400, 325847979317508630, -1237980684525762656, 1536516552314755219, 3217262883760568034, 3044248646088284120, 410585059512938258, 260557328298605406, 295038115278944338, 233101021580454792, -78221672347190694, 6180392672162110, 20733265658664390, 2646022240920770, -3174147916287646, 1929125202927577], [98863904592843600, -101066527757082320, 312501612828562608, -635129376362693192, -1078946380058846257, -943555438353894320, -128964224760195004, -97572551570538648, -94564371327666289, -68250290013865436, 23215236455682612, -2730026919251280, -6211635392505545, -779859476137840, 914739690969668, -587554941526996], [-149867394391089975, 102635821893433320, -318125533167662008, 646308845146926792, 1056024008424042232, 964896046730279970, 132377160938952754, 99889405018821298, 91388557154928014, 71583351140869686, -23614605152547562, 2497248966540730, 6264791576736495, 895309719750590, -975202941656918, 604292511642446], [802294040382299600, -532715906449312630, 1305000111085330704, -4741233569077716801, -6879867909499226186, -5638045346715899910, -799940874318942562, -671493580621630584, -584323894034450722, -380764546333408138, 131746283062649246, -21290293578092740, -35713662523068110, -4268579158221040, 4945550259550694, -3414934690771993], [206726499151380400, -160057729160681462, 448711127739636256, -1108003317071291359, -1742910056939122056, -1493139717503591462, -204659053273097952, -164256391137268568, -151024436856281404, -105028482082195266, 36000575239442204, -4883257079628964, -9637749939945396, -1196110432632616, 1390492292472696, -917800794270695], [380659820612143220, -159234887709295082, 870435140198756592, -2250220449977606159, -3622419863090516934, -3002250019579009746, -423283232006252254, -326391269925404268, -319600434676759222, -206518644472271726, 72822818065112418, -10581763184612620, -19731023083720230, -2089419487333492, 2670735318417258, -1836336681975359], [-10194971362983800, 8460482668395730, -23962092350078038, 52387389441737357, 87459786900661662, 76805382087173250, 10655658220842394, 7809327047151048, 7755777214786054, 5513164517128886, -1887388853932942, 227389497402240, 505465180962810, 60782462586860, -72993794820788, 47453684427081], [2114870927102600, -1702682149182858, 5689896354744090, -10836885927773041, -18353859634055946, -16220541349019950, -2140329938493230, -1667197395273668, -1631072624298058, -1162254976132106, 400226279841042, -48857457060196, -105861785006214, -13088749471584, 15519853661140, -10024607033433], [-251189288889542480, 197520864760055710, -610626951533084724, 1241373562717283671, 2058940421980664480, 1843841483182700488, 249841383646932752, 189001840183997370, 181014495116556316, 134163056894225800, -45333833282593788, 5206836615561714, 12026613482603676, 1574622921644234, -1803373165163308, 1145254002757577], [1336006372893832700, -1076335218505282650, 3564490225164033184, -6633606991105286931, -11380031740138452666, -10190050813370057620, -1356071467211305682, -1028511137770238574, -1011840307489741522, -738833260679756268, 252175763237261366, -29080394237870590, -66701535508778410, -8459070870113610, 9909062524717134, -6321304344346553], [309863276953526780, -249416674888906222, 722782665301874912, -1592179858859192745, -2610036989376440402, -2292003923942511788, -315602556481814838, -237606705383002618, -229672551904476226, -164382522303202436, 56066037283580610, -6848948913343370, -14982469622939770, -1856217870781262, 2183999754967658, -1415679395091195], [-901336837178224940, 545714415521307686, -2367835990250177616, 4976711247918754393, 8207570554292642210, 7076860236944160150, 963356512535587426, 752626077810255244, 721189421463949570, 502270511683737498, -173135027827583806, 22328159035791500, 46267388989558370, 5592021960918196, -6665594401648694, 4374911179080033], [1194515334992463500, -669809684900877500, 2932602411379671446, -6764496177439740744, -10949136728509403289, -9295268841203540705, -1282153614266501053, -1003873180019302111, -960736540134968983, -651746171580854027, 226166284261509949, -30737718644105105, -60751710958866045, -7065908294090785, 8573258826363541, -5721678918764907]];
    Rf_basisdens := [1, 5503939667172770, 11007879334345540, 55039396671727700, 13759849167931925, 13759849167931925, 55039396671727700, 11007879334345540, 22015758668691080, 558775600728200, 111755120145640, 11007879334345540, 55039396671727700, 11007879334345540, 22015758668691080, 27519698335863850];
    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_300_h();"
function MakeCharacter_300_h()
    N := 300;
    order := 2;
    char_gens := [151, 101, 277];
    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;

// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_300_h_Hecke();"
function MakeCharacter_300_h_Hecke(Kf)
    N := 300;
    order := 2;
    char_gens := [151, 101, 277];
    char_values := [[-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    values := ConvertToHeckeField(char_values : pass_field := true, 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+1)]];
    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 := 2;
    raw_aps := [[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, -1, 0, 0, 1, 0, 0, 0, -1, 1, 1, 0], [0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -1], [0, -1, 0, 1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 1, 0, 1, 0, 0, 0, -1, 0, -1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 1, -1, 1, 0], [1, 0, 0, 0, 2, -1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 2, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 2], [0, 0, 0, 0, 1, -1, 0, 0, 3, 0, 0, 0, -1, 1, -1, 0], [0, 0, 1, 1, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 2, 0, 0, 0, 0, 0], [0, -3, 0, 1, 0, 0, 0, -1, 0, -1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-3, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -4, 0, 1, 0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, 3, 0, 3, 3, 0, 0, 0, 0, -9], [7, 0, 0, 0, -2, 9, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0], [0, -4, 0, -4, 0, 0, 0, 4, 0, 9, -9, -4, 0, 0, 0, 0], [0, 0, 0, 0, -3, 3, 0, 0, 0, 0, 0, 0, -6, 6, -6, 0], [0, 0, -8, 0, 0, 0, 0, 8, 0, -5, -5, 0, 0, 0, 0, 2], [0, 0, 0, 0, -2, 2, 0, 0, -1, 0, 0, 0, -3, 3, -3, 0], [0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 5, 0, 5, 0, 0, 0, -5, 0, -7, 7, 5, 0, 0, 0, 0], [0, 0, 0, 0, -10, 10, 0, 0, -10, 0, 0, 0, 10, -10, -10, 0], [0, 0, 7, 7, 0, 0, 0, 0, 0, -6, -6, 0, 0, 0, 0, 0], [0, 0, 0, 0, -4, 4, 0, 0, -4, 0, 0, 0, 4, -4, -4, 0], [-9, 0, 0, 0, 6, -15, 0, 0, 0, 0, 0, 0, -9, -9, 0, 0], [0, 1, 0, 1, 0, 0, 0, -1, 0, 9, -9, 1, 0, 0, 0, 0], [0, 0, 0, 0, 2, -2, 0, 0, 10, 0, 0, 0, -6, 6, -6, 0], [0, 0, 0, 0, -1, 1, 0, 0, -3, 0, 0, 0, 1, -1, 1, 0], [0, 0, -5, -5, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0], [-23, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 4, 4, 0, 0, 0, 0, 0, -5, -5, 0, 0, 0, 0, 0], [0, -6, 0, -2, 0, 0, 0, 2, 0, -4, 4, 10, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, -1, 0, -11, 11, 1, 0, 0, 0, 0], [0, 0, 0, 0, -1, 1, 0, 0, -9, 0, 0, 0, 7, -7, 7, 0], [5, 0, 0, 0, 10, -5, 0, 0, 0, 0, 0, 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], [15, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 2, -2, -12, 0, 5, 0, 0, 0, -5, 5, -1, 0], [0, 0, -5, -5, 0, 0, 0, 0, 0, 18, 18, 0, 0, 0, 0, 0], [0, 0, 2, 0, 0, 0, 0, -2, 0, -2, -2, 0, 0, 0, 0, 6], [14, 0, 0, 0, 2, 12, 0, 0, 0, 0, 0, 0, 14, 14, 0, 0], [0, 10, 0, 10, 0, 0, 0, -10, 0, -4, 4, 10, 0, 0, 0, 0], [-2, 0, 0, 0, -14, 12, 0, 0, 0, 0, 0, 0, -2, -2, 0, 0], [0, 0, 9, 0, 0, 0, 0, -9, 0, 2, 2, 0, 0, 0, 0, 5], [0, 0, 0, 0, -3, 3, 0, 0, -4, 0, 0, 0, -2, 2, -2, 0], [25, 0, 0, 0, -4, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, -3, 0, 1, 0, 0, 0, -1, 0, -1, 1, 1, 0, 0, 0, 0], [0, 0, -5, -5, 0, 0, 0, 0, 0, -2, -2, 0, 0, 0, 0, 0], [0, -6, 0, 6, 0, 0, 0, -6, 0, 0, 0, -6, 0, 0, 0, 0], [0, 0, 0, 0, 6, -6, 0, 0, 7, 0, 0, 0, 5, -5, 5, 0], [-7, 0, 0, 0, 6, -13, 0, 0, 0, 0, 0, 0, -7, -7, 0, 0], [0, 0, 0, 0, 2, -2, 0, 0, 6, 0, 0, 0, -2, 2, -2, 0], [0, 0, -7, -7, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0], [0, 5, 0, 5, 0, 0, 0, -5, 0, -2, 2, 5, 0, 0, 0, 0], [-30, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -2, 2, 12, 0, -5, 0, 0, 0, 5, -5, 1, 0], [0, 0, -9, 0, 0, 0, 0, 9, 0, -8, -8, 0, 0, 0, 0, 7], [0, 4, 0, 2, 0, 0, 0, -2, 0, 3, -3, -8, 0, 0, 0, 0], [12, 0, 0, 0, -7, 19, 0, 0, 0, 0, 0, 0, 12, 12, 0, 0], [0, 10, 0, 10, 0, 0, 0, -10, 0, -4, 4, 10, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, -1, 0, -6, -6, 0, 0, 0, 0, 13], [0, 0, 0, 0, 8, -8, 0, 0, 14, 0, 0, 0, 2, -2, 2, 0], [0, 0, -1, -1, 0, 0, 0, 0, 0, -19, -19, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 8, -8, 0, 0, 0, 0, 0], [0, 0, -2, -2, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0], [0, 0, 0, 0, 8, -8, 8, 0, 6, 0, 0, 0, -6, 6, 10, 0], [-1, 0, 0, 0, 2, -3, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0], [0, 0, 0, 0, 6, -6, 0, 0, 7, 0, 0, 0, 5, -5, 5, 0], [0, 0, -9, 0, 0, 0, 0, 9, 0, -1, -1, 0, 0, 0, 0, -7], [0, 0, 0, 0, -10, 10, 0, 0, -20, 0, 0, 0, 0, 0, 0, 0], [0, -7, 0, -7, 0, 0, 0, 7, 0, -3, 3, -7, 0, 0, 0, 0], [0, -8, 0, -2, 0, 0, 0, 2, 0, -5, 5, 12, 0, 0, 0, 0], [0, 0, -10, -10, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0], [0, 0, 0, 0, 3, -3, -12, 0, 6, 0, 0, 0, -6, 6, 0, 0], [0, -16, 0, 6, 0, 0, 0, -6, 0, -5, 5, 4, 0, 0, 0, 0], [0, -4, 0, -4, 0, 0, 0, 4, 0, 24, -24, -4, 0, 0, 0, 0], [13, 0, 0, 0, -4, 17, 0, 0, 0, 0, 0, 0, 13, 13, 0, 0], [0, 0, 10, 0, 0, 0, 0, -10, 0, 8, 8, 0, 0, 0, 0, -6]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_300_h_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_300_2_h_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_300_2_h_c(:prec:=16)
    chi := MakeCharacter_300_h();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 2));
    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_300_2_h_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_300_2_h_c( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_300_h();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<7,R![80, 0, -19, 0, 1]>,<17,R![40, 0, -59, 0, 1]>],Snew);
    return Vf;
end function;