
// Make newform 350.3.p.e in Magma, downloaded from the LMFDB on 23 May 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_350_p();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_350_p_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_350_3_p_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_350_3_p_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
        poly := [52200625, 35619250, 12152450, 30978760, 5294974, -9824090, 1256080, -1157418, 505731, 9306, -1232, 1354, -722, -8, 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], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [16131851874618698849402252170625, -2059924902647812467719473390967335, 21659756358292301007691031822350, 18292783796974806076034840071705, 14799051950445618633715497758597, 2946655779377462211803764143034, -1690887020419157587356791100121, -451173846124980473763815413643, -15059614509460219422690365053, -3095699288454478168229361002, 2515283632939546052219608017, 614153690444980767551365427, 15815240499760836492477870, -612397394907637671636521, -3440650327560267812761723, -862494599643708284748442], [-3012473571919452709325424818536875, -2552132553353869568082349812217000, -1216595254054642303499752418156175, 3545725530285645795576767246052133, -841801645847767451015789547751136, 314231718301695461363230218254629, -144261271630818080660278771610565, 21068217734679753729509885699116, 855979318704425995913726758192, -368625416799380699849763866221, 191738693780153768866150717693, -31015319379659893778236101788, -997972837290611333406626323, 550588028016692603273130525, -274197034952564949502637260, 48284897343923478451826109], [496562351338243013483824641921250, 515283067484605008401432065937625, -5333495232101198096215736556314173, 536231181145464898314405570967190, 252711905326530755605566854683481, 71773484286957999308197649860245, 45725831889512851549105352003906, -30041477998086075892631561437441, -168419476059324093684459207953, -120640551935975356483369412365, -47123385212075147103489456178, 42664254015453609499289826361, -88911782275274341047277893, 158777973517210383946174102, 67134164091431087104637049, -57709530717677282778231579], [-4596148276260545618445919722295, 231400626257639801881564064500, 112692690497316161593333337675, 170044354068864519976607788165, 77322780350685841533067813516, -26869173984895414565509647019, -1239105636946241670087194059, -2214826264032806750880946304, -77178575132263546583267100, 39767259403530036259269571, 2546284112850209515590755, 3088366057417254991472784, 86007176562427545930465, -52458527810619441211031, -3182562623881413159704, -3871538909811102121571], [-2458584319426860395947331375, 3225054764684354213462497500, 1537224346945204748211057125, -2705830345908411710629245337, 1063696712452943988309904580, -397188258514360946650231965, 182342269095781020887247119, -26603966749083446880707248, -1081703305805241867740468, 465818175789860246328341, -243558780920408122976067, 39175625051260143363616, 1306267863389195707389, -695600958588086418401, 348273552486628687656, -57017257518074526033], [-3865384499781613729770660750, 2074203721533548543654895000, 997756267065488830526554250, -1027064897260226131267145966, 687918658855305254119001960, -249272419483619829646063050, 63342854747689318244613222, -18270940584100285446886144, -694052238387051009969224, 314570778668894537924903, -80703685529845007152806, 26248386383781978835168, 835811060116455863642, -457044282306385985138, 117140054935956660528, -37801694790096319934], [400499617317685222537364398500, 161298420684480365812101245150, 107683922937366289360949469610, 91800357203753908744920661628, -83022285858362199872046685230, 13290077377731388710576909630, -8837972912348684327929264636, 3124143794557463445623238442, 85311718963111191220047887, -14614185268784553049596414, 10753369081504928392496668, -4473320169545831132143114, -89201828922976103812106, 22545170901289639913724, -15801410288891510963234, 6294133115866661884422], [-1201364370265678547535123483055409375, -1017803577589478877817594243160615000, -485201608525305932833207407699327875, 1313796586793895736238140874359755519, -335722001041151728460173766051235120, 125305545119081695342124960529685145, -57527193327409837948441119750584993, 8404306504754927292115660950902316, 341365835991293097545701180100416, -147010040878419811574376013676737, 76322870959476580458380502804329, -12371057571170622827518477962332, -392870640739432436163089508263, 219595601419720089886207744097, -109149268954593274587754533932, 19326926152818140640879786791], [-6771894927398102079597324159924750, -2011938038690221018780435622687025, -6165377273724567436340224013324745, -626998238186508896896699178867778, 2194605272206321535152678900741233, -321809212183631587301422639565433, 266967398649470784880565120765250, -125893216702415301884590121815299, -1962545337333077401289285304633, 327471877090434603830953269633, -307910883275939523564817811634, 179111331391902693204052377679, 1516657886009557039470538659, -523213996930379801625142050, 460381640379042084324177297, -247583276876065552758939669], [3180327085395363953479889674196037375, -1626757938541879521934097187772147500, -781763287121026158675371777897997125, 866283566101783008251118493612558619, -539204521901343697278631588902927380, 196014950924926934675923134035818485, -54276145009687444597499445801703083, 14232766589526185114498837332759456, 544469247430453645523767111914116, -250918886448343671254268158585857, 69627380519142473820768410982579, -20498334325331207208491192067472, -661111719678122074567135544333, 357644893748238754795997063657, -100781510513925329337917638392, 29554206938890032711255408611], [-6034660826374762188699681170003750, -6261417033161455593782879730894875, 50668038909645208960191572060467793, -6518115266991500700980564063070210, -3071479335898427216995459682978219, -873284445820287448343763566481807, -556357101955941175508707798083910, 365286849804376012830381785931283, 2048406354820218497814843776339, 1488258632519691251415358161751, 573332554420063878252309609494, -519542976710888666928980142491, 1077667249332740840389131695, -1960667723569868232102760066, -844061391599975022904193897, 701715431771775370358134561], [-2570022412628318769748322917975760875, 3395977753240105124700872463402915000, 1621926048084182607440934759156185375, -2829582039717066205133436536971831469, 1121422011435863667630721578490033520, -416040707805428423284924323995995245, 172657105193119416348921697184957393, -28426648819267954976667362823554716, -1138445676457235659715887900097216, 499077460796602224841079105422437, -229460009376621240567945099604029, 41626158803659096450699891323532, 1366641316235001004521431252813, -735904394652655597567396160597, 328731615020660701568149291932, -61136390836337126068630311441], [-2641789433922757995207516343276209250, -815283830903597723108404540876000325, -2377240728059053765341900195632621185, -283279383057343319281781219220632494, 822840852150934353411349109928939005, -117146704260433009929193086589492345, 99366013586033631538297551242688678, -46081905320204413169519394515228121, -741199752786850876757226034009941, 118284046550187392935096454182337, -114974887505722935306414756349654, 65795346930890489865348010837557, 592097808137683715586960887963, -189592229199143773802850493142, 171681869123970340493068639277, -90730326074132155643421954391], [161661714324708729105645266461033375, 312978595541947205441189921884525825, 209323223507533819682920848465618230, 177774154058123543829241486807186879, -149457729136102328804018957494554765, 26202043665043457107458227694934090, -17254638036794169796342168238191973, 6122689660803346428893179647851031, 149943465700085469610389892613841, -28765169764682031565040964952602, 20982719511874411093152366507949, -8773387745949894290419361233727, -150452109450351656804555883458, 44786687826506741989778739907, -30836838282186611254391204287, 12347582658986303151116845246]];
    Rf_basisdens := [1, 1, 465534203775105056795796346464700, 7914081464176785965528537889899900, 7914081464176785965528537889899900, 497897544144497386947375771620, 6265583749792207043011484500, 3724925711313597470017592675, 316618685461655784951495377375, 672696924455026807069925720641491500, 7914081464176785965528537889899900, 672696924455026807069925720641491500, 7914081464176785965528537889899900, 672696924455026807069925720641491500, 672696924455026807069925720641491500, 61154265859547891551811429149226500];
    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_350_p();"
function MakeCharacter_350_p()
    N := 350;
    order := 12;
    char_gens := [127, 101];
    v := [9, 4];
    // 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_350_p_Hecke();"
function MakeCharacter_350_p_Hecke(Kf)
    N := 350;
    order := 12;
    char_gens := [127, 101];
    char_values := [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-1, 0, 0, 0, 0, 0, 0, 0, 1, 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 := 3;
    raw_aps := [[1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 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, 0], [0, 0, 0, 1, 2, 0, 0, 0, -2, -1, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 1, 0, 0, 5, 0, 0, -1, 0, 0, 1, -1], [-1, 0, 0, 0, 0, -1, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0], [0, 0, 0, 0, 5, -1, 0, 0, -5, 0, -3, 0, 1, 0, 3, 1], [0, 3, 0, -3, -3, 0, -3, 0, 0, 0, 3, 0, -3, 3, 0, 0], [-7, 1, 4, 0, 7, 0, 7, 0, 7, 0, 0, 0, -3, 3, 0, 3], [0, 0, 0, -3, 0, 0, 18, 3, 0, 1, 0, 1, 0, 1, 0, 0], [0, 2, 2, 0, 0, -1, 0, -2, -25, 0, -2, -2, 0, 0, 2, 1], [6, 0, 0, -5, 6, 0, 6, 0, -6, -3, 5, 0, -2, 2, 3, -2], [-8, 0, 0, 7, 0, 5, 0, 7, 0, -3, 0, 3, 0, 0, 0, 0], [-12, 0, 0, 0, 0, 0, 12, 12, 0, 0, 0, 1, 0, 0, 0, 0], [-5, 0, 0, -3, -5, 0, -5, 0, 5, 3, 3, 0, -1, 1, -3, -1], [0, -1, -5, 0, -4, -1, 0, 1, -4, 0, 0, 5, -1, 0, 0, 1], [0, 5, -4, 0, -29, 0, 0, -5, 0, 0, 5, 4, 7, 0, 4, 0], [-19, 8, 2, 8, 0, 0, 0, 0, 19, -2, -8, 0, 0, 0, 2, 6], [0, 0, 0, 0, -13, -3, 0, 0, 13, 0, -15, 0, 3, 0, 4, 3], [0, 0, 0, 2, 0, -8, 0, 2, 0, 7, 0, -7, 0, 0, 0, 0], [0, 13, 1, 0, 10, 2, 0, -13, 10, 0, 0, -1, 2, 0, 0, -2], [0, -5, -2, 5, 27, 0, 27, 0, 0, -2, -5, 0, -1, 1, 2, 0], [0, 0, 0, 0, 0, -8, 0, -16, 0, 0, 0, -15, 0, -8, 0, 0], [0, -15, -11, 15, 7, 0, 7, 0, 0, -11, -15, 0, 8, -8, 11, 0], [-13, 0, 0, 18, 0, -2, -13, 0, 0, -18, 0, 0, 0, 2, 0, 0], [0, -10, -8, 0, 0, -2, 0, 10, -53, 0, 10, 8, 0, 0, -8, 2], [51, 9, 10, 0, -51, 0, -51, 0, -51, 0, 0, 0, -5, 5, 0, 5], [50, 0, 0, -11, 50, 0, 50, 0, -50, 8, 11, 0, -2, 2, -8, -2], [0, 5, 3, 0, 1, 0, 0, -5, 0, 0, 5, -3, 16, 0, -3, 0], [-37, 0, 0, 0, 0, 8, 37, 14, 0, 0, 0, -2, 0, 8, 0, 0], [57, 0, 0, 0, 0, 1, 57, 0, 0, -12, 0, 0, 0, -1, 0, 0], [-91, 6, 6, 6, 0, 0, 0, 0, 91, -6, -6, 0, 0, 0, 6, 5], [0, 0, 0, 0, -5, 1, 0, 0, 5, 0, -11, 0, -1, 0, 7, -1], [0, 0, 0, 6, 0, 0, -66, -6, 0, 11, 0, 11, 0, -10, 0, 0], [0, 19, 9, -19, 109, 0, 109, 0, 0, 9, 19, 0, -20, 20, -9, 0], [0, 8, -4, 0, 0, 7, 0, -8, -5, 0, -8, 4, 0, 0, -4, -7], [0, 0, 0, 0, -37, -10, 0, 0, 37, 0, 5, 0, 10, 0, -9, 10], [-30, -3, 5, 0, 30, 0, 30, 0, 30, 0, 0, 0, 14, -14, 0, -14], [-14, 0, 0, 10, 0, -4, -14, 0, 0, 25, 0, 0, 0, 4, 0, 0], [-145, -9, -1, 0, 145, 0, 145, 0, 145, 0, 0, 0, 13, -13, 0, -13], [0, 15, 11, 0, 95, 0, 0, -15, 0, 0, 15, -11, -13, 0, -11, 0], [154, 0, 0, 9, 0, -17, 0, 9, 0, 5, 0, -5, 0, 0, 0, 0], [-3, -22, -3, -22, 0, 0, 0, 0, 3, 3, 22, 0, 0, 0, -3, 21], [0, 21, -3, 0, 32, -5, 0, -21, 32, 0, 0, 3, -5, 0, 0, 5], [33, 0, 0, 10, 0, 16, 33, 0, 0, 2, 0, 0, 0, -16, 0, 0], [0, 9, -19, 0, -33, 0, 0, -9, 0, 0, 9, 19, 19, 0, 19, 0], [-60, 0, 0, -22, 0, 12, 0, -22, 0, 1, 0, -1, 0, 0, 0, 0], [149, 0, 0, 0, 0, 1, -149, -8, 0, 0, 0, 6, 0, 1, 0, 0], [0, 0, 0, 0, -4, 16, 0, 0, 4, 0, 79, 0, -16, 0, 9, -16], [0, 6, 22, -6, 85, 0, 85, 0, 0, 22, 6, 0, 13, -13, -22, 0], [-49, 49, -27, 0, 49, 0, 49, 0, 49, 0, 0, 0, -3, 3, 0, 3], [0, 0, 0, 2, 0, 0, 82, -2, 0, 26, 0, 26, 0, 10, 0, 0], [0, -35, -11, 0, 0, 13, 0, 35, 5, 0, 35, 11, 0, 0, -11, -13], [160, 0, 0, 24, 0, 4, 0, 24, 0, 8, 0, -8, 0, 0, 0, 0], [66, 0, 0, -63, 66, 0, 66, 0, -66, 39, 63, 0, -22, 22, -39, -22], [0, -79, -40, 0, -92, 18, 0, 79, -92, 0, 0, 40, 18, 0, 0, -18], [0, -25, 5, 0, -305, 0, 0, 25, 0, 0, -25, -5, 0, 0, -5, 0], [219, 4, 21, 4, 0, 0, 0, 0, -219, -21, -4, 0, 0, 0, 21, -5], [0, 0, 0, 0, 63, 37, 0, 0, -63, 0, 11, 0, -37, 0, -43, -37], [-116, 0, 0, -36, 0, -4, 0, -36, 0, -8, 0, 8, 0, 0, 0, 0], [0, 31, 39, 0, 123, 7, 0, -31, 123, 0, 0, -39, 7, 0, 0, -7], [167, 0, 0, 0, 0, -9, -167, 46, 0, 0, 0, 6, 0, -9, 0, 0], [92, 0, 0, 52, 0, 52, 92, 0, 0, -37, 0, 0, 0, -52, 0, 0], [0, -52, -31, 0, 0, 27, 0, 52, -161, 0, 52, 31, 0, 0, -31, -27], [-21, 7, 31, 0, 21, 0, 21, 0, 21, 0, 0, 0, -31, 31, 0, 31], [-54, 0, 0, -17, -54, 0, -54, 0, 54, 5, 17, 0, -2, 2, -5, -2], [-71, -30, -10, -30, 0, 0, 0, 0, 71, 10, 30, 0, 0, 0, -10, -31], [39, 0, 0, 2, 0, -32, 39, 0, 0, -14, 0, 0, 0, 32, 0, 0], [0, 0, 0, 0, 141, -45, 0, 0, -141, 0, -31, 0, 45, 0, -4, 45], [0, 0, 0, -15, 0, 0, -174, 15, 0, 1, 0, 1, 0, -13, 0, 0], [0, -71, -27, 0, -190, 5, 0, 71, -190, 0, 0, 27, 5, 0, 0, -5], [0, -57, -17, 57, -93, 0, -93, 0, 0, -17, -57, 0, 63, -63, 17, 0], [0, 0, 0, 0, -31, -11, 0, 0, 31, 0, 5, 0, 11, 0, 14, 11], [63, 111, 31, 0, -63, 0, -63, 0, -63, 0, 0, 0, -11, 11, 0, 11], [0, 0, 0, -46, 0, 0, -8, 46, 0, -13, 0, -13, 0, 4, 0, 0], [-81, -53, -26, 0, 81, 0, 81, 0, 81, 0, 0, 0, -5, 5, 0, 5], [0, 28, 68, 0, -79, 0, 0, -28, 0, 0, 28, -68, -23, 0, -68, 0], [-52, 0, 0, 119, -52, 0, -52, 0, 52, -39, -119, 0, 1, -1, 39, 1], [-205, 2, -66, 2, 0, 0, 0, 0, 205, 66, -2, 0, 0, 0, -66, -12], [0, -5, 23, 0, 81, 0, 0, 5, 0, 0, -5, -23, 28, 0, -23, 0], [0, 0, 0, 60, 0, 0, -52, -60, 0, -32, 0, -32, 0, -12, 0, 0], [64, 0, 0, -13, 0, 31, 0, -13, 0, -21, 0, 21, 0, 0, 0, 0], [0, -36, -13, 0, 0, 81, 0, 36, 73, 0, 36, 13, 0, 0, -13, -81], [-157, 0, 0, 0, 0, -24, 157, -90, 0, 0, 0, 14, 0, -24, 0, 0], [0, 67, 35, -67, 27, 0, 27, 0, 0, 35, 67, 0, -29, 29, -35, 0], [-3, -1, 6, 0, 3, 0, 3, 0, 3, 0, 0, 0, -13, 13, 0, 13], [0, 0, 0, -23, 0, 0, 114, 23, 0, -1, 0, -1, 0, 49, 0, 0], [106, 0, 0, 7, 106, 0, 106, 0, -106, -55, -7, 0, 46, -46, 55, 46], [-56, 0, 0, 28, 0, 16, 0, 28, 0, 20, 0, -20, 0, 0, 0, 0], [174, 0, 0, 0, 0, 48, -174, 108, 0, 0, 0, 25, 0, 48, 0, 0], [-96, 0, 0, -5, -96, 0, -96, 0, 96, 74, 5, 0, -44, 44, -74, -44], [0, 45, 5, 0, -247, 0, 0, -45, 0, 0, 45, -5, -19, 0, -5, 0], [0, 0, 0, 0, -286, 50, 0, 0, 286, 0, 25, 0, -50, 0, -17, -50], [-220, 0, 0, 96, 0, 4, 0, 96, 0, -4, 0, 4, 0, 0, 0, 0], [0, -77, -40, 77, -133, 0, -133, 0, 0, -40, -77, 0, -5, 5, 40, 0], [238, 0, 0, 0, 0, 36, -238, 28, 0, 0, 0, 43, 0, 36, 0, 0], [0, -47, 27, 47, -71, 0, -71, 0, 0, 27, -47, 0, 22, -22, -27, 0], [0, -29, 47, 0, 0, -51, 0, 29, 85, 0, 29, -47, 0, 0, 47, 51], [-114, -21, 3, 0, 114, 0, 114, 0, 114, 0, 0, 0, 34, -34, 0, -34], [179, 56, 66, 56, 0, 0, 0, 0, -179, -66, -56, 0, 0, 0, 66, -10], [116, 0, 0, -66, 0, -32, 116, 0, 0, 57, 0, 0, 0, 32, 0, 0], [0, 0, 0, 0, 175, -50, 0, 0, -175, 0, -89, 0, 50, 0, 97, 50], [0, 153, -34, 0, -170, 18, 0, -153, -170, 0, 0, 34, 18, 0, 0, -18], [0, -20, -56, 20, 83, 0, 83, 0, 0, -56, -20, 0, -45, 45, 56, 0], [0, 56, 25, 0, 0, 25, 0, -56, 113, 0, -56, -25, 0, 0, 25, -25], [0, 0, 0, 0, 61, 58, 0, 0, -61, 0, -51, 0, -58, 0, 35, -58], [317, 0, 0, -52, 0, -19, 317, 0, 0, 0, 0, 0, 0, 19, 0, 0], [-155, 63, 15, 0, 155, 0, 155, 0, 155, 0, 0, 0, -28, 28, 0, 28], [0, -55, -3, 0, 217, 0, 0, 55, 0, 0, -55, 3, 57, 0, 3, 0], [-420, 0, 0, -2, 0, -4, 0, -2, 0, 58, 0, -58, 0, 0, 0, 0], [-54, 0, 0, -59, -54, 0, -54, 0, 54, 6, 59, 0, -32, 32, -6, -32], [0, -21, 87, 0, 56, -16, 0, 21, 56, 0, 0, -87, -16, 0, 0, 16], [-171, 0, 0, 200, 0, 9, -171, 0, 0, -36, 0, 0, 0, -9, 0, 0], [0, 23, -60, 0, 447, 0, 0, -23, 0, 0, 23, 60, -21, 0, 60, 0], [468, 0, 0, -90, 0, -44, 0, -90, 0, 65, 0, -65, 0, 0, 0, 0], [0, -34, -50, 0, 0, 52, 0, 34, -703, 0, 34, 50, 0, 0, -50, -52], [-189, 0, 0, 0, 0, 7, 189, -16, 0, 0, 0, 28, 0, 7, 0, 0], [0, 0, 0, 0, 353, 45, 0, 0, -353, 0, 145, 0, -45, 0, -6, -45], [-247, -21, -5, 0, 247, 0, 247, 0, 247, 0, 0, 0, 71, -71, 0, -71], [0, 0, 0, -36, 0, 0, -554, 36, 0, 43, 0, 43, 0, 58, 0, 0], [0, 18, 4, 0, 0, 50, 0, -18, 457, 0, -18, -4, 0, 0, 4, -50], [-249, 0, 0, 0, 0, -33, 249, -68, 0, 0, 0, -40, 0, -33, 0, 0], [22, 0, 0, 65, 22, 0, 22, 0, -22, -17, -65, 0, 46, -46, 17, 46], [0, -149, -116, 0, -86, 22, 0, 149, -86, 0, 0, 116, 22, 0, 0, -22], [-89, 70, 17, 70, 0, 0, 0, 0, 89, -17, -70, 0, 0, 0, 17, 71], [-450, 0, 0, -99, 0, -129, 0, -99, 0, 49, 0, -49, 0, 0, 0, 0], [0, 95, 93, -95, -273, 0, -273, 0, 0, 93, 95, 0, 60, -60, -93, 0], [0, 9, -6, -9, -237, 0, -237, 0, 0, -6, 9, 0, 27, -27, 6, 0], [-16, 0, 0, -128, 0, -114, -16, 0, 0, 189, 0, 0, 0, 114, 0, 0], [611, 57, 17, 0, -611, 0, -611, 0, -611, 0, 0, 0, -40, 40, 0, 40], [0, -149, 18, 0, -427, 0, 0, 149, 0, 0, -149, -18, 45, 0, -18, 0], [-238, 0, 0, 0, 0, 32, 238, 56, 0, 0, 0, 83, 0, 32, 0, 0], [-337, -60, -60, -60, 0, 0, 0, 0, 337, 60, 60, 0, 0, 0, -60, -29], [-119, 0, 0, 0, 0, -59, -119, 0, 0, 92, 0, 0, 0, 59, 0, 0], [-373, 113, -15, 113, 0, 0, 0, 0, 373, 15, -113, 0, 0, 0, -15, 73], [0, 0, 0, -130, 0, 0, 614, 130, 0, 78, 0, 78, 0, 74, 0, 0], [0, 27, 59, 0, -382, 14, 0, -27, -382, 0, 0, -59, 14, 0, 0, -14], [0, 0, 0, 0, 403, 33, 0, 0, -403, 0, 141, 0, -33, 0, -114, -33], [139, 0, 0, 252, 0, 27, 139, 0, 0, 0, 0, 0, 0, -27, 0, 0], [0, 9, 65, 0, 83, 0, 0, -9, 0, 0, 9, -65, -102, 0, -65, 0], [-582, 0, 0, 210, 0, 126, 0, 210, 0, -130, 0, 130, 0, 0, 0, 0], [555, -41, 31, -41, 0, 0, 0, 0, -555, -31, 41, 0, 0, 0, 31, -21], [0, -103, 46, 0, -234, -8, 0, 103, -234, 0, 0, -46, -8, 0, 0, 8], [-252, 0, 0, -72, 0, 8, -252, 0, 0, 43, 0, 0, 0, -8, 0, 0], [0, -58, 26, 0, 393, 0, 0, 58, 0, 0, -58, -26, 33, 0, -26, 0], [0, 0, 0, 6, 0, 0, 86, -6, 0, 33, 0, 33, 0, 22, 0, 0], [-299, 0, 0, 0, 0, -64, 299, 10, 0, 0, 0, -206, 0, -64, 0, 0], [0, 0, 0, 0, 19, -58, 0, 0, -19, 0, -123, 0, 58, 0, 151, 58], [0, -167, -31, 167, -457, 0, -457, 0, 0, -31, -167, 0, 11, -11, 31, 0], [85, 157, 110, 0, -85, 0, -85, 0, -85, 0, 0, 0, -23, 23, 0, 23], [-326, 0, 0, -133, -326, 0, -326, 0, 326, 85, 133, 0, -87, 87, -85, -87], [294, 0, 0, 63, 0, 65, 0, 63, 0, -43, 0, 43, 0, 0, 0, 0], [441, 0, 0, 0, 0, 41, -441, -16, 0, 0, 0, 52, 0, 41, 0, 0], [-268, 0, 0, 121, -268, 0, -268, 0, 268, -60, -121, 0, 86, -86, 60, 86], [0, 0, 0, 0, -245, -15, 0, 0, 245, 0, 65, 0, 15, 0, -50, 15], [40, 0, 0, 44, 0, 4, 0, 44, 0, -93, 0, 93, 0, 0, 0, 0], [0, 21, -50, -21, -511, 0, -511, 0, 0, -50, 21, 0, -71, 71, 50, 0], [0, -5, 43, 5, 423, 0, 423, 0, 0, 43, -5, 0, -76, 76, -43, 0], [-453, 0, 0, 46, 0, 27, -453, 0, 0, -46, 0, 0, 0, -27, 0, 0], [0, -57, -9, 0, 0, -63, 0, 57, 17, 0, 57, 9, 0, 0, -9, 63], [-234, 0, 0, 43, -234, 0, -234, 0, 234, -150, -43, 0, 98, -98, 150, 98], [-29, 0, 0, 0, 0, -5, 29, -132, 0, 0, 0, -64, 0, -5, 0, 0], [134, 0, 0, 152, 0, 20, 134, 0, 0, -129, 0, 0, 0, -20, 0, 0], [-367, -112, -28, -112, 0, 0, 0, 0, 367, 28, 112, 0, 0, 0, -28, -171], [0, 0, 0, 0, -263, 100, 0, 0, 263, 0, -49, 0, -100, 0, -31, -100], [0, -129, -80, 0, 362, -76, 0, 129, 362, 0, 0, 80, -76, 0, 0, 76], [0, 62, -86, 0, 0, 57, 0, -62, 633, 0, -62, 86, 0, 0, -86, -57], [0, 0, 0, 0, -249, 28, 0, 0, 249, 0, 213, 0, -28, 0, 39, -28]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_350_p_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_350_3_p_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_350_3_p_e(:prec:=16)
    chi := MakeCharacter_350_p();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 3));
    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_350_3_p_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_350_3_p_e( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_350_p();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,3,sign)));
    Vf := Kernel([<3,R![52200625, -35619250, 12152450, -30978760, 5294974, 9824090, 1256080, 1157418, 505731, -9306, -1232, -1354, -722, 8, 2, 2, 1]>,<11,R![6604900, -7339920, 7804646, -494072, 78459, -2972, 537, -20, 1]>],Snew);
    return Vf;
end function;