
// Make newform 16.34.a.b in Magma, downloaded from the LMFDB on 25 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_16_a();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_16_34_a_b();".
// 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_16_34_a_b();".
// 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 := [-589050, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0], [-576, 1152]];
    Rf_basisdens := [1, 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_16_a();"
function MakeCharacter_16_a()
    N := 16;
    order := 1;
    char_gens := [15, 5];
    v := [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;

function MakeCharacter_16_a_Hecke(Kf)
    return MakeCharacter_16_a();
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 := 34;
    raw_aps := [[0, 0], [-18959940, -39], [-90530768250, -125500], [33576540033400, -100199358], [-66935907720957132, 168326472875], [-1490805239129721970, -467324482716], [-39680574630587762670, -332761335850632], [680348221520848585900, -610587893846115], [-13081927026837315789720, -20578649420360954], [-837259985815199964554850, -760643170023021740], [3119150612861816168547808, -4114562133058947000], [-52401370758379090049086810, 25166008023558787188], [138783306511001091366094122, -404532917839421938000], [-783830594683536056884145900, -1111995787958250537069], [-2710530730715625630238486320, -617547792676262829748], [-13433707392771451546487585610, 25572678370712527987764], [152893204817649216513331997700, -39163498683100366185545], [-2872946991706632429533681218, -7980892993078523797500], [-799453168612247670875104782980, -354551257844548152351543], [1334880968978052357868405042488, -2367576826345969291488750], [473157160595999435482583268170, -7398595559123311074126696], [4267599986382818234865053095600, 1483115134049794090453140], [-14536302901873972722201991661460, -30354745617975039280526899], [66359733827802158132469298863450, -4753182634333283733308520], [-183893665465267863575419938928030, 664924884201009777225705048], [340126539554326484284435470019302, -1748430786044967285953139500], [1049548346669976180437693243835160, 728640591345022038935599386], [215966578526803593993330894374100, -1044033577266653078295510333], [2487966392024688857661784523629550, 2194384510044725135667964020], [10353227985537869455296087868386930, 3728235557536367886692849984], [45020651605667368323805305666643840, 29630401833127148780352024672], [77950002990996603542948277456392508, -54773472664029234457490198375], [192421246079050587134962951955972490, -116877433470467045365634173712], [221978591569820301049713867971269300, 158036464925777668797563154795], [351272726084513428370471609181033750, -201064884188353675526886240700], [938083463547871541099982625997059048, 474301002421719409183812915750], [-734871582379755784334963298157396450, -2313639201353555812598551038492], [-2214498028574842754672973770889777380, -677841100246315757748063208959], [-3066622344866198940679557131841962280, -4198700520867849218982001242518], [-10418722947658352858172821585935998930, -4341124789868888201859845759996], [6751456946251614125495540626726169100, -15982252282061891897929136337435], [-10936347132839848508090783468526214858, 15075939100039290049005904702500], [-19999401746418853264927419405135867072, 23409261854602416526102727462000], [-22826619723453406685401932589854226750, 33362459022440654037667215966744], [23024917193639182519251864383014419270, -126653343438304599476041366029852], [-2974870165371742335918148220367965000, -115512606954201805540860196731150], [131557645284599234463366585520587276268, -85472104862073165437752667809875], [-7170683698009413887864793904470775520, -518579622146887886627511272068104], [252509572456898559206258845013555448540, 10510049202086333739478729231697], [631190439610210095447029915062934114150, 327739098700414839663173834178660], [707392190993609680756625246348664810, 79927282555987587083516767060824], [1733503598612941644978685574408129782800, 111153029311437915563026245228220], [-1708845425865624574971093413733067115278, -1520417023497469763545225340565000], [-2490501263091794955136270766641836888252, -614791221728237549137578556745625], [-4278248148758125214685813985147107729150, 1545416051280829162496928590916608], [-2065113497983696764347697484413277286280, 8702301052074390138704865517366466], [-10292510137757593577409701367379811233650, 590070215493790599435908030782740], [-8843351839429231633571516877447304132112, -17004430701777219353742841072069500], [-9570057607049088762230618892758725430890, -4991700473680514662526801292461772], [-20915659915861791959743063662210500739558, -9135313193137471882073770343693000], [-11643035968639816528828328480743919895260, 30240746317566902692335177518727951], [2501940082061685758272338672043341834150, -18698568070526971392247840614798556], [89087174660941801253198045113636689455500, -67711765727784116428626430776632283], [116152900659148309463160961539842117488968, 123025446095143293767278898885716750], [45751864911267391632110430031747523356730, 81528917030576228417755170964494384], [44478034998097447797004596503701782679230, -152403509049096493719640398893340332], [-162393835324816047907372086068399615214092, 513244142289866600916477431465410875], [-59058848546157047490976118935882196724910, -577291549719444572577791487416212512], [-651460345845005147287346315140791456104220, 188247466359274817635752248779027327], [-345578251419079578630919907857052987049250, 999949822119169694445888289599707700], [-407503963055623202294688735469866663434910, -644766727216462224246335935227679136], [-772732672039102635109360884210681769741800, -462245605456979597839828074237711270], [-1036340034621910939366527076225930936480880, 361322389140739314419645621003285532], [626941245334429087896354074927444906042870, -1478962175355779420180676337755919596], [157945971917340313961034520633047993276100, -5994361478933348339302740413915958585], [5947189312965792093469039302701118926259840, 992782538325581466200320330549089376], [5273146222171315079801992186528556333266950, -2530243905832801495708083801723977420], [-2072474762687116200149131447802223443814130, 12011557640558205734016750497132319348], [4970952251449394255517025986620479680461202, -367099383459628596978532306527901000], [17719198331854924395586068037450566911313050, -420186680789325951853696657555748880], [-12774139245551747014196090329215499432688100, -3597875310417426194375842781013088415], [-20127999655491574982411470511430482275454938, -664351565276093733738124871880325500], [-9306340665962342638785357605543327673481392, 34871560488628656497499619150770523500], [-19327837649404040838324226244114973957325390, -7819039672233268635360628865116360776], [22847671822592890952669566499071855528601800, -42816824612260115812343501921478078930], [-38249007549986812984965053346735092496901500, 31533414762023978046496880501364952631], [-9250259562977458917513608409944533568370750, 7012554088499173660380901951443509400], [-5139626404659951653727710597039963898762550, -86379295259534036803330685639351154192], [-19536367537299775801168882419830539808868018, 129465291451867871766233197175540780500], [61890149114699943155590394714935034939759920, 7445335939371937000662021134079875316], [-39343848492037283142699660702633935742204180, -84287905386765922103210693811329563443], [267114889314041860189437929162241487043565600, -26471894497246581452971963124650281160], [150759012133883233698443441560483789009303960, 5715477850724315003294411580249442362], [-58767498555430526231691462986798957723724972, 96382067320210220393572186712303015875], [-253870167652338261530868027144677401791048500, -87874418157759786822732192192213220875], [341656732723509187278325096724395441586791560, 110645718166812165925448652081085609086], [-193771973031362282034646413312736391130936450, -614776151957506001593003310200361305180], [-157630562223813270638902983098702099684539638, 197194618901542977825939826936312062000], [-1044526090460978431214592280497091284540694220, -20449087821801040326130040406021863829], [-661164534341128271001334252845137918007265378, -1210092722216246054179173044776570213500], [-1321418493861095702717830803705413139138142820, -640917562027450959191349939398684074623], [-973960789451352132230865840545248190527559250, 3162907761595841216238332002413543367908], [-2772442306738629311646601496161049904458884980, -879049872460581962177903843990350831259], [-424609051461789478547902170743371107877566150, -3182202027684013953912168018310198750160], [-1339043540203870527076436672641625147739926012, -467303298995268798037012799045163491625], [-2982129911637555870095377018665998028360940990, 852622798002305730223929429983151954528], [-4131508443593561793174425577721629500339651340, 2511760364178043353866469767978819219387], [8038978068953797837441460015628365740494752850, 943012633230333878958049993566298052544], [4171148144946610161604023953545820513470953000, -2490239077818119585566426865208198929450], [-822051316182665517888879312523144487190700198, 8271373810112781261443523394588771695000], [1276744252518008565604861685002290515141533600, 10845208210095856561301649481471070976792], [4202932098322070359435614822092303383840819430, 5092420196457080246384223579952293044484], [-1116732507484374151697209248580738742707422870, -11481878071140334064479218096133582673032], [11169515865756351088879696980497714259785650900, -453580778123211633957385126398412301565], [-5191976508387901244882114518045036507318911992, -22129783196242903691450791491446718449250], [3376442096948916821096876511042424045225889922, -11360992730485517743396284827867697977000], [-17424143999943697764548246899089744236927279300, 19717155563486945229328602614188338347481], [-10552900866160280081869230040831686603626490120, 27421584042434415814763805734798631258402], [-616253877627341221552165878601229707075956210, -14248325426343839904180282582780012325036], [-5699080127841251492479638793278337315472121300, -29071557584452788179789018658646148696995], [-9088890040115185531465805151988060903836381418, -53325128670147490337757226348239147025500], [-25982953084815467253042330401644232024279022430, 31498784053103517257238183039397518612504], [-62905964622257980033206808147532570275611177690, 35007985501227421730375385387981345816628], [42252592933103763703080030881756623756628629140, 61604330422880441736603704750000821761651], [71768688110267179638722691269180032812818876428, -33508779838219664271271333190471859934875], [77561410032170808631610270152262835951447102, 121363543540257394633236108056716028194500], [48207561727074827071669745954840860621284532550, 58538286578599028904037411433310432791220], [4935053439620440127794283939019115531116260400, 84176032557434693333168374507140984871860], [19937169887203972911717051479367640661987184040, -173524038624588449716302008839863124199178], [65054644319011966544611778191817883916143625310, 21630257704914050952675226100421242946324], [42397113254152044956963861064421845144875182300, -319081064091567353006105098367558875748655], [-407680640676013680096880501821671375610444388200, -49714260823447643472262662261729850825094], [-102592119503312427530142847242019008541925088752, 142247589376286520139083596763218419405500], [-92537638267265990047442240384563081834940480650, 35183806367746400524131642741383206911108], [-291599550341422501535821300647574277491901210118, -143103958625609658729412756437410409442000], [-211651358033600122360267989096019372623465361150, 4703343446845812410395347653991426441240], [-161471951168352689905325343575405260523732305530, -250164756771064365629395219905021937382796], [192518631418978151079810504795975050100569926060, 490318507320588250431205413459112610629437], [343355732863640648944584048494152036534608167070, -211460925184878221330066786035134622396252], [526883422266622126009652706386449729511230507050, -142214226921945586941600478412310802768080], [110023260989739191161930775587117330168299304468, -389334590288341247122836366023682207634125], [7421978939262112514308120118794631169410318262, 447977267003017789483941391542643013300500], [168782329568150021932415960095084840448516747080, -2255073691552322396521449247500195937309554], [-91207013621553434636043876950215397149539307260, -748170014299468164458102369607568052154153], [-190500939201810227087671429750610061484725078850, -2265483797869108218538931410846830249010140], [1526213040425095635434271817472863278467435743800, 1513002770290431829368697183096091765898770], [3968284333786413812379118692871353061518485445590, 359983159277339313391668782200754140301364], [-1225131914869431794073523712190857439063464317350, 407857952687934243834726242902725639948208], [-2623943149211381350123114565229132862780946006300, 299852664829808521023659497635928663209855], [14436778706883386282250716246971091217523228320, 54622528886035028554301321190782154965016], [-3125171080943855917840211531757850699443867427090, 1263743065197916993578430674076409552223828], [-3188505227858588772450465389529223544451791791758, -1147370146751037391514041627731916184628000], [-6363505674884515243996795110315627075694788500660, -1794322021888790211211341673308516129695499], [6280989559973347763428451485588952496201385130760, 1309990582861863515466192759297759157426462], [-8344160941732267024273526502125542358204280500300, -707205493019030403756189831848359933178133], [4186615956348459091789854405845287969653996429168, -7284724357851244955423248764713275053521500], [-923865656299249242896838304913063346523215224600, 9010451674728977687150475712972297758436710], [4157169008312431590284060012257551259502924383650, 13024862722133920237826392588992842747921560], [-1878146216589476608792234308989426858948888225110, 6843926747940365803412762111644092668720088], [4602885924608802750326743029468214668796449963822, -11106731636897192727701085845302516168583500], [377800115979948981505653884424081894047148211980, 11552320725985948636932238611258302711825477], [3383572252650180226839377731555194190574525090490, 13093075720957259080544855812095284570270064], [20231697798532742212587531731218538014124386427320, 4218979400890155222579060530859319952837682], [16497693855051730962439351112358380712202031356788, -18506407611690465598054454413010544787717125], [6781135518073410979879329363099712571469671904210, -5583331554130861797269666124440008499848072], [-14729541369957322261168852883636262081863813833560, 24235135411873421654214911619271845226719926], [-17239525132037310843194787022253366360317856725472, 6246345818553599553145451103062496643947000], [-12857634902027470869980780806179239691404365138330, 42140025327564963088918297631315276134848948], [-4096846325529011859290853209739002781766503335950, -7783983597149792552914140901608712712812680], [20029320337653319520961194756644233625075296423030, -58836497343831360650592727625104719109178716], [25096468470837805505199527172074783402020256760900, 45023873986971047617063984980724936156328135], [-30784454241292210973799099813581881040878412779138, 15512221292096620866198187113590134138576500], [-40097558349384875155319858259441208289904494445192, -51489959573225745365096675755877308117130750], [-68220339871549181223732814708134892905411882655990, 10390347881703862489808131880351305911914424], [-80811808997355158361622276019633835440955157629200, 13673996233748149892804876555190125717095620], [43176887717793683690222491389642023938393340756250, -71142165454454362448648666281800485727267400], [-28331185362387736546556235200890283557126700338652, 36049764743098897765565742840652591963227375], [40772716218067776941055048426659405495773522351782, 59871307789054284329375128404824951517172500], [-4166893795024002798511914079917911015359921421480, -26539452556283803042488099299975432528878134], [-27206063908893695304543309146600121690729055853650, -12988184431579022420770328942218392190281660], [-40222697300150428715434323622980450960485520971840, -101913721171021371046148785770721222839253488], [152252853754427645889235237794962439795085309647228, -58111210501498869346842332281449295868692375], [-17372014100533900765545066850772927909969754638650, -93746878250017189175173530985425284652280956], [169146503497535383266250469837310411138098305328970, -48285949576855210354819043988807557984090952], [214060744487254997379877497139483376362916355818160, -28147099567874792512172215736311414256392364], [91142860507441075657352365621960116996757150478550, 52203179681145920825785287328219860947678020], [46617556699873922509788227495298197947969771313630, -247290522873977999132677539520991143896437532], [-26916411461778202014878369351762013031082917011620, -342306790043705541215194501922949998882955279], [-2179011783173401944571888691095074357970288115350, 242986855101235415922368251593116051472462960], [106992483626916275718842512051365457200431114802048, -108852349792349597810078800366947283869420000], [-293293624933222154897626513381810857175262078243710, 262959948399006342314497139129747130946954464], [233682125372819892201091470946604708655283029757620, -25072665389477051580035030868930094039266709], [-451985128805197157650947730979264489446057196025812, -180598088759035167963363627865968131730751875], [220114874435180114939341086412651718746182974234142, 536629263579109530306436278394814031452180500], [-229983381249985111506968063782296507499558998439140, -379234443218955580754482659044386235486990463], [29278506205334642259176490211500958293760907150250, -427278249619304701884090133539813339812805256], [-51809951360841797694749134140569716396295749592398, -665232293208885237437615505175234694376456000], [-408854968096814509814336239677126578563029064223170, -874693734507130495934556763379971134998876316], [456370360234690051880163019293318872550166599924930, -725894289708866536739089101865283057150114432], [699171782410154245776856206933458278828978850103480, -789300905499967961872429938000488259608827854], [1184307523448400538899099737113270693573295727747150, 309414726702250065705205290347404658219354660], [1248553512592872144400556418130501627028888318364208, -109823763422719211758783818934208383446583500], [-497768520452980421277945904143074072627703915031210, 803605916144442978929315954916532727436914388], [-153942904414700382363991484576917291851096477310750, 149229919337723515454464332596100393658944000], [175816515528007916002506591049315496960862042863700, -2817591789437055634290512726380917421274636445], [657621817043644596731563731523809152823899075818110, 856475317614892539841996895682405432675786228], [-1171219686799351306406954543869150332569288308102400, -940650408550358023389759659538775111396973760], [260750880740749987399782861167027999083276883479740, 524353421877799437662474202026367783539050201], [551169206115509748763015008031593802319393840445450, 160502333192334844420703448155782463048889880], [818486564505117847749235590231431992204610007768628, -1112442750123393524232597057979434235441423125], [-1476445301835078407460981362181869169388150040904430, -2469671293168730638305481289470835477198431752], [-3459527169815293695728768676285321936994317537685098, -583896182292078377758139918474411240306681500], [-2313470150634476650112025436847133338169350780479640, -2191002323731481378053052578619906775212699514], [33702340641498135498295444902795884355957170014500, 3027683112579453987446712872648703932368261967], [877330336615528357030683071359690786570424957645400, 5393287089688662562470736484610032000131046410], [1237048016819955059773828608340446481543336555358762, -3312545626656388477971099821012252800466610000], [-831026859459971496734846419697041273830490790515760, -3804638679045413890977317389272549971475983028], [-5404958104696862538390860818747005052898998152006318, -811917218406057716959796657782415396462333000], [1975272476926472037995023854430401754600048680846120, -4654151352872022978640934598223543254376954218], [5693199895882838228239312499937910366521369625179870, -2409787732839942495880398021723181723031231596], [-871378388732577213171352320391506980401455043423258, 6690730490058925946468393884211640086045470500], [-3366438395158351835968010499189375287690012386187000, 11985240259864592022039880623182176342115785950], [-341289256126331664356974491782000824907228558797950, -8090767681967914884878618935219980265946979880], [-7141185508812606796260255972198915566035597438194320, -2756897432491996000120207424120943631965599004], [7372262608282379124781761652087473463476705197360940, -3182702964866506278911386180571336163716192003], [7188362720313399949796379597852391171305236223344150, -11473886878166907680100043979152303194977240940], [12659310530722117288442778351016680855948779206355610, -2632134973609275107567734307326700743226124776], [-11885463351782561115563188761306079632462652472887200, -11756060717737225247968511122362496207475926680], [3159145757245344516175607706197458732200677168683480, -8202109595588410684696494477230523746867893398], [-5653585112330215351149382172387895202360931623455852, 6937072901262214042394548832656252099101237875], [-9605435961203532173986315566806180393382698758797010, 11765168896886290468850872938980689265047284564], [8905388615686169948892059032352806708215753264786700, 5146933940475600040701109922489014259791974405], [-12574950490118780375414927286947294704612354211467712, 2364605695416181759938881753291744163407622000], [-4250574221522771224879646384539092143101417683035958, -8463838358951213870127704414273348104243069000], [12844134815144024304803335735226197449766867523565940, -24210187639963672932358588629377878566762914949], [-14058296235854253318679654028585023458427079118137040, 13071699643567525186275149084365134579657146612], [-1492206663322620335757056021509789241727484877781550, 15200589615336137962386614070001090801759364280], [11377618492439421841465916141627675744562573866596950, 33578623324124040029080017814076984126120951844], [-5944631349022232788041884303659188202236170176537500, -15473211782949111986799123773843406596718418625], [21503175368138787602454949736893647496757445943465368, 3524334095598249665560925521403062331743928250], [5961812847623295040633148677472059952099995089432780, 29321973516216458240387655296461647834031522421], [15312761271697938188242886794882990141178585728586308, -25720467796644371539852355773174108755235013625], [34908304608420799201687820452836131182870263383284600, 18542931408998414167310275182999821222677362306], [33531134544293509241224480828593476550667692968804750, 8905700307914385695100767947377917425506884100], [-30681032672907494905177499015279957403526067523760110, -64602885931386519170139445211661436321618392736], [-34277644432000664771509694852783833609863222568507800, -41034877399190531277589537785145052925003338170], [77500522141035177422548859914825885821520509266583520, 20646521873845209742775806639030781331288005832], [-11719066170189063153362929037764854792529155927783012, -27045158854915398841458916879101980285288477375], [-8816672665469643792902703333823110834897106974065900, 110585941881600805679260948099572185057953522515], [8035933139411040572686716868062079830331222142393040, 47331279246507017902268863309068790661374030476], [17781791613125049153714800881709079798481043244993470, 54741014946983603534857926800736907008321130548], [-60510154387224258108609495759286914550248415105227198, -12696039597891824161797927715172510654848020000], [35244039392827603540558792753295756114277028023756600, -94056880241263147780561413545573880450361150958], [-38090850211599744017903346414964566461706351665888950, -12601379148086539416526644203001883006470213480], [-103466145015047047966322748691389451781841427272747570, 58542092062898866555480207116549005274624234484], [-72372475417898585606457779785551691789376151955742100, -81446787626447054262817317452192450308740051315], [25841770676553358320211199726735158524700705126056662, -103439902272973398164262116474616004885995781500], [-82249313564139503955531510226307667220840936043717660, -115965004417428020647269157691146413865275853953], [-154569493328572274206217005201442369601128793367562010, -30726749186697587002160071293226585504835395212], [123728462190179834106134637686899148792293291501725050, 39939084351265154378207798213858009472163057008], [128123050841429173217158590449745053434372655825269120, -152298236759437976902341667927105049005814047584], [-194120354891430614262241192259363414569589592702147780, 66300706609387846535092094049749425213334580857], [52280976139621590296761778149519290308875178975577350, 83307294719684184012529586094508188463378515540], [-205640389746324088970693251130588669464136516316129250, 139229315826357862647636547967325334294695440244], [-49357252334005638174944115084744725408270363942971230, 29975373949891377733808088297770460917681186648], [51211989042109361752346786842982840573491556660105500, 88137515114317687792817797801852110867824904225], [-57582179869053441509577768812035920915232808539434450, -348794737244719500598714075413616769166378192780], [108549042811174536969754703605086758008541463178411962, 287077519782735478681282747607065621334984071000], [222521785815504728582399155234136897859574981170158980, -230511785833836623990736135665494508678092290729], [237262441011733806526509643241447120872107066393386310, 152047891980323379622607200770219338045281442324], [-54447069704184057206745696283559497922654167021497778, -98338497667713960484097021043384046848717193500], [273603255539273130245291248300805712531198246560985580, 262431638138446579927589951274237113530701553677], [63768919847898066539992065358011275304320207430089690, -573732606352790732891002825158253057395739515336], [39717569686325797984662511131114946429528383456359200, 159616660443743069509612699526978988121702234680], [-487401946940763819202503007042648275638307700101829390, 60721721250232438491146058136155871235684293728], [-194093712989920817441250490974834304290544087803760760, -324453367555590147285930873653755210299552244674], [-1716751466590973882665864575239893550406958625930940, -388998273829522976526914995345362739214209168313], [-161049709653642644651147436946275351723311295024050050, -135864243884040008590219189167940031119315270620], [261364994795787034911748188259947010025140144091003402, -144010610610779032452080214850701368295751233000], [515015028028087159568897742567462284110636461632343468, 88155587984250848373438942004401276187236108125], [-835829264120655087579408911222477687515051534729285920, -41007236110499170171814499077751710933524093304], [-649853723921829435457071485595240677339479185344839592, 83767547590062014233375350630018532455838322250], [417241129309778249455185993658414199463110130916670280, -239244620886422726670941196286742002233965589298], [656576052184837049948309457132286942897317206925642182, 105764521671679047954571456942594801348553170500], [534609709501682909278822563175876790552580219456581620, -845697148271612764681025902192450184623721685093], [1258927248961622507284311867228225143625091645104263088, -236184631583252489929227459504781787592838219500], [-90109471501707127670265302938965321447760620483475630, -1305229094071723171863401549196257397186677913096], [372978931309506953248094461997251360880176569550589910, 86674055584174462816071546948870673484043587828], [186871531101566909798230609697738147881011383694946600, 1214693458692238171374604798377527429442908456790], [26518110350136298568319755484271671521332635719748450, 1576139938800640671436732171607381731295865370080], [-543816566733073936063454932556427495507262142856449298, 1394849730787069514326130353739896855773419876500], [1083062475928052232749075913227291837139219570476666700, 1032522442358242058513959408614423770046399912117], [1927727141409925084568815363296038170885046989009451130, -68280012558236099731066804486398445562079653416], [493080802970936874082438813632466183966706730445149108, -980338814918283417746434496964969706915382187125], [-961949299293705317640311882555499770845986261915035890, -308535135919149591072177282538739920526043423276], [-969540500331546309903586040304344001837904771741889250, 687847414742859442814970479302899243014863376900], [1319330795059163227986888797556089439752670567275095648, -11075903243966592512673482849921059048640055000], [3816325946852126144273117066813877905498783650783113270, -370197173196376859050832323463172947566731134396], [-2073645397076299077963899341281013241148149854854699900, 1563550194788759945894006158967771330548975396215], [-2305464715512142964224110399171842195376067795027073540, 1936331638483826697666887383234864723863804421737], [2392509639463884252809851692871590666944642708823605450, -639407546927719146684824357590594723459686376656], [-3169471863531961169214739336667541672734982305268657330, 598910280093196014253964291117536982346184110948], [-444309627795180047927460127106281634831395005449378000, -1000811211542983553429377279720825908754756855500], [-2972392537654954779053162005456123724097684722998961940, -1495425474650779065740570006386181279287976019539], [-2627945405343674042134694997637727171173252984894367132, 2130819527279988441051485174799474920518802253375], [-5064749491180661663651942271777578103121197624466992670, -180248996704267754987723657646126023046655510632], [2493193168985435024545905870773198747221157165901133140, -3138671075427460579733435582575699204602584301853], [-1092534214361483021641415138399811913720130505338568850, -4176411251123064612078410408971526953893937399740], [4585207915925555946891213248366098250458058797657009800, 344472901946348192910452091739763600085483751870], [436952923216279530680664634137912624664544826372128390, 1685226551691000810186656837079949524469513483764], [1133129519050855694295958176316779805027368127599137520, 6944490476545121335554660952318532130263857122116], [6607090161049702165999968669091588384418389378099123350, -2816394721772177765577244092448515162483968613660], [4421594821803604498418981692643110498760479657205815842, 1774438303085948775249380796507642480205427983000], [1925375660614955380169431343785465050824968203422320540, -3169537628775360388250109749578860763231266558399], [-672686882444182476897572124624424560118003498230300840, -8916648952688695925574600563408613098919718205238], [4517653542409418739395235310422055727881722900631793450, 1903493183366990978837729212337370182633239275480], [236301288107271404973121499783861865215919009764047500, 9425434084002104811143497314738711991925516257925], [1940760577899984363728464862483140715875894595432645568, 8696971272537989919516790018275820852796240890000], [-2240406083291443072535480081431081487692539787079643070, 7392832466008450612087310302113528162306958377984], [-12318682982305772403970261049635905602551605360776146350, 717208687085686145986236908717347032047223776960], [-5278216593826423500272856508511426600360121545419673492, -3574244161989286632851689487334597259097932045875], [1394194102562804413108467211581502607815282163189830490, -11460790537815405876331713840278202874605487397712], [-6208215309017732550908781756185242486103893467537964578, 2379354135010828005890663360641310184528238168500], [2870501859266278650261963223594468757953493977450871200, 4405342759469295379219076490354130600690552616856], [4902138064790595423493717798989603819402523891646461290, 4058242008376812488074396291008712833509464028464], [-7477350653732410394169972101046517805641566729748267918, 11204982276036907800993191613763763189166369459000], [-2275661963633448852899121109873271876648263503984008900, -9974062966121405263630020447516778923197330092935], [6431797683381555019661499256058375012067481654870052260, 12419573285110603430793784673529592710525364027311], [554685885745179262876173179568927926626436787421672800, 1614767394940529379402480076528003145319445097192], [-5530535423623028290553390222791752066015267999171838170, -121320071282608080736031605459986210072042452316], [-2977300704312809585029135522722596665068410324041539538, 18429711292435403902460004863003816058829954054500], [-5722413693706836762756120682709979794413652400288246210, -28997669614034565694238330814427029109572117205612], [-23824260422499479133455838592667181843194326761319851200, 9596531056360887625520695748864945561420531724720], [12322289154420494108722942759282952727501273611183490300, 17859860487412938096256154065303742156653981650281], [2209425337443340473904439359220809384133746625141253748, 18459320202480374670417757077618188482641141490875], [-18677589520038941150900888280420178657753939817082023580, -5439046106723077845568704137534420645135824224993], [-5611376112194042385130742222701430837286610987602527650, -28196584384219209397386718065605568224460065545260], [-14525419226595996946928847010822395032674890425646048030, 10219699850984380651197656776982143490289590340704], [36871192147221362187061385113752775887593644371489214442, 4289525575241616439971174264517643468801686491000], [14019954944040639861238391032791834532701629386253036560, -6035985615301015417803532040249991840227684605188], [31568207260767534864817338338693637753133653014870348150, -18526616525270875391255881875227003438893932782556], [-16794232475684906946224337082672881302097793982343911430, 36317481389991290446994050221514613941798523699248], [1512783914101118155113872219216009669326905924011036550, -14456301640455750036855335124185662257220747701580], [-837234435297208732965183676394135002067747724336945032, -1875392467312867784896441464693520892586866274750], [-24960151371821009147895191601512662763772287306312872290, 13583343347682612824713837447620057322334104211524], [-58568513600728075045541070044322769283178078778422329700, 11224602637522831610191783944537177284335443962145], [-20197616873644788821745100647478541773384690290835621978, 1716569883302795469922246864612889532534931522500], [-40433697167442958512272349156878378787631438678633738220, 28968308788912109508963963309751677259509219451827], [-34391553045578680580112350635406002223148751101102741552, -50059079908881819093137297648082769988902336184500], [1752305925560403859004443746445020909133054011363828150, -1768804258416290948185629329037364163743589903292], [-11862713660423385011777572668355292951147861905152961412, 55844194618323887747979206128358412755411379899625], [-25446803909218099641734480973118721237579898355344305590, 44579248980666661963646687169591488212222069169328], [-12759383567281947814078068181456371423324418829605182258, -81213078977675942892870875930267477776469199305500], [-22181544583888316191766880713929045080604068858132718160, -15965787450634285871447048889696677625925236542124], [-21943977233050307570199055455825050314719860399882603050, 41867263724112621264361807722772839378229064816580], [-5022249319863038245122749194695804574532682455627542950, 40603561049715621547156869419708367300347414553144], [43058671143975295623766658854579033262007506053577124000, 72997540638696185916173425074884635270638576458200], [13104836154564932213199429809324869868132173072785523668, -29926309741637626830085164990074305835262053860125], [-49028072317807965844942084661561571932760943471808803470, -12949494443206000658542976789404220988954188820232], [29298737022934157780486654527676214658776347045007676680, -65058823081725888240654234493418337162040864614754], [124197872762637509391701395685533692834579565344619280390, 2378003426287765521332072986602705463557064413588], [16067137802288649216916609770201513075492485577976925322, -13105959786472403079573525486243071229558034625000], [-15123429154862968759814106068417704040907696044291237520, -79039159269827194709032343682994236281553883949148], [72018964092427984047392398244731604417539986987460289700, 67463085664801412828501890253366419243268822992655], [30356849696850279115782722999958353218465343597133153820, -58182361006584327586895886271084589155018560434943], [133953723254711797777160354965975459915364971084672665770, 18543841229873387937897081767381112263886069370104], [-13016485750993816055031804465589891324070895520861294290, -24083396872701790870593055644500170925316411972572], [36872955960603268574855444129387448813068760137926085560, -47971336105477795000878341229635921760872130918414], [-132791145228530812498913829848043438481816129500731513638, 131930287853036140389840453369224365999486732542000], [43139363616795469023595956049859740477129153937085049308, 166818169822822838595380020211170767127542276880625], [94342375468502346670660856213502221848367496629218153300, 191834816481294377558618503722629943997298193136995], [-166278733625226107031528764621674009935112018257899996400, 102935496495685937022667385020720981094940679002556], [21947665322593920038309668364061917079744705642223365750, 74878645323385263492233894269777204681269872934100], [-137128982315293453950449565972596824636936475284728972152, 126462760669859235949135774505003783588374387434750], [-99042046397961118936701105458062827730498542799363461250, -164540939795070644284462774300636832560521365986092], [12692841702779610404485630668813539999942305342268093100, 14228150035951524074872012661443050197900990848765], [-38117666407995127800814755498595354339077588138022282272, 245469137798723054264747016040943887310521427277000], [-110150091003502086484694810461485145976371249098810397150, -266514463983131418218871086038713345811395110499456], [20496205669883989462068192419869372127269043436199360050, -356615286200781536539389900951349237371775467969480], [-186988916025576142982836460017012910176239592490477788870, -5196041198329116801790104140481431223630216550032], [85678774879739976669844076526243840025321266249401161662, 56014787075621558202064692853483455526661590604500], [74267948086302220879051661414719199333718441084125422410, 157478923747573323747733246623794929449271943456624], [-169359385588340009230444527810432125373788197393833116120, 71524916602430994040302635031724026358658376538902], [94304567631940342363477945361549799797355452292303550050, -211312923459901058086954947809279131774169876772992], [435138764963686683043837748285941727707479070843200612700, 143752964179728353015089985681408651633398722803505], [226257667044753657765107999637179301135193515286092708120, -292872480370459617906904359459383087400006458927334], [-211662499970446875367133983001261203657705326714715475312, -277883142236966155203289569984506386108037332942500], [-115291809975320118491026664941493173196983544376113383690, 592870975137934012101408976753727992160856359384628], [393025371110843855302886683213645704716187731692342259140, -38722925694930081171895418319753944105939562753849], [-153433437753282342213619897600302097975677580989355520640, 621184076831574854037926113319885942939928847930912], [599250330041352063674618077152130461333948773861633528450, -139282379808095016987660795286564095884628240508320], [41004668150459803306510449768083422402272323980558143750, -491238247947711450157691619266733423294179174879756], [584214234992895626391919938662255240903794823264495800500, -149429853394534920247731855550341842830426283361525], [-557778603344680616136038374772167535867743629889441375700, 3203273343094826506934259486279683373258229108317], [82641843483627954709448507881008182765819354337865185768, -431638140594674910118820678652227640918722220228250], [-545421333233075731541823300515027502902668710685028397670, 249727026295889604188504712994607439763643720483184], [293047514024182771992457593269711074929034710788711490400, 132033278890308886217791594257761148559259497320360], [-284051717164287217503919414356993849536548661527144075350, 5489912930851750227121299239408119689026661810160], [-210219805409920425600659602913755214040826306745955709292, -180421982527781191942329282734359590793496209546125], [252700249677180589397301255937378142814906349190265063222, -447686813426771379104419552663262499480995732579500], [40994636385932555016329565227477100871407167309567090750, -288987457216933553225782427155556464200421070263500], [291479300951222441549218112191633515908011542267510378690, 909960349877761942916419464177619868780105993456664], [-559145133517750660957904421574000119070405541725707312080, -347761050573454465734017331312735524257948475393868], [-402893256999351641838359688174819821428912077261315492390, 928989722905951456511825345718542298288058383327728], [-387723916747085622200958068648808157269505347859704721050, 496848092059006386855435287609427715979783223613380], [-128305203441927337417621929869239724032462913122715520872, 575903956720947862281652350017480935424786485016250], [-293847185095808495775309105223479716646706405693583254930, -213315080042139648100321743076326493481904822300252], [634976262167212964701153413674008209119703450620564508402, -196216505181370552468862459154864676282746270797000], [-258746335034848507466568943827863598665694624175242585140, -732008303367041331750778845311233098550395646232139], [-131207001954793436799527613531980814133537353523177292100, 59886317778427937963351801520280659345294433737785], [586760896387489220841158148166183804349750508674883368210, 242383817138458440986882391158228089887903366717024], [-357688859658213617347947463206900173695712185572683746410, 159797943644410890860901104152366343919295512771988], [-139635029933161612049191936475675893193933377941647099100, 1895948399677994354542493862057734830525884471462831], [-1292397295741103453938661455546680277776996327355259614052, -301552194476562800868374019989456947515944816649375], [-905743781864353894328131918021275065479455347583911675350, 332273800407788154427706680300147358940452157737208], [1528086515754638778662194803633470915294514074888036971182, -245782610070250120485826791403829576270910591481500], [1357754262245789870030555373823154664244926130202686353600, 427169844685527154955137202405605172356191503417040], [-873586560403188331901343282156749504235817713353537015240, 1293319656325171653269766018913330283157280514506962], [1245161775027600531954090323658572783280758952015400172370, 38877992892474292107479015757475736781340285489848], [1822032176017826434958954677372256670471507575862645873960, -91601297986343869939662863135546244818444012084714], [1806810917309042066933581123999075024216436663308944611550, -312608374623938850072375773295259370946168933528380], [-1838397476457325730085872872561561903390671859126972434970, -299070715675517728285263646144668117498746533410732], [61569872833412390892874662888606387242783459983718359440, -336234525418935943248084489706352222695075133910628], [492618769073590979918363810688313474772216532209402031300, -2588973445659267235370556259502905962871246940997305], [-1338133032339651472833150377324047192199629534833379099510, -1130095297595866335062191580732113298563568816841936], [73922922355303746788016241935939992307591511392569095950, -1123449089893003430008616326656412510042120617629692], [-1262090827778832375457749528679706257076511835635423866580, 1951888970226418109018046129297077051285568158682941], [801052824561916890477188348938751993203588006149602717850, 264185786568852565445344779367185905264874885263640], [1065585060848114519285176917316581040573413195446235482788, 2571722866274038335662205395470806158014077114531375], [-53523995166759918653118874026022546700588352924379251000, -602620514310698154807592052072162261448993221895250]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_16_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_16_34_a_b();".
// 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_16_34_a_b(:prec:=2)
    chi := MakeCharacter_16_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 34));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(2999) - 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_16_34_a_b();".
// 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_16_34_a_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_16_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,34,sign)));
    Vf := Kernel([<3,R![-829533439462896, 37919880, 1]>],Snew);
    return Vf;
end function;