
// Make newform 384.8.d.f in Magma, downloaded from the LMFDB on 25 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_384_d();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_384_d_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_384_8_d_f();".
// 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_384_8_d_f();".
// 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 := [694045717832241, 145766920335192, -133992602927280, -23130795757272, 10528455140834, 1222974198808, -372292484316, -29855519152, 6894477923, 375107560, -70542796, -2423904, 388150, 7280, -1020, -8, 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], [438410128070292095969494341404565987, 83465002594061287939057139087659737, -77618925586459457163196497895542714, -11533577293431612610490392806236207, 5372359677984236091027991873308753, 467691228244957961985655971961530, -146561701892964080189458897214159, -7927491346964761055691673639693, 1889292771523795393966981151761, 61343277355100737501914805508, -11892379406517208403126458561, -204617778707604913623295613, 33583203933541687597612640, 239888854334983695201521, -34269836333569099314503, 0], [-293366211155643283594238172862505493, -60936448911652775680700791139409912, 56343307116676940601556217148619497, 9063246148775483200094526147727766, -4225512036498698032686490437082824, -363190533130434306791225781808956, 114184377904161037175115604457471, 5845694116985413839553702072534, -1398196848758973044165306580262, -41909451942842914020646580492, 8140522056333629461729214083, 131273572328725732237340642, -21560694040110576600930635, -146877545235559433212064, 20982506462222776173152, 0], [-1024248724679494376525357457686370, -200517354778391630357793001519914, 185549475770957380251868034035572, 29486716645177721897719564571280, -13627065761450215395353305447140, -1321923276943159530465199201734, 411389167199635076485627640844, 24818000471924014588784101380, -5886536161218329947722991740, -210602217343409004837108510, 40748546324666364542426412, 745944476037600103434360, -122354865121492637527410, -908868100664944482300, 129838300094992068900, 0], [707776065535750198244338047745797963, 212626002347867816941692533503982766, -192045765659446616926301204285568825, -40522226878430993678585426936438600, 18674323307779877122151046047841582, 1879493159008657432444200747220584, -585580253992406550030974969764901, -34724242289813887349732787988540, 8247405804957411038365186850788, 287262506689734199008950989172, -55614288843428828587218917221, -999531537885292646846493464, 163980404013469367495911367, 1203777984959726297771174, -171968283565675185395882, 0], [-2364435722927396750515947948374250, -421218331296476251527011967772266, 389798797690735401603002779204236, 61897743741664984506716542273776, -28608780519117370220211943743012, -2771190329137813370388630706806, 862465326097768427211263171652, 51978751475380559368614210852, -12329136941103431037544129740, -440826063676194853991615982, 85294542243407771822327940, 1560876580066947792234648, -256026356507311894054986, -1901418540236648300364, 271631220033806900052, 0], [-47425406044636899588714338461824093483, -6994094798566295910167444793442449543, 6646559821688704583908202980756359996, 686818819604527189013895810349520389, -322884439041135690489373739285927151, -24342603601002564183102176801327694, 7637242616658742963225360801003195, 404873727269205539386800371294855, -96296935985426215780133423733155, -3260169800052026123160562217092, 631234435521194964463663014785, 11309690273726633908601342431, -1855360960449242922942511234, -13655731617782797765098079, 1950818802540399680728297, 0], [15319160472874119740353249368444168, 3082315608940257742903969947795648, -2854317063057881366507528924576280, -449273123072474614268055642264672, 207920039003489078625243060322368, 19798935401257686489005713071408, -6166702255477747600643850014520, -367346608834009476432517017120, 87165475207755251204927464272, 3094017334403033755281690960, -598729905133070611256854104, -10914719056372267277271072, 1790372807492203732051032, 13267862416849606535760, -1895408916692800933680, 0], [-17322573362898402393768693, 31572774322038579867674382, 9021572378882869427785557, -5367673608387633578036736, -952247409878019419133048, 345499499386881349610508, 34865055251715418683183, -9201692779747417702260, -563366720394684615654, 118051414980919048296, 4253795753695796979, -745352364059573184, -13983282337560003, 2113396887248082, 16233136513020, -2164418201736], [-120744506559704785377941525321767936, 221619118255719484869569329185878784, 58482206619774827361473588323979520, -35258155808869303450296213738076416, -5496353654994207955779342174195456, 2002573818478064577082223571103744, 193010421382250219122871211738624, -50942079575441658952299964733696, -3116396080349582912093833791744, 652192772543482186917606461952, 24025810148078008266116093952, -4206754010058192661924577536, -80500037132791244481327360, 12163454363279426686895360, 94785743174173913176320, -12638099089889855090176], [-200952113085663317405555667074414796721767417, 366057233801297824019694158637128574565735377, 104941594522436669809514507251356338286887598, -61373165537782977758804866492070100303908452, -12614426861036145223633891629310654364883916, 4514775628710923054731815231605963112309081, 522053102324005837631463761657032481272214, -136451459890237039806222679283034065153226, -9411605208167287810704600037463738103816, 1960429507580694260943824171716653666237, 78021019838811758262245236726273388714, -13639247669571815088715992156450228768, -272200767696433993550409554439063123, 41111362057772967871197640055839352, 328148196983057300282960048974110, -43753092931074306704394673196548], [4137366098244939007010737492335707004306863, -7332255030849851306379050650154523953483082, -2748589609909296019008687429777714031025295, 1571872174393143081699770354510802833460096, 382812386634323469289974336284605877981544, -137294510813194575936386122367624973758756, -15580343312470816227131016002987830213053, 4095999795876402115601480785199766347932, 263571154222098630208873730349271909650, -55166437236492005890183878175467262968, -2028104103303244305940417960002766665, 355262802472634902089304654131338432, 6717962904735056712861180134681721, -1015274170541986304931833251565974, -7825107442559059173907516450740, 1043347659007874556521002193432], [-931450212996633281305634904312671827886818905, 1663311117370848502266965993703927583657365768, 583694585741261585764859213179007436202342929, -339337626363136049440332502711159687489932100, -73111215644692375109202956550678763347762682, 26113489376458404107660912016803462012472426, 3077804685405844144317508035704491703346779, -803788847683649329189319782797705635331900, -55980599249247809408141732495198730653472, 11656778616779996927201102125384696996374, 466404889937307492577936110885696118331, -81526155399075522287194083070371919284, -1631392609692171922419497266780716321, 246387916471646809620189505094747774, 1969526546800065487138383538342140, -262603539573342064951784471778952], [-123841548050592412278687179601558790922972, 339233127060391603260843174731130920896980, -258463713354490573371006844876834115408112, 118920327072610798737757268476441895307960, 78111165554091984265704388094127990893448, -27329759905274481130126123282534632355396, -3846288827659767762616487550499260977928, 1001717516424306545396898416963678244512, 72013281100866174430802230945001988888, -15002511773705349245811178268620991316, -595702521068695209629959709928508824, 104169400925830444885776065895640696, 2062581038610003522873814754167524, -311556205106593268793217290386456, -2470266291240479717663892306960, 329368838832063962355185640928], [-2557713287069633135590383255134294864611310463, 4522088804857917473244844274301702061283885667, 1734957356630621186632539300922007851839598350, -1007784410509047345877670088474736718978521532, -218634891454833627379243400629014605240796812, 78228803352322723716340066657255259823972099, 9070335218582399164216001631128722572568174, -2371524524436584314796702183764305918527790, -162958238857159321705795713080602455033816, 33951875499334224243241065913835188825119, 1346274663809126943183155540031053929450, -235368958650387035803946117705670327408, -4687009037817170354768261878173757197, 707911053649538630873368121820032608, 5643111368912258511518840857816170, -752414849188301134869178781042156], [-11405920950905098829260298376318130184232101931, 19856646370666876756746282019740820662062455977, 8636884000752485576531117323273360123213288632, -5002400211231108056422389769112320416928193516, -1109510550018317184988018819239076314600686672, 396599977867456775514862493519220228226551333, 46408527172066447541128144991350034189128996, -12128866173106582388470992753183792931524786, -837514256507078351906257350222059841215880, 174463062673220393541375281780128705839009, 6937245238395903718392033431879908859800, -1212770635454265878842778242920219247848, -24184945932131296898039921830527383973, 3652765238230191209606564499598494532, 29141003316596969380038631855197990, -3885467108879595917338484247359732]];
    Rf_basisdens := [1, 50275082718458648024346446620434, 7182154674065521146335206660062, 11157364118610441194928194989, 8379180453076441337391074436739, 11157364118610441194928194989, 50275082718458648024346446620434, 11157364118610441194928194989, 344727506127634082750384, 80158786161353423569912111375001, 99437840909954898491691612050436927010812, 1235800952276403532076060868802589416912, 174016221592421072360460321088264622268921, 77237559517275220754753804300161838557, 174016221592421072360460321088264622268921, 348032443184842144720920642176529244537842];
    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_384_d();"
function MakeCharacter_384_d()
    N := 384;
    order := 2;
    char_gens := [127, 133, 257];
    v := [2, 1, 2];
    // 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_384_d_Hecke();"
function MakeCharacter_384_d_Hecke(Kf)
    N := 384;
    order := 2;
    char_gens := [127, 133, 257];
    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 := 8;
    raw_aps := [[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, -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, 47, 0, 0, -1, 0, 0, 0, 0], [0, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [4830, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -260, -4, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 1, 0, -2, -1], [0, 280, -6, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 0, 12, 0, 3, -4], [0, 121, 7, 0, 12, 0, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-58182, 0, 0, -15, 0, 20, 0, -15, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 2914, 203, 0, 30, 0, -5, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 0, 47, 0, -4, 13], [0, 744, 90, 0, 41, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1518, 515, 0, -54, 0, 30, 0, 0], [0, -2777, 73, 0, -54, 0, -9, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -746, 1067, 0, -270, 0, 10, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 762, 0, -204, 0, -6, 48], [-170450, 0, 0, 106, 0, 86, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2657, 0, 282, 0, -60, -22], [0, 0, 0, 0, 0, 0, 0, 0, 15671, 1368, 0, 455, 0, -30, 0, 0], [-2693322, 0, 0, 141, 0, -231, 0, -21, 0, 0, 0, 0, 0, 0, 0, 0], [2221070, 0, 0, -100, 0, -302, 0, -190, 0, 0, 0, 0, 0, 0, 0, 0], [0, 5333, 306, 0, -212, 0, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1469, 0, -768, 0, -459, -172], [0, 0, 0, 0, 0, 0, 0, 0, 38266, -915, 0, -1130, 0, -60, 0, 0], [0, -28790, 793, 0, 42, 0, -42, 0, 0, 0, 0, 0, 0, 0, 0, 0], [9517410, 0, 0, 1170, 0, -456, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -15739, 0, -702, 0, 339, -58], [0, 0, 0, 0, 0, 0, 0, 0, -451748, -9228, 0, 784, 0, 252, 0, 0], [-14281350, 0, 0, 888, 0, -1201, 0, -462, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 126274, -10336, 0, 2958, 0, 214, 0, 0], [0, -39897, 744, 0, 440, 0, -188, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11017, 0, 1308, 0, 1665, -8], [0, -48608, -485, 0, 1248, 0, 138, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -1138542, 426, 0, 1470, 0, -315, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -47502, 0, 6609, 0, -438, 351], [0, 71820, 2532, 0, -3017, 0, -7, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -563798, -8547, 0, 934, 0, 438, 0, 0], [0, 184973, 2045, 0, 1734, 0, 723, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65106, 0, 2841, 0, 1086, -1485], [-16886810, 0, 0, 1714, 0, -6154, 0, -3191, 0, 0, 0, 0, 0, 0, 0, 0], [0, -322196, -9798, 0, -841, 0, 169, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41439, 0, 8922, 0, -1827, -254], [0, 0, 0, 0, 0, 0, 0, 0, -1494126, 47064, 0, 7278, 0, 714, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -33919, 0, 17280, 0, -1050, 3220], [0, 0, 0, 0, 0, 0, 0, 0, -1983183, 60088, 0, -18135, 0, -4530, 0, 0], [0, 524923, 4393, 0, -1014, 0, -39, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-20426730, 0, 0, 645, 0, -15271, 0, -2055, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -68854, 0, -20749, 0, 1556, -2015], [-31254650, 0, 0, 5304, 0, -5334, 0, -2559, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 5888883, 44398, 0, 11331, 0, -4872, 0, 0], [-62421150, 0, 0, 14985, 0, -1049, 0, 675, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -123224, 0, -18140, 0, 10810, -3160], [0, 809707, -6582, 0, 3238, 0, -820, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92241, 0, -6264, 0, 2166, 2180], [0, 532601, -13711, 0, -1290, 0, -2985, 0, 0, 0, 0, 0, 0, 0, 0, 0], [246515814, 0, 0, 13269, 0, -9549, 0, 2721, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 12004572, 20703, 0, -24000, 0, 8100, 0, 0], [0, -24822, -21846, 0, -4197, 0, -1137, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -12886154, 161483, 0, -90990, 0, -12230, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 344536, 0, -32798, 0, -15026, -3478], [245380450, 0, 0, 13312, 0, -20080, 0, 11617, 0, 0, 0, 0, 0, 0, 0, 0], [0, 446373, -50022, 0, 7934, 0, 2314, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 17405478, 171156, 0, 84786, 0, -7584, 0, 0], [82673770, 0, 0, -35754, 0, 34626, 0, -669, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 25451381, -262986, 0, 5645, 0, -11130, 0, 0], [0, -777571, -11179, 0, -19344, 0, 2145, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-145388910, 0, 0, -24063, 0, 48193, 0, 2397, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 188674, 0, 73840, 0, -20168, 13532], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 288203, 0, -149778, 0, -15399, 6258], [0, -690314, -69959, 0, 11748, 0, 2868, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 22870072, 567833, 0, 30924, 0, 3223, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9794, 0, 18809, 0, 17732, 28651], [0, 384646, -102852, 0, 19095, 0, -951, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 3775254, -72153, 0, 10734, 0, 624, 0, 0, 0, 0, 0, 0, 0, 0, 0], [352771710, 0, 0, -21450, 0, 44485, 0, 20490, 0, 0, 0, 0, 0, 0, 0, 0], [183371546, 0, 0, -54940, 0, 117850, 0, -13690, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -21275199, -106664, 0, -142263, 0, -17514, 0, 0], [0, 902001, 137109, 0, 48744, 0, 2295, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -220988, 0, -92189, 0, -52106, 18113], [1051080830, 0, 0, 2342, 0, 65278, 0, 26912, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -505525, 0, 83574, 0, -38253, -22522], [0, 0, 0, 0, 0, 0, 0, 0, 39311265, -433688, 0, 79065, 0, 45690, 0, 0], [-205045458, 0, 0, -6093, 0, -9502, 0, 46233, 0, 0, 0, 0, 0, 0, 0, 0], [-1342173910, 0, 0, 29798, 0, 31396, 0, 69308, 0, 0, 0, 0, 0, 0, 0, 0], [0, -1225718, 196308, 0, 67413, 0, 2535, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 375289, 0, 19878, 0, 47499, -12038], [0, 0, 0, 0, 0, 0, 0, 0, -63730267, -363846, 0, 261725, 0, -2730, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1593470, 0, 161852, 0, 20816, -37796], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1168545, 0, -162390, 0, 22080, -27330], [0, 0, 0, 0, 0, 0, 0, 0, 55561120, -436890, 0, 183940, 0, -42150, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -60719860, 2012695, 0, -113520, 0, -4660, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46982, 0, -198430, 0, -68620, 43690], [0, -6099104, 99570, 0, -15457, 0, -4889, 0, 0, 0, 0, 0, 0, 0, 0, 0], [102213930, 0, 0, 111549, 0, 168356, 0, 18651, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 10923948, 1340310, 0, -184800, 0, 98535, 0, 0], [0, -2790733, -104905, 0, -128124, 0, -4563, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -71131022, 1379381, 0, 701550, 0, 65395, 0, 0], [0, -4429733, -203856, 0, 40584, 0, 14034, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -16900927, -2250024, 0, -376855, 0, -19680, 0, 0], [2799254922, 0, 0, -111639, 0, -49316, 0, -130971, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 55594652, 2510881, 0, -331776, 0, -18094, 0, 0], [970946890, 0, 0, 238062, 0, 156738, 0, 2337, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -53498624, -2008344, 0, 112180, 0, -110910, 0, 0], [-1669696830, 0, 0, 86076, 0, 78294, 0, -130554, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 157764, 0, 16215, 0, -46128, -136263], [1648422382, 0, 0, 246358, 0, -289978, 0, 31207, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1058775, 0, -327552, 0, -187851, 15192], [0, 7846, -3131, 0, 153030, 0, -30540, 0, 0, 0, 0, 0, 0, 0, 0, 0], [880530870, 0, 0, -221838, 0, -191926, 0, -100788, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -70486300, 3792544, 0, 97800, 0, -106036, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2521315, 0, 284040, 0, -123420, -4960], [-4171399458, 0, 0, 146190, 0, 11795, 0, -105000, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 50529082, 4703270, 0, -348330, 0, -74405, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -7411464, 0, 288219, 0, 85692, -80019], [0, -11289152, -78216, 0, -59557, 0, -73307, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 120539848, -2603064, 0, 109276, 0, 24426, 0, 0], [0, 2827616, -533107, 0, 141120, 0, -31626, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-1116929650, 0, 0, 91262, 0, -138158, 0, -118348, 0, 0, 0, 0, 0, 0, 0, 0], [0, 10853081, 740844, 0, 206570, 0, 29470, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -90871773, -2348666, 0, -1238445, 0, 127050, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -1207722, 6399120, 0, -404334, 0, 150945, 0, 0], [0, 6413563, 536838, 0, 253346, 0, 7816, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 35348273, 2693, 0, -197964, 0, 29691, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2193122, 0, 902854, 0, 112876, 3362], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -640299, 0, 636960, 0, 203355, 213820], [0, -33138795, 585651, 0, 155964, 0, 67479, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 336037364, 5320861, 0, -1009992, 0, 75926, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3618778, 0, -502939, 0, -9682, 312859], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2365531, 0, -836958, 0, 81564, 57442], [0, 5855913, 768657, 0, 45510, 0, 64155, 0, 0, 0, 0, 0, 0, 0, 0, 0], [8677314810, 0, 0, 457719, 0, -241464, 0, -18579, 0, 0, 0, 0, 0, 0, 0, 0], [6039555334, 0, 0, 561628, 0, 50672, 0, -57893, 0, 0, 0, 0, 0, 0, 0, 0], [0, -2846843, -964170, 0, -578252, 0, -19552, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 271916928, 4247697, 0, 382020, 0, -136005, 0, 0], [0, 16480051, 1523340, 0, -77506, 0, -87746, 0, 0, 0, 0, 0, 0, 0, 0, 0], [5554736058, 0, 0, -576579, 0, 166154, 0, -194871, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -517057756, 4064515, 0, 341688, 0, 91025, 0, 0], [0, 15400221, -1652406, 0, 480294, 0, 42900, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16001915, 0, -118722, 0, 372894, -144038], [0, 0, 0, 0, 0, 0, 0, 0, -7421238, -3048433, 0, -3338010, 0, -266580, 0, 0], [0, -63158340, 9549, 0, 648906, 0, -12876, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4281406, 0, 867856, 0, -571454, -49180], [0, 33125930, 1355213, 0, -8388, 0, -104868, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1870884810, 0, 0, -738414, 0, -9621, 0, 16416, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -229784654, -3329050, 0, -817458, 0, 276565, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2023462, 0, 1301887, 0, 586366, 154613], [0, 25589059, 2092717, 0, -223116, 0, -117381, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-14830915086, 0, 0, -676005, 0, -208695, 0, 44625, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -92543482, -2559725, 0, 3738450, 0, -54895, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21113004, 0, 50322, 0, 503346, 43098], [0, 0, 0, 0, 0, 0, 0, 0, -650216962, -9274526, 0, -3194070, 0, 132845, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -15104206, 0, 952643, 0, -2254, 308473], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -6054895, 0, -2833692, 0, -435666, -259284], [-10260261522, 0, 0, -1005531, 0, 1698186, 0, -336129, 0, 0, 0, 0, 0, 0, 0, 0], [-5359859290, 0, 0, -78340, 0, 641980, 0, 218180, 0, 0, 0, 0, 0, 0, 0, 0], [0, 3557454, -1614336, 0, -254077, 0, -171197, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 104847778, -1678533, 0, -3230930, 0, -213450, 0, 0], [9669726330, 0, 0, -397575, 0, -643736, 0, 827055, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -13890909, 0, 2049720, 0, 692010, 250520], [0, 0, 0, 0, 0, 0, 0, 0, -826793185, 6277842, 0, -2121985, 0, 407022, 0, 0], [-17579474850, 0, 0, 498627, 0, 553348, 0, 729297, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -17722052, 0, -2509406, 0, -1013258, 225866], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -34479309, 0, -516186, 0, 9210, -190034], [0, -35881779, 1260519, 0, 509130, 0, -51075, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_384_d_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_384_8_d_f();".
// 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_384_8_d_f(:prec:=16)
    chi := MakeCharacter_384_d();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 8));
    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_384_8_d_f();".
// 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_384_8_d_f( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_384_d();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,8,sign)));
    Vf := Kernel([<5,R![10720051644418560000, 0, 1180874777241600, 0, 36963868032, 0, 371616, 0, 1]>,<7,R![109960973310053162225664, 0, -1674896085793253376, 0, 4197967850880, 0, -3584928, 0, 1]>],Snew);
    return Vf;
end function;