
// Make newform 14.12.c.b in Magma, downloaded from the LMFDB on 14 May 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_14_c();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_14_c_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_14_12_c_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_14_12_c_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 := [3039499286293024324, -4732823471679688, 267736482219682, 408905884576, 20557200983, 5578711, 149344, -1, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0], [0, 2, 0, 0, 0, 0, 0, 0], [-261959263537250221493613159712766844, -8968490297199261493238481427512776, -450216271942383165233821223326560, -798481013014520440296578811936, -3125365729265160241831479801, -4918634136858061026739296, -21209640790858534949472, -35869944812371155025], [-875507290830842081809384533700, 45777575111378069135800018696, -5100811115489544633439898, 3497549540077942970448320, 490608600836399435497, 23490439374665485202, -3519857957118208, 170605955991169], [72568010064580969948258637038469208235937168, -501030786210071012943051817184728141130744, 5907046974866076547412054979345174267960, 10476442426361352652437663684948916776, 51533380896120194140529312736306615, 64534768530797825143586472412536, 278280356085554103425660348152, 763941504366608166441475775], [-17748388865676875203818500100565898161683860, 558002197074193522845579893423897107957768, -5990869670462917018654298980099656828064, 40784175391277837937658617892269179920, -43471107176511096153811631885610259, 321488533363149087523466821182160, -400401774324977752442646550064, 2039661842683272150115872837], [270471975097904231977109463827092632346198848, 3571728299655536862334961072832998258100256, 17704791230277567491200670294540088987220, -50766387194063743827193878880910428144, 116188754641682762680813509581326435, -415854448090089161117961525328564, 908160239736686654710771347952, -4394527928097847786955155445], [150490056442413630132422354693154261872888540, -35027331419216752639380198650985741298989584, -140312460486311194111287830851831301826168, -2189654265267293270918372381476692999720, -1336549739362583494409031335145491913, -15884190517755518156474531764291080, -5362809594472693060136045373848, -102821913213394545663127073281]];
    Rf_basisdens := [1, 1, 5268942910182758497766390676503115204, 21155364383529730361485658754, 11076070703334184470661776972106191460980, 11076070703334184470661776972106191460980, 11076070703334184470661776972106191460980, 77532494923339291294632438804743340226860];
    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_14_c();"
function MakeCharacter_14_c()
    N := 14;
    order := 3;
    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_14_c_Hecke();"
function MakeCharacter_14_c_Hecke(Kf)
    N := 14;
    order := 3;
    char_gens := [3];
    char_values := [[0, 0, -1, 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 := 12;
    raw_aps := [[0, 0, 32, 0, 0, 0, 0, 0], [-67, 1, 67, 0, 0, 0, 0, 0], [0, 0, 952, 0, 0, -1, 0, 0], [12827, 8, 1939, 32, 1, -1, -1, 0], [229938, 189, -229942, 0, -3, -2, -8, 2], [124940, -519, -14, 519, -123, -130, -35, -28], [336257, -5757, -336299, 0, 226, -21, -84, 21], [-56, 0, -5388298, -873, -28, -833, 28, 140], [22, 0, 18118944, -17136, 11, -2998, -11, -55], [26785510, -176631, 1226, 176631, 4811, 5424, 3065, 2452], [-48578741, -19080, 48580071, 0, -2076, 665, 2660, -665], [-2238, 0, 42323890, -1116339, -1119, -14340, 1119, 5595], [-413703884, -615729, 574, 615729, 59507, 59794, 1435, 1148], [106296798, -26082, -4796, 26082, 16112, 13714, -11990, -9592], [6202, 0, 555230677, -1463628, 3101, 43537, -3101, -15505], [-1796092730, -538755, 1796099716, 0, -285985, 3493, 13972, -3493], [1748082751, 2660199, -1748032771, 0, 399086, 24990, 99960, -24990], [9310, 0, -1624036704, -9818493, 4655, -116604, -4655, -23275], [-4668058747, 5621511, 4668054791, 0, 259148, -1978, -7912, 1978], [2907905532, -9710526, -23548, 9710526, -689262, -701036, -58870, -47096], [931178385, 2964366, -931378221, 0, -759764, -99918, -399672, 99918], [-259574, 0, 3061686078, 12144258, -129787, 2676870, 129787, 648935], [39607246566, -29504256, 215768, 29504256, -300714, -192830, 539420, 431536], [157780, 0, -17808821033, -15044574, 78890, -517244, -78890, -394450], [86074662586, -86137617, 476518, 86137617, 4608085, 4846344, 1191295, 953036], [13418799366, -48691398, -13420094450, 0, -7830051, -647542, -2590168, 647542], [-112630, 0, -60251636076, 153656394, -56315, -8878180, 56315, 281575], [421180, 0, 12574925044, -209946471, 210590, -1435589, -210590, -1052950], [-92546453338, 84956172, 92545326938, 0, 11270513, -563200, -2252800, 563200], [-50894301474, 158137203, -2778626, -158137203, 15415245, 14025932, -6946565, -5557252], [-15228861444, 295489278, 5084924, -295489278, -7879666, -5337204, 12712310, 10169848], [2151352, 0, -117842815207, 171833337, 1075676, 5921814, -1075676, -5378380], [-107404822173, -753709215, 107403539935, 0, 35576064, -641119, -2564476, 641119], [-199007307618, -208132764, 11196864, 208132764, -6211918, -613486, 27992160, 22393728], [-2127416, 0, 163526197996, -1436994636, -1063708, 35191423, 1063708, 5318540], [-117484492811, 247967874, 117485052961, 0, -105939438, 280075, 1120300, -280075], [-282355763726, 458898435, 282353808668, 0, 145471287, -977529, -3910116, 977529], [-6481484, 0, -289995506983, -1241208297, -3240742, -26532992, 3240742, 16203710], [-277905152555, -2114034912, -7261492, 2114034912, -117193189, -120823935, -18153730, -14522984], [4048646, 0, -190527818382, 73585563, 2024323, 308333674, -2024323, -10121615], [1757193966308, 868645659, -1757171462668, 0, 72833371, 11251820, 45007280, -11251820], [-316279984908, -4753632186, 87332, 4753632186, 21563084, 21606750, 218330, 174664], [28814930, 0, 930529457, 1175291712, 14407465, -223650799, -14407465, -72037325], [3828795874515, 3106645731, -3828796428053, 0, 283801972, -276769, -1107076, 276769], [2887541260610, -1259955207, 11270362, 1259955207, 401284663, 406919844, 28175905, 22540724], [-3518006101171, 3431259192, 3517974087525, 0, 70695806, -16006823, -64027292, 16006823], [871212878958, 2448706932, -24896960, -2448706932, 540406922, 527958442, -62242400, -49793920], [-1591991556352, 13784922762, -35303772, -13784922762, -107948370, -125600256, -88259430, -70607544], [723142557320, 5267183325, -723138562924, 0, -607924997, 1997198, 7988792, -1997198], [33294688, 0, 3192260635450, 10556088252, 16647344, -408529063, -16647344, -83236720], [47407766, 0, 7780472021773, 2378321967, 23703883, -643588995, -23703883, -118519415], [4358516432631, 17535392112, 56604804, -17535392112, 657769617, 686072019, 141512010, 113209608], [-942568767391, -20051570268, 942628153431, 0, -390668632, 29693020, 118772080, -29693020], [3604788659511, -10921916832, -87525228, 10921916832, -119993115, -163755729, -218813070, -175050456], [138853778, 0, -4143214223167, 38220924585, 69426889, -44568493, -69426889, -347134445], [1502877191860, -40222406322, -1503044399618, 0, 133210865, -83603879, -334415516, 83603879], [9788690323290, -1172610405, -9788800644620, 0, -795536865, -55160665, -220642660, 55160665], [71277262, 0, -26563542715410, 1674001908, 35638631, 1651567884, -35638631, -178193155], [2695740076250, -19128902331, -2695933038960, 0, -2225135581, -96481355, -385925420, 96481355], [13861688738890, -16131647469, -100852242, 16131647469, 264329945, 213903824, -252130605, -201704484], [-16255625182778, 46200695349, 16255472155750, 0, -397177071, -76513514, -306054056, 76513514], [6982890782354, -20904248772, 213231368, 20904248772, -1904250080, -1797634396, 533078420, 426462736], [42877086911622, 55653786822, 290750292, -55653786822, 1576991480, 1722366626, 726875730, 581500584], [-27367094287392, 25018609824, 27367853563798, 0, 171661113, 379638203, 1518552812, -379638203], [-513303868, 0, -35225281978759, 5089535238, -256651934, 1710387030, 256651934, 1283259670], [-104069194, 0, -35648656614958, 29241178827, -52034597, 2037362498, 52034597, 260172985], [152331124, 0, 14762382298811, 94992030399, 76165562, -4845783518, -76165562, -380827810], [-29004234618672, 36877351455, -202266994, -36877351455, 5611807679, 5510674182, -505667485, -404533988], [26719669107099, -96813178413, -26718998907927, 0, 8430292242, 335099586, 1340398344, -335099586], [-43715140314818, -95807199831, -122542742, 95807199831, -675014285, -736285656, -306356855, -245085484], [38038487101287, -47340177201, -38038421593089, 0, 9987227088, 32754099, 131016396, -32754099], [1005145994, 0, -12180035220597, -71431886316, 502572997, 10824732319, -502572997, -2512864985], [7266525924226, -46285627308, -7265459984596, 0, 3862131963, 532969815, 2131879260, -532969815], [-1858455638, 0, -29377400607872, -104804451843, -929227819, -6533110450, 929227819, 4646139095], [-19285810154379, 170175495672, 1293070476, -170175495672, 14480191295, 15126726533, 3232676190, 2586140952], [-1405153106, 0, 91803270979473, 41899092222, -702576553, -1200695797, 702576553, 3512882765], [141011137187210, -83707125138, -141012165330558, 0, 8581695193, -514071674, -2056286696, 514071674], [-1614524380, 0, 104303028225448, 178738533630, -807262190, 6958453357, 807262190, 4036310950], [1642584866, 0, -59096879875903, 120484886697, 821292433, 17682437915, -821292433, -4106462165], [191614930110835, 218765937621, -191614163722681, 0, -9317122152, 383194077, 1532776308, -383194077], [-266953325993150, 14867339226, -943076372, -14867339226, -8293369912, -8764908098, -2357690930, -1886152744], [-34663836820332, -129910985715, 1133595962, 129910985715, -17320051423, -16753253442, 2833989905, 2267191924], [145335633339335, 3679488582, -145335221642617, 0, 7773095044, 205848359, 823393436, -205848359], [-44605156243194, -88952370561, 1936497430, 88952370561, 2252542601, 3220791316, 4841243575, 3872994860], [-843781638, 0, -33742246349521, 190214890524, -421890819, 19263786731, 421890819, 2109454095], [-3728112296, 0, -298629734442876, -217805932113, -1864056148, 3726740981, 1864056148, 9320280740], [97607358975616, -7379055705, 871986974, 7379055705, -2556899881, -2120906394, 2179967435, 1743973948], [5975076772, 0, 256178530309441, 238894706526, 2987538386, 5871105086, -2987538386, -14937691930], [-78626747141010, 124664710173, 2421756274, -124664710173, -2535772017, -1324893880, 6054390685, 4843512548], [1144627965532, 184109432724, -4968106088, -184109432724, -2184464816, -4668517860, -12420265220, -9936212176], [1656946284, 0, -59552079182291, 107281565427, 828473142, -58978442200, -828473142, -4142365710], [-113076278190542, -508984255818, 113072928781584, 0, 13678327175, -1674704479, -6698817916, 1674704479], [-148381958034928, 434337893430, 148377465912354, 0, -14565188419, -2246061287, -8984245148, 2246061287], [-332980853961867, -455773619616, 1675227228, 455773619616, 51457741383, 52295354997, 4188068070, 3350454456], [933871380, 0, 158638056917745, -1550623655217, 466935690, 10878559480, -466935690, -2334678450], [236216445894436, -5231686194, 1880386396, 5231686194, -27637747426, -26697554228, 4700965990, 3760772792], [-9637406884, 0, -15167892783634, -254503537098, -4818703442, 50329698671, 4818703442, 24093517210], [-11766652226457, -13777544322, 11776285475397, 0, -26103147246, 4816624470, 19266497880, -4816624470], [4222942724, 0, -713158310005308, 167726243085, 2111471362, -45841817161, -2111471362, -10557356810], [-8065377868, 0, 404364172565578, 1548412825722, -4032688934, 104777682559, 4032688934, 20163444670], [476558907488303, 1427026675536, -371827532, -1427026675536, 13325944725, 13140030959, -929568830, -743655064], [786722038532574, -873800369652, -786739966445630, 0, -74675262231, -8963956528, -35855826112, 8963956528], [550447603545053, -639019957185, -550457183287505, 0, -146196834524, -4789871226, -19159484904, 4789871226], [-4939726516, 0, -818380435667779, 1979058875010, -2469863258, -6109478122, 2469863258, 12349316290], [173290956559954, 757587117777, -173292998878014, 0, -138640186875, -1021159030, -4084636120, 1021159030], [-365654135901463, -2260993877304, 365651567380487, 0, 86473428440, -1284260488, -5137041952, 1284260488], [-428771437262686, -1793328011538, -5197766252, 1793328011538, 49969057276, 47370174150, -12994415630, -10395532504], [14447418538, 0, 644337404685055, -1418505560079, 7223709269, -41955443171, -7223709269, -36118546345], [867114255246904, 1231890753744, -867108296122658, 0, 248844172817, 2979562123, 11918248492, -2979562123], [292817275904050, -133700928897, -6854771770, 133700928897, -162740172299, -166167558184, -17136929425, -13709543540], [1823094854, 0, -1352027206200431, 828976909338, 911547427, -7537462481, -911547427, -4557737135], [584247928623480, 1008034032810, -584232779464012, 0, 201629034367, 7574579734, 30298318936, -7574579734], [448831127910472, 3313181303187, -5071748010, -3313181303187, 24102913163, 21567039158, -12679370025, -10143496020], [-2325349787437009, 899363120601, 2325360958898177, 0, -66835574950, 5585730584, 22342922336, -5585730584], [-1025798302215708, -1121808121686, 38938591924, 1121808121686, -96302945422, -76833649460, 97346479810, 77877183848], [1080809499426329, 1224063469860, -1080797001496241, 0, 59924709040, 6248965044, 24995860176, -6248965044], [1705227815086670, -227020834026, 10369597140, 227020834026, 145706387952, 150891186522, 25923992850, 20739194280], [1254126903582984, -4165253584920, -1254140330368146, 0, 16175954913, -6713392581, -26853570324, 6713392581], [23015196294, 0, -458142281691282, -485131346637, 11507598147, -180470801418, -11507598147, -57537990735], [304236102660038, -715963706640, -29097577352, 715963706640, -328924614362, -343473403038, -72743943380, -58195154704], [-2264087830547700, 2919874763301, 2264086217389398, 0, 142535951653, -806579151, -3226316604, 806579151], [2003639195474508, 1342115254851, 8900396998, -1342115254851, 46250944991, 50701143490, 22250992495, 17800793996], [-21932777384, 0, 1705559882509330, -5864796188088, -10966388692, -139246125851, 10966388692, 54831943460], [-15647190160022, -4076876886621, 15642620302654, 0, -428973134311, -2284928684, -9139714736, 2284928684], [-40555672640, 0, -4035194874648751, -1692138790059, -20277836320, -21085229654, 20277836320, 101389181600], [734022244507330, -6260938892208, 29707127792, 6260938892208, -300149949388, -285296385492, 74267819480, 59414255584], [12168759538, 0, 1474572446585834, -5339797233435, 6084379769, 59695664956, -6084379769, -30421898845], [65855557278, 0, 1618746540930126, -594316440132, 32927778639, -449783139420, -32927778639, -164638893195], [3599774708851956, 5199833995374, -20683933284, -5199833995374, -419793521170, -430135487812, -51709833210, -41367866568], [33404215502, 0, -2458465506977150, 5663184197127, 16702107751, 628778158294, -16702107751, -83510538755], [-912500030355428, 4475575424901, 912460490045376, 0, 146377568223, -19770155026, -79080620104, 19770155026], [-1288801679842000, -2700785039358, -48851659660, 2700785039358, -46841942978, -71267772808, -122129149150, -97703319320], [-24759283294, 0, 2074538315880181, 427324466856, -12379641647, 336728218093, 12379641647, 61898208235], [1251916326556406, 5650830173373, -40327347278, -5650830173373, -56528097537, -76691771176, -100818368195, -80654694556], [-50678248362, 0, 3374066021621363, 2627163007899, -25339124181, 333268599979, 25339124181, 126695620905], [-1938659540792156, -3355977869937, -44329700450, 3355977869937, -143526453173, -165691303398, -110824251125, -88659400900], [-466987839881074, -6483478279962, 467069039411934, 0, 393670633549, 40599765430, 162399061720, -40599765430], [-2108906200353759, -19008607768503, 2108856054318575, 0, 456117567172, -25073017592, -100292070368, 25073017592], [3644384200441122, -9134619426663, 31715466426, 9134619426663, 308266351167, 324124084380, 79288666065, 63430932852], [-5056871389233347, 2003348279730, 5056884817713503, 0, 68783904560, 6714240078, 26856960312, -6714240078], [5313697404954342, -10012926368406, 111308441244, 10012926368406, 664065039788, 719719260410, 278271103110, 222616882488], [-21231997224, 0, -3202724852982982, -592192703088, -10615998612, -351634369379, 10615998612, 53079993060], [1431689836650928, -13491501274440, -1431681449869514, 0, -566352521319, 4193390707, 16773562828, -4193390707], [-9408352737635414, 16894582683678, -20749865900, -16894582683678, -371106461644, -381481394594, -51874664750, -41499731800], [-2948479764324878, 17057919087468, 2948495102055790, 0, -252895463379, 7668865456, 30675461824, -7668865456], [7120094847779132, 14188068831660, 56195389096, -14188068831660, 5285942944, 33383637492, 140488472740, 112390778192], [-4499661096023956, -1075643090511, -142686776190, 1075643090511, 785557130661, 714213742566, -356716940475, -285373552380], [-198300196448243, 57094334922, 198180010196911, 0, 1048637241152, -60093125666, -240372502664, 60093125666], [24747379216, 0, -8606012163613312, -2935464627165, 12373689608, -44530509131, -12373689608, -61868448040], [83995240858, 0, 3439737655355918, 6276142943490, 41997620429, 665937516894, -41997620429, -209988102145], [90701543236, 0, -7140700536608546, 8599418694930, 45350771618, 484301964203, -45350771618, -226753858090], [-5305509651287008, -15034248543786, -79453264156, 15034248543786, -1546202465708, -1585929097786, -198633160390, -158906528312], [14299573307245290, 2455646582340, -54887944208, -2455646582340, -384221910658, -411665882762, -137219860520, -109775888416], [50404702782, 0, 2204240819836779, -26947498790346, 25202351391, 367515851181, -25202351391, -126011756955], [-160744534934325, -8020165542585, 160787371391825, 0, -1194417131030, 21418228750, 85672915000, -21418228750], [-7724175221689572, -1696800972972, -30391510440, 1696800972972, 188923538544, 173727783324, -75978776100, -60783020880], [-18579188982, 0, 12966089395975959, -14506936084956, -9289594491, -703588463381, 9289594491, 46447972455], [-233715463184, 0, 12437605989676255, 35284174262028, -116857731592, -724207823810, 116857731592, 584288657960], [-24444244453190494, -19468020168516, 840444024, 19468020168516, -322698699444, -322278477432, 2101110060, 1680888048], [13578558402818816, 17182049799759, -13578457226105346, 0, -2982334759283, 50588356735, 202353426940, -50588356735], [-93647621344, 0, -4467554255370423, -20751403042923, -46823810672, 591992467858, 46823810672, 234119053360], [-2021562301397622, 9321893072247, 139279974614, -9321893072247, 2493441052677, 2563081039984, 348199936535, 278559949228], [7533298857254224, 7119320203506, 155559944852, -7119320203506, -1107678065234, -1029898092808, 388899862130, 311119889704], [283961118868, 0, 11215963990179547, -3701641030065, 141980559434, 1484217784690, -141980559434, -709902797170], [-96316453054225, 8438034150063, 96215535414023, 0, 993359272648, -50458820101, -201835280404, 50458820101], [-15350234035599703, 9866745609522, 15350009695773629, 0, 3128403093190, -112169913037, -448679652148, 112169913037], [6173132100237966, 23858749964742, -6173062563228380, 0, 2547474938083, 34768504793, 139074019172, -34768504793], [-14597239900362992, 25300173519393, 14597248129921994, 0, 202075099713, 4114779501, 16459118004, -4114779501]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_14_c_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_14_12_c_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_14_12_c_b(:prec:=8)
    chi := MakeCharacter_14_c();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 12));
    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_14_12_c_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_14_12_c_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_14_c();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,12,sign)));
    Vf := Kernel([<3,R![565371017311134650625, -2391762946776893550, 23691353797437804, 44770693165380, 328837501557, 49334964, 641596, 266, 1]>],Snew);
    return Vf;
end function;