
// Make newform 4.21.b.b in Magma, downloaded from the LMFDB on 25 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_4_b();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_4_b_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_4_21_b_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_4_21_b_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 := [18139117546354278400, -23541970369228800, 163438296621056, -888904297728, 2339673984, -12461904, 41744, -3, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0], [-1, 4, 0, 0, 0, 0, 0, 0], [-25585037522225176576, 717876375920309248, -10758414598985472, 51485437452672, 302936330112, 787005348, -3891479, 18041], [6113875026527821389824, 6456377094864630784, 577805761702996224, 51485437452672, 302936330112, 787005348, -3891479, 18041], [-5898906786242128142336, 33911623072277728256, -235169239430703360, 616364275162752, -3772990508928, 10433869404, -123241, 249607], [43353880487245306191872, -179093594736954825728, 461344745751250176, -2897202560558208, 10760216187264, -22119906540, 351728581, 492821], [109626834523451544641536, -126798519347604939776, -2241326693447300352, -39709814857450368, -32382180710784, 211723652396, 11657291, 1155067], [-41240951986505981370368, -7113770810203978752, -425733037190296320, 48491294451584, 14964065291648, 168407965236, 258986637, -616355]];
    Rf_basisdens := [1, 1, 36785261018873856, 36785261018873856, 18392630509436928, 18392630509436928, 12261753672957952, 3065438418239488];
    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_4_b();"
function MakeCharacter_4_b()
    N := 4;
    order := 2;
    char_gens := [3];
    v := [1];
    // chi(gens[i]) = zeta^v[i]
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    F := CyclotomicField(order);
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),[F|F.1^e:e in v]);
    return MinimalBaseRingCharacter(chi);
end function;

// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_4_b_Hecke();"
function MakeCharacter_4_b_Hecke(Kf)
    N := 4;
    order := 2;
    char_gens := [3];
    char_values := [[-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 := 21;
    raw_aps := [[49, 1, 0, 0, 0, 0, 0, 0], [6, -12, -1, 0, 0, 0, 0, 0], [2322148, -2279, 6, 4, 4, -1, 0, 0], [-12010, 24072, 820, -44, 5, -8, 4, -4], [-1863370, 3748556, 15573, -19080, -1458, -2736, -104, -24], [-5405468860, 16025725, -23298, 70380, 2228, -7117, -1352, -1352], [-304162445350, -395317762, 869380, -187068, 426632, -62322, 14076, 14076], [-1150485454, 2296672196, 5907271, 3767016, 2820170, 531696, 41800, -15048], [-16225758022, 32453619992, -2943580, -1950228, 27211915, -153720, -326468, 291396], [12700820270980, -211330499063, 504793638, 73656868, 269828164, -15644305, -357408, -357408], [-74379199072, 148359315424, -1806966536, 346050848, 221587688, 53031872, -6664544, 8390752], [258802178796164, 1633589484317, -3441513666, 2157271308, -1136518988, -665910605, 16334552, 16334552], [-2734340676566782, 9177609812876, -21399705944, -598222056, -10957853680, 455173788, -39434616, -39434616], [3627959664578, -7254545469684, 26367275449, -1262513648, -6934779868, -111345824, -181669424, 161030960], [-2933704962036, 5841332820144, -190666964464, 22944650760, 12714698242, 3132453168, 520624872, -339159528], [-16330643588920668, -56202357495387, 135503175470, 24581514812, 72777375636, -2990168261, -407123928, -407123928], [-29276308407438, 58585622465916, 6449346076933, -27425543328, -19540548904, -5580107712, 3982055904, -3878403552], [-189492003326769628, 258222785811709, -644631539586, -212142907764, -359648291788, 8781240275, 5710256344, 5710256344], [316687980044362, -633620055139116, 21495212626643, 212618011688, -717468556838, 31477038704, -1319965816, 2573753080], [386694690016478, -772550772698872, -38082108215444, -729433470492, -435184341079, -109173863592, 7500009940, -11594524884], [-1294180520081416054, 601851051581342, -1154347187196, 1517623427988, -152203166264, -507815100674, 16568934668, 16568934668], [-1920003896778036, 3839275319468944, -52982516799576, 664611914344, 4053735606330, 67862172784, 72442075080, -63192234952], [-2164276662213106, 4316914176981860, 56622815002995, 10162995815808, 5495871426720, 1476151628544, 8205499264, 56688528000], [-5211572477018818486, 7677668483617454, -19121268796700, -5997526320204, -10573177176952, 127381321422, 177032291436, 177032291436], [11651735149239067898, 19370600445404774, -41184761775564, 20208259679796, -16274422737944, -2983218567818, -266947916404, -266947916404], [18076245502110105860, -6520678086238171, -468703585106, -89571976691364, -22721776749292, 22659117291099, -34338466872, -34338466872], [-8073660989431978, 16130597699758504, 1216587180944572, 14464244446196, 4389679721069, 2260034659256, -387426252380, 451999389532], [-14511146903277202, 28879282644517676, -1709225685119819, 125193246970824, 72328778352002, 17817915065904, 1019271427240, -155947169832], [-78691987637416461724, -25110090173358343, 67199434356678, 51902956916388, 47202696306436, -14743415308097, 228087236000, 228087236000], [107369540222878993378, -162922317538113200, 378048952020192, -11599846491200, 183450964235584, 10434512050352, -972200055168, -972200055168], [299298485911998504, -598653270050746944, -5966975062217784, 49609129265040, -440243260240956, 6689097484896, 1335437626704, -928482290256], [211871955440098114, -424352367709088684, 7581614321064699, 530910606466584, -319685764743498, 77546222425872, -656495151688, 3970983504840], [493638895206646132066, 74539807815245212, -242080771937016, -461167441369832, -263233521512624, 191104545001676, -9782281891512, -9782281891512], [-339351329404273790, 679893442159060908, 26338789079595617, -1040288060078800, 68737850396332, -150495290434528, -2355071319952, -4392990987632], [-4085203734816481145852, -467135902946466671, 571205833549590, -2640682696123244, -255391397158364, 324310022846519, 43336858217328, 43336858217328], [52076397902972154, -106272837629545832, -11806470542256060, 1861925528116204, 488052178387851, 258116295485320, 32411308888764, -18370486572988], [-2249850151531301000860, 1527063542429969461, -3398096756349042, 574716609488124, -1673649337771564, 189655708631723, -43010949806936, -43010949806936], [4304478034199890798, -8606801964799291244, -71570393606654785, -1838188567949328, -6992786911700516, -315915032541024, 121210128232496, -124405553279280], [91245526319621838, -172330102856581080, 148262608525073956, -8876742797040156, -3757048658838199, -1284206985622440, -20006041326636, -37568700772308], [-10740143281623686072636, -6078773400830235803, 15864287068684974, 9781376864335228, 10341841324633492, -2344886107031365, -12962336651928, -12962336651928], [-6381357484236447898, 12771410651464209860, -292927216965959501, -7588886532688368, 12230010362211812, -1106796458625696, 5229368429008, -52896225897168], [-22763096618426882239228, -745896655937212599, 353042766873126, -8152489804071996, -1962908672009532, 2323625699860815, -36839128882944, -36839128882944], [-16001115956023101480, 32051345071971988224, -57842442924130648, -42873147177293520, 18154110523420588, -6240012748491744, -2545568508816, -268980687382896], [63406720817495716434362, 12594426032861782006, -27318075391584492, 11599791615556884, -10627242879555160, -3271516475051386, 47944331762860, 47944331762860], [-57962309155554583728220, -1292863674484679311, 1787376290053846, -12992481252773964, -4723703327124700, 9925157215711863, -861553148712048, -861553148712048], [36959836040722854198, -73943193079698940344, -43335857186796060, 20583980332414548, -58176682131615003, 2937017920817400, 148932002482308, -8284962230916], [60903297804706927062, -121758693842086433500, 281934914730647643, -41505512772707248, -116498883565212300, -6396254554713376, 888594061467408, -1089423036762128], [57652285582356390688, -115266438475451305696, -3492660797107065976, -33204423552813728, -70566596214572360, -4928265708661952, 237527623077344, -431145469273312], [-86587482537461514314, 173020224295262559892, -2287134043977548105, 133618715136410112, 200156909368201472, 21122064524058624, -4191361058156032, 4745245510666752], [-218014011961303622125276, 42466543498044716929, -81765228150294090, 106672604941542996, -10453988059352092, -37265852889266233, 1367445374694256, 1367445374694256], [268911240812137971447050, -262064677396728448786, 553018087289235556, -295959212607001164, 212949482892147080, 44595483662871438, 3792815417919852, 3792815417919852], [-51585066956177424060, 102891183103424246448, -778224275384824808, 247469232536914680, 162575025158231582, 31481576393686992, 11392115526134808, -9032732593701912], [47510870374680950502554, 508796380426115671294, -1172090735602566396, 82996153168583556, -557729079866305144, -42074923649218354, 2751727142848060, 2751727142848060], [12003779910527877522, -23618699129128895556, 1971780205243675125, -340329619653776928, -121715116317814152, -48531072273082560, -2534473537933728, 204037914066336], [95123580170744234640802, 23567512706752353856, -59676662128829952, -47017166965234016, -49141548155073920, 33028535907659744, -2745063763400160, -2745063763400160], [-262106608203726986242, 523016681105661245768, 22167314429055647004, 1047757180822595172, 471659822857297929, 148778120970131544, 9388445168871508, -2103444677224788], [-76392173148491436400924, -454455356252184956767, 975389447125766134, -437232861366482508, 389549136664518884, 77849898819716103, 4059137615729616, 4059137615729616], [87270581527386852820, -174259478030497165808, -19378988358181103104, -250201984933009800, -17465824964760866, -31483039343530032, -12386118050499688, 9940236509433192], [911951390326165918293668, -97999242576261889675, 258575636716421262, 60163664529678300, 99069532583100244, 112507743788801227, -16457891602738168, -16457891602738168], [-1797834282419989993435286, 247713572458064157334, -243652738050734316, 1785668488255391716, 279799895601268456, -320188342013522314, -16287584522622660, -16287584522622660], [-64908599024762401530, 128325835680194816828, 40434704916516503937, 1300172194807600904, -7714083446918766, 191190174522385328, -4826779269239064, 12719675616365464], [3165519975169437900011620, 9423784898270560561, -23170178970103722, 46029213580721524, 20840975995191076, -70460178362174857, 7606822576386384, 7606822576386384], [-85064970027394248558, 169877630905549142436, -6740528645577630945, 238776470047081608, 311065951935819378, 13532679192273072, 53233261884186216, -48015905233723368], [-229978375100508276694, 467277135527477051768, 35445546216460411628, -6393351958160910804, -1458475296195085829, -927033368299587576, -9140045180414468, -31960539978734076], [-3048059108734999242479806, -3902464592301804033140, 8667679788188588712, -2403889676206162920, 3703967445450434576, 682417956993530780, -10509101669934200, -10509101669934200], [2585600406819701806945156, 817663947358625941753, -838536471375489210, 6412309517869206532, 1316713320538423684, -1977625513969562209, 48328791548678784, 48328791548678784], [-4435590460081703020802, 8877321135135643086284, -18117423160858477171, -5389534751591616632, 6495344657738888818, -750680220645428048, -84949594041738904, 44924402357873432], [-5926065999502549208290750, -9570239736757973158888, 23717264560866156624, 8805462538487599728, 14239901643166092064, -2708367050207766152, 65419537494950480, 65419537494950480], [6414309978749178101034, -12830804104005358696164, -117735589440058365515, 1944390781110478320, -9275106389149191268, 239755725892015776, 108564813882579504, -88700233288789296], [96225664304196422911940, 895955538315577196369, -1423508464893133290, 4331341594121999796, 591010915256216740, -1702637418925116905, 79974454244466704, 79974454244466704], [-3500219911753527754558174, 8829110551478648702648, -22771509888846251120, -11583211462230378288, -13806012717288826336, 1555630331607712056, 172925488251597744, 172925488251597744], [7283169773966273938166, -14567957083750165559896, -104988207509237306852, 1305394133379233076, -11359884661245177283, 312141684238450488, -306259064157981212, 293199218763306780], [-13147792265692516215988, 26305093591857443088240, 94328093962451389120, -8281270304477329592, 19741601773985082002, -1227790167933326672, 55898881436302120, -104420290351985704], [-3715139321202099584097820, -26241387317340145374643, 57365634084347486814, -21487261910290322292, 23087595495971790964, 6001414398255355843, -81238570410680680, -81238570410680680], [-21255955908687787638870, 42511708118765201658876, 233180350709934616749, 305518767897969360, 34465453789879515924, -101820157524350496, 366897088103185296, -339419956856140944], [-1443836764854476421344, 2857285400311376722816, -178680224878625328576, 26483767974511796160, 10366316045838521328, 3904361423064323712, -123213356037965632, 282253995646156608], [-9429250377036845694913084, -10678459425170114989123, 26661439311101310718, 6530440663561606668, 13424145970906703156, 2705089776524595603, -559703218376128680, -559703218376128680], [-57447838174883452519521436, 16622161184897823248489, -42147581519788653594, -25327481009039771004, -29519929349687948732, 12290262839854856815, -768824850012246976, -768824850012246976], [44929675398949054438554778, 50703008717813102249614, -114870996847744825116, 13905020709192012196, -55329029429033988536, 384051336906265118, -498104066348937828, -498104066348937828], [77931809295333295494221954, -6609400724540701634756, 18580501764126813000, 24720230019320886456, 17978529300965246288, -13248680080850236468, 912080332389679336, 912080332389679336], [-13439615785414977872390, 26872111159785478955764, 1578433944029205013611, 7300067355330477480, 10857562656481793466, -179656310853688464, 3115670575991805704, -2852553843768765576], [-77748297504272765818642588, 32622388345926196514521, -81352331551313834874, -24996783444581614716, -44426944089878878972, -791799043820660545, 908515471608524416, 908515471608524416], [-28242025776567566376284, 56528211617368425249520, 1754094317506281707144, -39630439942519545864, 18919133501771889310, -4529624290772951088, -3108245725965448936, 2641023302369629416], [40735733455784042039043290, 34914026795922894449774, -87238129177110489564, -26537314488540514524, -47110498111074522680, -2222921204054996162, 1142870945314854812, 1142870945314854812], [-14611289386480360615702, 29271406368554689870584, -218142358855980869108, -42333163767634137812, 18172809421510563899, -6494431826334501368, 832658125480413436, -1042619672235790588], [-68909833111426905567762, 138080404699143427134684, -1839580839181213085695, -227329621927899454728, 85292703713272416622, -33408854361716544432, 793931504913120024, -2177452868038785432], [-12615353071601297676003078, -30090563706311311675242, 74731875880475400404, 46317034452650339732, 56476480697322899496, -32803786655126316314, 2738648779608223404, 2738648779608223404], [151776647860015420563209666, 11405763034593460601116, -31256061315607529592, -37043771752890097416, -28824938169023547952, 20353206734851162796, -1431259844726275928, -1431259844726275928], [1954358125329601447812644, 17249903326237562736209, -84563375851526252906, -240531260248164624684, -97124203453985889244, 45223789103098411191, 1923745285024870320, 1923745285024870320], [118744869890554385580140, -237293080448560029209840, 321752509207468177000, -171736558440268549336, -247282159332181973398, -24922774108473401104, -192738650593321592, -907620106348419464], [-25271375992193992717974, 50416745753817759249348, 1778123980936378562895, 107771925744114253272, 45252001097078297958, 18234304826111933328, -6385172546207264136, 6622736012889760008], [-35476137386078023581632, 70902357413982450602272, -3112225713896313917336, 45192109978242553248, 107011946032403231816, 4725248195354007744, 4648084359264214304, -4038457536921499680], [34398057897787424162606, -68865659092961910042136, -7232413929495021379724, 59243584007210435172, 26019362026277157161, 10299713379851281752, -4202417172232738220, 4284803217249512364], [-17593249302843322399622, 34773671334236204593420, 7559705787262297478337, 361261267215292850688, 37928906623114354560, 51566004235147355136, 2564769472991324672, -99745856420454912], [-109520766112380048872802, 219111759711821044796996, 4399714138126974525915, -64918710552839565952, 119958164533173460512, -5308776508107485440, -10386407213243290752, 9252424998695722624], [-129468718571806724796222, 258295621694432025784440, -5660998605417465151020, 558957809414986944732, 407509880235353912583, 82857639766436863272, -3737737564322613780, 7015222983357032724], [696819840889686851862132836, -596956174637427467632747, 1378583680963582097614, -90859741953742706628, 652613939982309432404, 62065109610474234123, -5077441822198523544, -5077441822198523544], [-870800726827969500627024990, 532638417130215618715116, -1314034456757395166104, -393521849549454593416, -740850098810932352496, 57382703241091353244, 5290033438228683240, 5290033438228683240], [-37974181280115222006130, 77367046657859185767308, 11652380640899710924909, -1239372416194307705496, -344123657552809727062, -179311681434434049552, -2766982632198371384, -5269784615576880456], [963804523456370518675891940, 502971624111926065992941, -1106986487688814648674, 322019840051111146284, -487282752174045778316, -40220549229604745021, -5197988488151360200, -5197988488151360200], [-503957134763700172518758, 1007568364534892777869172, -12640044119038631444245, 308964713294525805928, 1082979808782079497514, 36940279213041362416, 20152766509739020232, -16794252934412089672], [-1053895220519997324572573500, -445687068435357971306419, 902512716359459027038, -550906134979003876596, 397928898629670243956, -100125402622107456957, 30690572434433345304, 30690572434433345304], [-289648475050028564625038, 580289174135660435945380, -13643788913527698811713, -866616889781987375544, 436511009299803116130, -125607145821319319760, -1369197225670747864, -4211043655749287592], [-1685798925551372151679034270, -334302457722642938008628, 1201509931445863165608, 2324576310989537150008, 1143111917879688279184, -471834905628342894340, -14104409305682760408, -14104409305682760408], [-310535566967325504290562, 620648828981747875145948, 34660272121570400820081, 375469261900484946968, 278012265293017520886, 46835691002648488208, 19615140401471311800, -15873141627315176504], [915012574126663911781188674, -2980300796633784247505800, 6993226696917444914832, 329329733801358345840, 3568470329988010569376, -52810705309194521960, -3809255244018718000, -3809255244018718000], [-565725940341614839087626, 1129471665078185932911756, 54075444344556691995653, 1725305219479093669560, 807209340502834167838, 254910385564651593936, -9425728114219007016, 19689159824489162664], [633683288470276657456945730, 2754363616725804325008176, -6745987754491009899872, -1790118012778104765216, -3759358482729079582144, 275155700554571797488, 22241780985800566944, 22241780985800566944], [801903656915656719273554, -1605477463083350255660392, -20673050259111692244820, 1483454680276957496604, -765752987891723990729, 186694571759859616680, 73360560449400047404, -58864225985980059948], [587802343093913428924578314, 1815720952189507446084526, -4984920713847757070364, -4256679778897994219916, -3517543453461918980728, 954016099835389337486, 14213399340530221612, 14213399340530221612], [-1300792419624546333598376, 2603458357173224539204704, -76515695442854993510752, -1637194570593787028080, 2640743521203797477476, -236323353538084979872, -5021988327613886128, -5689634724269277008], [1359346303470117382147612388, -3201694219417118032987815, 7507762052804152553862, 438053982812574907140, 3896421167282305829124, -202588586656749234753, 12009689155303936512, 12009689155303936512], [1903013425907892519280317802, -1945127982584045855811722, 5338632097961914830420, 4116245945216803107172, 3485503695008605240936, -429144300070278823786, -77408669191473800388, -77408669191473800388], [-2255493336596127111537674, 4511038228763673776715116, 64567104210442727577341, -72307617685626412904, 3133945684941352728790, 20752046266072773136, -78442833600141359560, 72523980516045274952], [516110716508149619694274, -1022917385366427763024904, -42403260257567922449356, -8147323683660053608356, -2392660771015853185433, -1156723966211422755288, -73429493059943454868, 16751973393364773780], [11243052019098541784014328314, -250296197933576319452474, 786833709929478933876, 1700934896141624173684, 1027431381652940553832, -1013615986056919347754, 75920291873743652172, 75920291873743652172], [-1436678674193047347471350, 2860213707686451744143508, 48918788255394406289795, 11497167578765292238184, 4679381284155419460010, 1646473120877658561008, 68128590681455060936, 9381422459439229624], [-2630253894120980109558242, 5252774297958602613506248, -96736682363966999380132, 6706844542638768089124, 6975512325112579940473, 1026645740718837521112, -126231786553724798188, 159891880797698186220], [-10568269992312639174107669020, -1954564653860665632015727, 3406513665575995938070, -6232498905112099298028, 253659700612738451492, 1252274233806595323063, 39464579673732838896, 39464579673732838896], [-1303495335052894481460258, 2607759082180562587255716, 48454328505582743779763, -668871563858150751648, 1589282182823085342616, -99540510915473583552, 5450075490592998624, -9304004183388111072], [374540885374462632597392324, 10930384248473133635978041, -25137369168997686651834, 1132592022043749292644, -12474119722740256908028, 248313581427506137151, -68575688637218511008, -68575688637218511008], [17410730779047108156867585914, 1356861289491861627835222, -1529062233848016180396, 9171064772536130027028, 1479940086736114799912, -2156662131889378132570, -17561814354148951508, -17561814354148951508], [745001269737666165391795844, -295213602416190494576275, 1281120409521924103582, 3563480840862333565740, 1596666213343857100916, -1074716551068916244925, 23722108497204239160, 23722108497204239160], [650221075163775981870682, -1312977820959518261776052, -63028795927633609787791, 11074982989382618881536, 2384757888624699862912, 1460687642583679153152, 379935892501252826624, -283389830432288269824], [9126270923035528178604742, -18250166342548585336222012, 158417277488242508311187, -2044761657845875251248, -17725317127123702471724, -330741864625145736224, 82979309211395167376, -90143798176714967440], [-5777122001198507256534377884, 88817789700913667764685, 1636333838279144232670, 9794904028594584062700, 2977523362344638270708, -1633229963307648224733, -105225295979483585928, -105225295979483585928], [14064986618333929768275059972, 7650756797809261502269, -1219133043873012598530, -6161009278432273023924, -1873065614693679676876, 760311407573728144211, 100637537036689046680, 100637537036689046680], [-9813644580807360648603012, 19648780835468384287896720, 40954149784552221639096, -18763208202348048910392, 12086877170805402400338, -2728465651314941780304, -7241519781655930968, -112017118952181183912], [2460880403746506041260626, -4942880257532024108056040, -324759985558828909744884, 18469056510543595027612, 3471003591718927314327, 2650393528468430507176, 95652734039534373036, 27899396245139507540], [-15139808630093618275319159356, 19816626516861844463999609, -46141648429330709081274, 397487315792642228676, -22688257368661932959612, -897466877012987078945, 102980006201913099584, 102980006201913099584], [4337942031423717561088470, -8679917774931971719955052, 367041108803147592602967, 3393038588442226301760, -10728464869233201039408, 640673496094371476352, -368040076964118862272, 363891961406124677568], [5858152436624330867687214, -11696638530937352100520728, -713493852034694203806668, -17314543166063421682332, -7040282393252792254999, -2351799145246213171368, -423019490008841549484, 283983049779976494252], [22069913946073840765498036, -44158407706239670756379088, -118946057567217397308280, 16102145991539008526936, -33216243515033105580746, 2477668100450216856080, -335273048662493129224, 413843570537503155208], [48437515065940012844921785412, 19730077373844767103184401, -49080336821263543062762, -18246554988961169406636, -29094417058028114916060, 4540812102225527081079, 2687309034163260720, 2687309034163260720], [-54994678002526016105428390718, 20797384372822790314560844, -48757393089985393113816, -3182439757376863912424, -25546289047086785758448, 1843924434366585971420, -135266386454499353976, -135266386454499353976], [28604701755211631802572739194, -13735843432971357933227978, 34873807791375029807508, 16833001527694248451668, 21680633576437661544872, -4308237496798482146938, 12901563209667101164, 12901563209667101164], [60669620291136822478590403076, -2926937648585457478442323, 11536376844585799270174, 26699813109620961664428, 12314886099241110470516, -6313505676117247961469, -46638400166192574792, -46638400166192574792], [-19618686119348273987844410, 39250920438024496417152612, -336353908755550935904069, -11579623537783102777744, 35028092005968295171132, -1968575790165338686048, 709581483763684896944, -733468997791422674864], [-44249624065941559521501044060, -16623978816666731368381691, 35584151913040233598446, -12630457554507185598884, 16580241707518221706900, -2325947823043380012037, 707556414409055020872, 707556414409055020872], [-45704774150830395389064334846, -27602685926350120289070676, 58644101529895333078120, -33575989219163085075624, 20191910884044854438288, 10468580928379249976892, -267688209495287575224, -267688209495287575224], [-7031061899962365820296090, 14056772652579247123835436, 93469168699905678576573, 5070091336620269887800, 13155179887076778833982, 281056008864246868944, 1146115100662146065496, -1034233091523513935064], [93218165617582217202118754020, -7344350215552146168143891, 9230482209552995069214, -38319832885007382760244, -2395391772378873052172, 2339132251525415853539, 934300125125990946648, 934300125125990946648], [-24884690899468976155468982, 49853669618620885000562808, 1785299621858529064906892, -74248626349078234437268, 5696010239639428860235, -10039193333854455187576, -1928981893330086863812, 1324757670699016041412], [35921470916295044887171846, -71894434650428911786831844, 468201565745715887395193, 45298596652129356446952, -55296672996166692996278, 6194221186692656041200, 1002869452405326091592, -646349448426921386184], [-139776260993917657694658058012, 32848352729959175428437717, -70550219444560532782002, 31667954604058733864508, -28030896669018548576940, -6020984693710871173941, -244645671910169328024, -244645671910169328024], [37561315181825772168378022, -75106494059710606868069048, -530087627318823272526668, -13979843793213718992588, -62083278445543110742435, -2156460147723749694408, 304512636451379601380, -371792413617509622756], [-2586357124182773519804901148, -13972396112697603429188587, 32015105310485565015630, 2452576126157194693212, 18661090515524852252116, -6363344821632562600661, 741961392270098571272, 741961392270098571272], [-29174801165656704350718506654, -19360632455182190988993044, 47136413298198045244008, 20581663294882241943544, 32061933113611090301968, -14581563993223898941924, 1217567505742366252392, 1217567505742366252392], [-23909390273847984797159238, 47788154415137923443280796, 1559772940029256272509253, 26512714875884733321872, 30664519314212177952516, 4113417682161417715808, -636945264065954487216, 760402966415063562928], [-3088639793626418549436560, 6148128391906588698061600, -2044236979341796189406920, 26191703028420611691264, 34061707096087701638752, 2959492317827789120256, 2139831483125133141248, -1825085601208695949824], [-167244337810090044309485791900, -128712364218173882445073055, 290211649812826051464822, -60712197048325639163340, 126545534161430872782308, 24709820713892595057863, -1229905993782088421552, -1229905993782088421552], [263516220787580051687830424130, -76079302848002181116823336, 192933845857877164712144, 84325194068587220011376, 114743195227813688813088, -13176224629290200010056, -1020009533916981289392, -1020009533916981289392], [-38299516608380391134251270, 76687134855278166591733412, -756453894664725842497865, -76969348343352384905256, 55635395806183649054054, -11132290174031938325616, -180843879366009482120, -318894291623727791352], [52888694752780644748293194, -105781573927835786256789448, 3065110896909572051327420, 2963089418101610150700, -123278759740343308645637, 1221332856395150052360, -1981262455461851981060, 1862080192221480071940], [56700141817249818033579178, -113500979687936244826783252, -1292763643821201429182455, 87597365096629095118144, -64455102421749777476528, 13098688339979664506752, -870688261814568323008, 1364484427742852143040], [-13694950808464399106576828, 27434408206942671535075600, 3254621999686926705077968, -39299901346458777400488, -20098866849700108089130, -5206688667414544521456, -1289538436778632473352, 951026891518988583432], [-734217590107781208502, -46972303152700606925800, 7529836278564860253862996, 43204128976477511897868, -65627430621906761229037, 5236609356438657444936, 2639852192724998370652, -2182621160468969927772], [228895187270709463851185038906, 197169943678741155233143414, -458514650389921504033260, 11326289212492788874516, -222017082215439971660888, -15256007845698204241402, 1603152973235484777132, 1603152973235484777132], [-196428880388196664582552050166, 339754262239145096696660942, -767654491428340467215196, 99531377013820038625908, -370300241295088676094968, 7119977097961082748910, -4129396303408528052308, -4129396303408528052308], [-343743221038883172766571618588, -155233901854557397415573495, 377398012344273928523430, 93239174562776554900420, 211846827725445821739460, -22853326848971982482545, -58898940867374999040, -58898940867374999040], [-5177473521200167164178174, 10374706632242829582764708, -3371389548561451215002769, -18911296372637483186328, 35673385180434799793130, -848293469857771222032, -4776657910049750161976, 4324414027877694877368], [-207544325007915156770658377950, -141044532895672898371627492, 339541948276488011512840, 91792435224599202137112, 202903232474928522300752, -51648893846747636562612, 3703327102012624003656, 3703327102012624003656], [220397972778584941795660358, -440664873659376496996176440, -7641500398189599974683724, -112713807994190993338636, -322343906575851688956979, -18358089799195601805640, 4891438165182733944484, -5264273533392739766948], [-109581477142394058565545446, 219247883669527027420203820, -4905944434394181619390999, -73095703194473439424416, 224178656711111430742360, -11833681544436849688512, 2992389056319573714656, -3246689205528169465056], [223589064380816714647991510810, -206953291449656270888757250, 554846972684340785703172, 390695665959462142760580, 363438667747585501971848, -64817481251868878993202, -4239540030709246025412, -4239540030709246025412], [-78236233724715204157148670, 156038149664515758903586968, 4741232585605591669391612, 377178528773927429431164, 168720504365067161183119, 57139256140721981279208, -5601528705297494685684, 7598754737042146507764], [-136489569014699060024743608, 273719323873269101723123808, 736925257010932005533232, -648590126882556599580048, 71318913691949529862236, -91595716988425074056544, -7070629113137144276304, 2473369321193693728080], [557370954501931529929027172804, 392131632699246898655913709, -964387664163112364164194, -267845352252052235634324, -536615169444726314988172, 31621336090728449265155, 4560000254488336728184, 4560000254488336728184]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_4_b_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_4_21_b_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_4_21_b_b(:prec:=8)
    chi := MakeCharacter_4_b();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 21));
    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_4_21_b_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_4_21_b_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_4_b();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,21,sign)));
    Vf := Kernel([<3,R![160082421395847259122443877040709959680, 0, 218704749556493020583134494720, 0, 103630072300175425536, 0, 19152818688, 0, 1]>],Snew);
    return Vf;
end function;