
// Make newform 18.12.c.b in Magma, downloaded from the LMFDB on 30 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_18_c();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_18_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_18_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_18_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 := [1996943090208352847168412, -7012917435025539772518, 7014772917042471764113, -3711142402522175502, 1856017130395912051, -535135932093058, 178413594963643, -29958794506, 7490763955, -710230, 142057, -6, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-1759380402396462292405413894890233102784856, -223588056940024875941391373550324092090128, 201766505463406625795386532881019504425, -134554332686445802540728069987328840999, 64996943332791880594428757353656489, -26005531573051601913868620590175018, 6754469785739916990029717365180, -1930176871052978123125146090962, 246274878330939797181191811, -54732469796862370457314513, 2831433992115983563133, -514806180384724284206], [-17165834991790284243873649912138168742436443302532082, 229571973813548077036070955853590633535769831610819, -36323446921179069322781360299159751266409141006600, 63320325820617963643232106632698547904018435497, -7755105953678072615381368260436017829246681252, -29405307739050340141027175505757742383131, -568673212181237689141350854677762635834005, -566910880358722893674554896234666942494, -15826632686453242519653230378542373373, -24225650225939612587319462367302626, -146614039205797362155784451678249, -271340372338199794979837009312], [-23812829734933663022149610148837601482916813362018, -923623150105860819621636142262308152047275204719, -5046982794422009011631377509883541325857944100, -180188296519090604397392175953932103050424797, 2507696895872964595395676757269242923846702, 5790823686922252776899199372536224644906, 385484410090018998580066809466847719555, 2323959576180877054647080170778720944, 13926507835863438809801824682213673, 93094417987600281419697183224876, 146891119923916185160688964899, 1018536891645167170078591087], [216616673719780256627527297362536970290166377175286304664, 6185591259174396220590377110063607718907998815240216502, -2925710542693499351641156552705520196751095260164174175, 2018355323964089061896598054370836034263979763207881, -673989940596279777132311853186549457561464187093061, 127556319088175559005401982465172761200104800072, -50886628661161482124956788351308050396776610850, -3175112930232035638809391356263933755900282, -1438524443396111196830621762988413256242339, -285783133704758082784778418455339976983, -13461273664478204967445713638521765727, -3836702357749005026823408968784846], [-25446374818428779074251356501731051800232430614972687560, 4876352166015211561924698198459229133564329463611738311, 121130106365240221109593752288043440028662577967895290, -351136814008355893460749594689148020523664700293760, 28783553745052085884406129897755454728663631333589, -226097845271361445548779330652920033267800955236, 2210944888130319969914835088453853669250496761, -19489150277316428517600978074621700045568428, 63333030926478520022128358796824789099401, -571685032196118561246284842123433906919, 599593894536319191484667773347832920, -5426492031723705366647192422824143], [-268061942949586776834466815232272755173376494986383675922, 1951994704434711283492959597262087060024123388198315913, -400231892541598759152380074769680251859263534417988495, 506949330728378203746022126660893741597478676774072, -93270191076237765914827075102566767928187548540841, 11513585908878654364489254484832207684926947865, -7831408371490668447182795513706723103759343951, -3320871704388189319500462204186562989495416, -236166274691340558655510609633823281337824, -157198955850318304650408829611239708467, -2296936142752978981120660904704012204, -1832953002591031100411433327757854], [-1352696836038079432226836786172324023179085546823912364, -7375201237763597873915995908509817859045610925586017, -3089098699790943317435044845023583591056629598248175, -1488574517597125692983325423631746473427595630381, -679104672648846308268119920907356725338058034324, 250491587196655282614932233103384725924471218, -51025522716625013180373608728709188046325365, 42587073819572365248333990292231351698652, -1442949548462519353769532746499816099876, 1529768450041373249084424597175569668, -13522013669197399358349484816869523, 15911178061922831474272135805041], [-600473083663136539872032428136768707912724536043311188, 37744922617755252831199764088565195098508045660371236, 642451564025498389184781332176645086707712613368175, 6411859326135257022628519479480734531562081247073, 290157879417281323471041068711602702644949737317, -363493893383749466623704903679488797626320894, 30134357404287917675864105604607770070481020, -98424999811239926534027785109773215152066, 986010141009540445640793196411704700533, -3778264390334200123890780121118550169, 10012337195527019417116501905250409, -40481193390804290857114964535278], [806422068058086950465432268707067857555412764269647182052, -90844972196131156171518315913169540488791734997168489204, 820402237389406303819647008333591184373627239487634125, -28552982734084479184937368659932593654875968585598567, 213587780774792502690755525990428619836141052599317, -3396678272364620489542830883076152001813260573514, 20735603298574376005878154488859192543797622860, -209722205268946599960618062277913266817551606, 673148344825803994102144961274573266841383, -5626550931446273072203100420576462646609, 6834736666110741897921322519397306889, -52044455504361216802596183706320358], [2109219788232047399664831434943783013904792333256748035228, -46123861807963968144554386044325668857093086626264232491, 178912568102362615783702245012469040499116419648449475, -61290323229501679125680803985551256924106240887372488, -329602432524940989202321184138300864118645336011077, -11648327403726112532343637186338792723263840150286, -43630519906495042510491273696498504413114021420, -791991142406249105621084470501202350380086729, -1502994651775691454799187099742773803945773, -21177534734229885337105962990804414693736, -15402692006801264635577722637889098329, -191935825504387616926815238366763132], [3756344336990021975813784814856147154957198667361869393518, 85059575198429460775605408715504080556954318400910747414, -18598803184774473216195359803401363234956898251008700, 124703017877562821903912158149598098864176974023765947, -715829503211837516324215564060296192620671659138247, 23863137511230917470288543779038233444400618850399, -90410287599749899402687162772402324104519539260, 1617994299414822621822599934760606423588022446, -3108061180473053623319456947550480942386578, 43040525608234037010727898571386931916169, -32100443256027013703575120270020201049, 387876173891718869951551298856121603]];
    Rf_basisdens := [1, 3742281610563936255729273723551697289084500, 19234947636715160114918510417772783568619487923250, 71505381549126989274790001553058674976280624250, 90365783997287822219887161942696537205374354263428500, 9036578399728782221988716194269653720537435426342850, 3012192799909594073996238731423217906845811808780950, 19234947636715160114918510417772783568619487923250, 38469895273430320229837020835545567137238975846500, 30121927999095940739962387314232179068458118087809500, 22591445999321955554971790485674134301343588565857125, 45182891998643911109943580971348268602687177131714250];
    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_18_c();"
function MakeCharacter_18_c()
    N := 18;
    order := 3;
    char_gens := [11];
    v := [2];
    // chi(gens[i]) = zeta^v[i]
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    F := CyclotomicField(order);
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),[F|F.1^e:e in v]);
    return MinimalBaseRingCharacter(chi);
end function;

// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_18_c_Hecke();"
function MakeCharacter_18_c_Hecke(Kf)
    N := 18;
    order := 3;
    char_gens := [11];
    char_values := [[-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    values := ConvertToHeckeField(char_values : pass_field := true, Kf := Kf); // the value of chi on the gens as elements in the Hecke field
    F := Universe(values);// the Hecke field
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),values);
    return chi;
end function;


function ExtendMultiplicatively(weight, aps, character)
    prec := NextPrime(NthPrime(#aps)) - 1; // we will able to figure out a_0 ... a_prec
    primes := PrimesUpTo(prec);
    prime_powers := primes;
    assert #primes eq #aps;
    log_prec := Floor(Log(prec)/Log(2)); // prec < 2^(log_prec+1)
    F := Universe(aps);
    FXY<X, Y> := PolynomialRing(F, 2);
    // 1/(1 - a_p T + p^(weight - 1) * char(p) T^2) = 1 + a_p T + a_{p^2} T^2 + ...
    R<T> := PowerSeriesRing(FXY : Precision := log_prec + 1);
    recursion := Coefficients(1/(1 - X*T + Y*T^2));
    coeffs := [F!0: i in [1..(prec+1)]];
    coeffs[1] := 1; //a_1
    for i := 1 to #primes do
        p := primes[i];
        coeffs[p] := aps[i];
        b := p^(weight - 1) * F!character(p);
        r := 2;
        p_power := p * p;
        //deals with powers of p
        while p_power le prec do
            Append(~prime_powers, p_power);
            coeffs[p_power] := Evaluate(recursion[r + 1], [aps[i], b]);
            p_power *:= p;
            r +:= 1;
        end while;    
    end for;
    Sort(~prime_powers);
    for pp in prime_powers do
        for k := 1 to Floor(prec/pp) do
            if GCD(k, pp) eq 1 then
                coeffs[pp*k] := coeffs[pp]*coeffs[k];
            end if;
        end for;
    end for;
    return coeffs;
end function;


function qexpCoeffs()
    // To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
    weight := 12;
    raw_aps := [[0, -32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-39, -77, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0], [684, 684, -1, -1, 0, 1, 0, 0, 0, 0, 0, 0], [27, 10272, -27, 13, -1, -1, 1, 0, 0, 1, 0, 0], [323, 24781, -313, 170, -13, -13, -7, 4, 3, -10, -3, 6], [-107621, -108362, -261, 2016, 0, -22, 0, -30, -3, 11, 0, 0], [-851719, -300, 961, 39, -112, 0, -20, 0, 2, 0, -21, -21], [585215, -3446, 3250, -7225, -595, 0, -162, 0, -25, 0, -21, -21], [6048743, 6055431, 33709, 15429, 0, 2660, -57, -686, 320, -109, -114, 57], [-248789, -24584866, 139136, -232669, -4060, -4060, 627, -2469, 915, 627, 0, 0], [-56753643, -56796449, -59791, 70159, 0, 8874, 483, -248, -448, -251, 966, -483], [132867976, -27461, -18802, -90391, 27391, 0, 5299, 1953, -3542, 0, 714, 714], [2109862, 1744419, -310096, 804531, 0, 69643, 1848, -8266, -2813, -2387, 3696, -1848], [-532365, 35656782, -160421, -945973, 37434, 37434, -6282, -9218, 15441, -7932, -1650, 3300], [-2050081, 85640974, 1999041, -1093389, -44775, -44775, 15967, -10708, -20916, 13153, -2814, 5628], [-560412244, -318611, -2425786, -3435925, -112715, 0, -35289, -37455, -18438, 0, 0, 0], [3122073910, 3117648885, -5357969, 7780280, 0, -309658, -13650, -32059, -73172, -41516, -27300, 13650], [5017709, -807257262, -9329940, -1709601, -541206, -541206, 41947, -30619, 171033, 51229, 9282, -18564], [-712031246, -705609455, 12696789, -6249738, 0, 573297, 2223, -30975, 124002, -117678, 4446, -2223], [-1622093902, -2456277, -11105138, -18342885, -415141, 0, 45610, -118632, -204106, 0, -25167, -25167], [-257282229, -1949360, 3381687, -2501335, 1603932, 0, -119594, 48666, -35986, 0, 3003, 3003], [13592369, -1501115147, 1415825, 21622968, -962930, -962930, -55494, 239284, -268824, -25563, 29931, -59862], [-44508682, -13188016412, 19690773, -46500378, -1375905, -1375905, -391895, -412915, 435261, -424004, -32109, 64218], [-25939388146, 37239513, -58217312, 51764853, 1005833, 0, -69125, -872859, 794390, 0, 57750, 57750], [59852443, 27708603446, -8458678, 80300118, 331273, 331273, -864269, 1112889, -897903, -1162007, -297738, 595476], [59918136, -58988920443, 7967962, 96173047, -3860867, -3860867, 958982, 944050, -1585350, 1007030, 48048, -96096], [-35431734033, -35504433665, -155351217, 57562943, 0, 5183655, -104412, 795364, -1588180, 108425, -208824, 104412], [-78982596901, -89117648, 189197186, -72127663, 4956775, 0, 1058652, 3055314, -1914129, 0, -31977, -31977], [62872896408, -97716947, 78949098, -208055449, 4614189, 0, 1089035, 1957365, -3099894, 0, 466488, 466488], [11556291505, 11571939576, -68849583, -120435038, 0, 5022567, 623019, 3094028, -472631, -976097, 1246038, -623019], [226798196290, -219365680, 364113936, -292419026, -20028450, 0, -4612164, 4059960, -2116282, 0, 330342, 330342], [-60359102208, -60498657651, 140064227, 575794958, 0, -31339229, -861147, -9821730, 432765, 400290, -1722294, 861147], [-751715979, 223906048248, 434595698, -690051106, 3137015, 3137015, 6615949, -8466925, 1344411, 7502263, 886314, -1772628], [-246643645756, -246711890627, -325047197, -154342702, 0, -26981138, -3465420, 5479667, -4604552, -221154, -6930840, 3465420], [-142002123699, -142400690862, -349799921, 846592522, 0, -13979836, -98208, -5684322, -5142429, -5942607, -196416, 98208], [503496311, 518955326703, -496539999, 263288124, -76793166, -76793166, -9211862, 4785506, 7367292, -10087307, -875445, 1750890], [-537343042214, -536689974536, 1263591443, -620861131, 0, 15778587, 5854212, -8654352, 17012454, 12591986, 11708424, -5854212], [584835137704, 1221402520, -742108792, 2862807248, 22270444, 0, -5130026, -16006482, 38155012, 0, 1526250, 1526250], [-142956986869, -143632137489, -1256222457, 765414563, 0, 133267161, 1111362, -5405750, -9535894, 16494029, 2222724, -1111362], [-1698052824, 255576050619, 1555205286, -985341405, 118995225, 118995225, -15201876, -8422470, -9080142, -15694914, -493038, 986076], [300920319656, 348737458, -128536624, 969369002, -34330586, 0, 42106932, 6604320, -2982000, 0, -103698, -103698], [2352771551994, 374787021, -333335644, 798058581, 114745849, 0, 11410617, 562275, 4939730, 0, 5977608, 5977608], [3553516977, 997591563408, -2155558811, 3147074959, -66595601, -66595601, 18511721, 30004906, -12084486, 20284295, 1772574, -3545148], [-2479181505292, -2480113662485, -374190828, 2419098925, 0, -11006937, -4910838, -20118322, -11887559, -34095665, -9821676, 4910838], [1219812672768, -2017285598, 5364704014, -690943792, -126018598, 0, -58137676, 58909488, 4562824, 0, 6610188, 6610188], [2185874550936, -150537343, -1568432462, -2064997097, -26693497, 0, -28809434, -26268516, -10125344, 0, -3625755, -3625755], [-1250676672988, -1254910063787, -7991393715, 4576311772, 0, 658582802, -1695606, -9150904, -71993147, 52312524, -3391212, 1695606], [-3247415407, 2072206749748, 5226614197, 345954047, -360253809, -360253809, -97419659, 28287618, -59198022, -107089025, -9669366, 19338732], [5504514307, -4813026555397, -3226357485, 5095630872, 337409565, 337409565, -153020317, 65941444, 18747183, -144817738, 8202579, -16405158], [-2866682979456, -2871319751906, -7770190963, 5906886751, 0, -1118618385, 3355170, 32635276, -90694882, 13836358, 6710340, -3355170], [-376055473317, 473730671, 6207104243, 7606003072, 222833611, 0, -17003285, 64812357, 70102256, 0, -16316895, -16316895], [1359486807753, 1362759194403, -609368643, -10959833685, 0, 269847984, -1256859, 240731862, -23406966, -214609827, -2513718, 1256859], [-957084918, 3049542687279, -3772013436, -5063450168, 1541739410, 1541739410, -30459812, -77851038, 118926294, -10078430, 20381382, -40762764], [1398269570085, -10142723692, 13021020614, -17275503269, 1199909917, 0, -228230096, 176353218, -183524071, 0, 16123065, 16123065], [-2931736630555, -2934124772259, -8913560256, -2277883720, 0, 611464326, -52304322, 70507732, -89257912, 83242628, -104608644, 52304322], [-5976422115, 8670541531257, 7926712861, -1135595180, -123259112, -123259112, -100270924, 31879924, -106621626, -152643961, -52373037, 104746074], [-1592002037828, 7158063063, -13801465738, 7346140017, -1202171753, 0, 32156531, -219430287, 139309678, 0, -19347846, -19347846], [-10594654087636, 8909599182, 1810968048, 28385071770, 1653223578, 0, 84065694, 18792690, 257552208, 0, -8252244, -8252244], [-990185002, -11497765478543, -11674550042, -12996367741, 860960919, 860960919, -98616098, -113406720, 330155532, -170369012, -71752914, 143505828], [-54659393112, 96762030468, 39049877828, -42639091804, -1084375600, -1084375600, -227364761, -385782898, 42686592, -245896154, -18531393, 37062786], [7354092561268, 7374842698969, 20642818559, -41981767102, 0, 108490137, 609399, 414465414, 226160337, -129171214, 1218798, -609399], [-6420609709396, -6421121587218, 27745332889, 31585248279, 0, 112052825, 25403532, -824044976, 277288922, 93857606, 50807064, -25403532], [-16387158897671, -8856685576, 18688154766, -6577167053, -1252656771, 0, 592959500, 441555006, -270220403, 0, 159425805, 159425805], [-33438881486455, -33464949166269, -45174470827, 31236604531, 0, -2848443146, 6229419, 340465990, -567974890, -477266707, 12458838, -6229419], [-6053316440, -15039647139349, 35951058828, 26101492114, -3312198394, -3312198394, 373228836, 286218292, -939490212, 393146580, 19917744, -39835488], [-41080166297, 41541247169120, 35792376112, -25741129739, 3317104246, 3317104246, -312898787, -219583093, -207490869, -363400061, -50501274, 101002548], [104162695858, -14192005295245, -58955302723, 96764074641, -8097875990, -8097875990, -73920590, 1068708699, -214112523, -20731328, 53189262, -106378524], [45470811208797, 45435998144785, -42693173060, 60828798072, 0, -1583782586, -90031530, -279956348, -558503740, -260942576, -180063060, 90031530], [-37729423648662, -37774923083763, -86237822559, 48810420366, 0, 2778774375, 43357437, 24965577, -786780486, 636162102, 86714874, -43357437], [23268388886, -10792813821419, 6693173946, 40826825989, 3819009953, 3819009953, -188295250, 508964228, -756240612, -341946244, -153650994, 307301988], [128187854965, 50132481471692, -136894506946, 56102850536, -4825138267, -4825138267, -1118410335, 776056095, 1634545047, -1300326741, -181916406, 363832812], [41569467415094, 7578802166, 20084986596, 41660683912, 2597068188, 0, -623680774, 128943906, 665972314, 0, 178582458, 178582458], [87047299971, -59458593886117, -69193306515, 60924726228, -8903040780, -8903040780, 384405288, 662708946, 275255670, 339746667, -44658621, 89317242], [40777626271989, 40699076260558, -133473384069, 103453926050, 0, 6813395324, 481172424, -626160962, -949867897, 1964219917, 962344848, -481172424], [-88615231377339, -3230766267, 32882238020, 25429815078, 1145757760, 0, 1236100440, 861141816, -142633603, 0, 446626896, 446626896], [2149684757761, 2102123676867, -107304543889, 31541722653, 0, 6677128477, 205547412, 1191702326, -1137880568, -1222490285, 411094824, -205547412], [-77247866318, -94791981337315, -44641655786, -158525728349, 9003455791, 9003455791, 1730409502, -2230574260, 2423631852, 2080961908, 350552406, -701104812], [-5248556817100, 94629685413, -292591956534, -10026486165, 9270299289, 0, 1778080855, -3154030215, -52363490, 0, 652631448, 652631448], [58401325655336, 58492221138651, 180752983520, -84973412051, 0, -18563991611, 184167312, -1074771614, 2036920949, 1948404455, 368334624, -184167312], [-34179884161493, -34176257463305, 112168894150, 103850647450, 0, 204959458, -297942876, -1461815376, 414994308, -4130711620, -595885752, 297942876], [-108903772884938, -108960940820067, 12688399833, 184938795538, 0, 1683723348, -753426114, -2420071252, -539923865, -2188237790, -1506852228, 753426114], [-73881547909, 64707365751346, -149444708604, -257262735215, -19188655294, -19188655294, 932681531, -2655142801, 5659270683, 474967715, -457713816, 915427632], [-89352376828214, -34838299150, -97026302012, -209257031480, -9181318228, 0, -5305216938, -2709676290, -299061210, 0, -949530330, -949530330], [113679678664753, 178209713666, -263526694095, 263850375865, 8440029414, 0, 209436024, -3734588280, 3726918782, 0, 513577617, 513577617], [266020400681, 92903749851171, -391189059531, 10882763898, 40894740, 40894740, 107523196, -216903484, 5892201948, 134477389, 26954193, -53908386], [210292855865, 58645843295776, -40783740969, 269067739887, -9030299640, -9030299640, 1225749124, 3276014336, -3702437865, 235280938, -990468186, 1980936372], [88995600630425, 160037265842, -61903495335, 410021863369, 20706670374, 0, -1449009628, -1315436268, 5421992926, 0, 1120909125, 1120909125], [-948030221251, 227536808785438, 607857378586, -808079484424, 9203377905, 9203377905, -777306065, -8484608361, 1808809371, -395234753, 382071312, -764142624], [398711090855, -81137076340346, -257436953824, 343794602135, -24380361880, -24380361880, -4248709489, 3684414271, 1570368843, -2850317725, 1398391764, -2796783528], [-289724664194985, -289373594544077, 500736388569, -549989627131, 0, -20430629176, 570598107, 4739337904, 4839610202, -5033288945, 1141196214, -570598107], [-63032282709871, -426528587738, 618069112430, -632729414695, -15848291909, 0, 6513470094, 10981064892, -11292701103, 0, -34974135, -34974135], [360664123675, 119208959817977, -160741363491, 380889994278, 5524398480, 5524398480, -1063801060, 3329443510, -1607725464, 650769749, 1714570809, -3429141618], [-14492686895742, -114402498994, 274993077196, -41462699420, -15264409216, 0, 13701915226, 7092244650, -5957560490, 0, 90498846, 90498846], [51216441827822, 50999014353501, -425158502441, 214005922704, 0, 40716046376, -1179986952, -115298813, -4314323818, 1286175476, -2359973904, 1179986952], [-153771284486984, -154132321975055, -640088957793, 429249771198, 0, 48692358846, -575490600, -645456819, -6381343230, 1274870718, -1150981200, 575490600], [298646453670554, -157600712275, 112850173854, -351520594511, 53602475205, 0, -402691606, 2954746572, -5879313494, 0, -256131897, -256131897], [-195007238151949, -194049794107440, 1796402358125, -1033905122192, 0, -9653150498, -856864848, -4739732246, 17986324055, -4676666335, -1713729696, 856864848], [263763843530985, 275933463409, -128533054619, 658762911164, -35667396955, 0, -16998640345, -8841754899, 14664029200, 0, -3072998607, -3072998607], [-130662006568038, -450496598669, 994200224790, -342814521049, 35561146719, 0, -4881359078, 14173489632, -5182919614, 0, 2337967653, 2337967653], [-443373472041240, -334234754298, 170586188378, -817783337700, -1046620622, 0, 82081440, 2629951836, -11622703540, 0, -4414675692, -4414675692], [775978982643, -431234164965187, -662826799413, 488991731010, 84241088373, 84241088373, -161680137, 6628864080, -782592075, -5845050492, -5683370355, 11366740710], [-234430483343014, 198246432651, -366491442200, 229607703039, 9255299675, 0, 6241591069, -2617999797, 2263743986, 0, 3672368790, 3672368790], [5294343843082, 3742949759577, -2199609798555, 2435278088662, 0, -56401626315, 2045710947, -9409278907, -23147882450, 6498509578, 4091421894, -2045710947], [139752404284, -88522872206881, -715466949980, -505053835718, 8822857018, 8822857018, 17017029760, -7996912816, 12962834448, 16225795816, -791233944, 1582467888], [-56901388987936, -55814721794147, 1445996037061, -1796506580680, 0, 4602843127, 1904794923, 11244973943, 16184865910, -4062162360, 3809589846, -1904794923], [-48841574117681, 716040058262, -504680436477, 1635797291311, 87630175530, 0, 11923552454, -4984940922, 14581058530, 0, 1372566657, 1372566657], [-1804669077581, -515877690725638, 1834721817403, -881650859393, 145629376318, 145629376318, 5996457514, -10003315354, -20835996159, 5360130004, -636327510, 1272655020], [-73853271800286, -526320006329, -209609515772, -1783842898909, -91279719625, 0, -7804141213, -4359646647, -16890423710, 0, -4642675044, -4642675044], [947434317782331, 946423608903447, -1452846320873, 1579446769147, 0, -21378768463, 5654302866, -2945399982, -14170779030, 506775453, 11308605732, -5654302866], [922090941823, -1118524926772912, -1034887054922, 368946424778, -104284440267, -104284440267, -17795725783, 5033807285, 19088122665, -14614361527, 3181364256, -6362728512], [983471065934507, 984364815062935, 318935684527, -2407976610541, 0, -83266093817, 87885336, 29046092162, 6037866598, 12719490525, 175770672, -87885336], [170117125124568, 87996046825, 1085126835246, 1331250753539, -183696133107, 0, -5539056929, 6139991961, 18465157214, 0, -5204942904, -5204942904], [898374619398314, 898289712332757, 1727298670022, 2081136364651, 0, 79799834353, -5011565142, -47517715490, 12063663773, -21589557637, -10023130284, 5011565142], [-1625331905731, 394067754242721, 1219304179515, -1221005041140, -144933183975, -144933183975, 15782533795, -13264271602, -3592639293, 16278592918, 496059123, -992118246], [-434908052233664, 856289162842, -888552919972, 1623693057170, 104898086398, 0, -14869273526, -17829716970, 23922520888, 0, -2451772104, -2451772104], [168184836094, -1584257369486113, 174302609684, 419474227520, 71837789102, 71837789102, 23565776172, -1999939314, -12305080590, 30118991118, 6553214946, -13106429892], [-519344323751066, -519287677233119, 234539325981, 55488730530, 0, -71172478809, -2641019031, -703045533, 23471724, -5791371234, -5282038062, 2641019031], [43806769582426, 213380821702, -392470349388, 249710975444, -53847219720, 0, 8754021490, -4137172302, 2577989462, 0, 1260721014, 1260721014], [663573725887750, 663520986119046, -601030308983, -473824115575, 0, 35155476659, -1747166388, 7717508540, -4294715036, 12753329752, -3494332776, 1747166388], [-282942125368, -1071731217503537, -374914936955, -800184358241, 33808445818, 33808445818, 9551877018, -8699360475, 11460272979, 5445136050, -4106740968, 8213481936], [3225985522853820, 3225597183830656, -769497117297, 389719969307, 0, 27658083351, 6005431194, 8127906004, -6782947828, -7412296336, 12010862388, -6005431194], [3308972338806, 133353850928010, -3980290801276, 979453401840, -22577416322, -22577416322, 31429963133, 5140762100, 38863662462, 28189447328, -3240515805, 6481031610], [4992170027600, -1539829591198187, -4476081105686, 2996948325343, 239830882585, 239830882585, 8153845842, 27978202458, 19825758414, 3438868890, -4714976952, 9429953904], [-722143520758681, -1494863657740, 3134248902258, -1358811425279, -205271345553, 0, -42304131100, 33088083402, -746693381, 0, 8452737111, 8452737111], [-2478710263404, -2364118725446358, 2253237339241, -1498949886658, -133481179791, -133481179791, 6340298067, -7016311001, -22026782397, -9290665974, -15630964041, 31261928082], [-892238787150078, -1666161005767, 4210737648524, -647296017863, -180585435251, 0, 43512697537, 68148824979, -28787828398, 0, 6040563252, 6040563252], [-6788828010008, -2253770868843661, 4430013751922, -5722704175251, 143983317439, 143983317439, 7153635364, -61390150386, 5107433238, 7721711170, 568075806, -1136151612], [-1638997742608916, -1180564117400, 6728026943100, 3246401042852, 71378959680, 0, -4838678792, 79425631656, 14520500912, 0, -20649268164, -20649268164], [-4324334830587, 2697107905866773, 4292871936261, -2148758883276, -276812473140, -276812473140, -81525055428, -8328728388, -9685864854, -78333410853, 3191644575, -6383289150], [-340103528600285, -337840761275450, 1511655121607, -5410453824268, 0, -245306216748, -10496751426, 60614747490, 14704764657, 7323304439, -20993502852, 10496751426], [2806284819174153, 2733670558075, -7280000065728, 737651707604, -35907330018, 0, -32738217532, -113493195216, 37128488145, 0, -14918412798, -14918412798], [-149467184696857, -150254615107101, -179182576653, 2039958571895, 0, -34633790949, -25676316264, -3978122960, -24200531524, -90880662691, -51352632528, 25676316264], [-3549947624525963, -3551901979002821, 161819027359, 6281864090281, 0, 105119722045, 5760452088, -111471943506, 5497968492, 45334209095, 11520904176, -5760452088], [-1648502139887742, 1497874341100, 861911068788, 5299801435880, -316721439756, 0, 10953899440, -655167288, 66031388360, 0, 1323433032, 1323433032], [-318374044778746, -321122408818332, -5478442924497, 2563528658969, 0, 515119135584, -3451643391, 33649225546, -61007755318, -55610423218, -6903286782, 3451643391], [1191095540906685, 1188409744582540, -2712304474575, 5324852880170, 0, -769731345355, 16540158705, 2716144720, -40479981535, -55417699205, 33080317410, -16540158705], [-1240359151869362, 854872040089, -9692301594048, -7077610426795, 652835848005, 0, 49331971069, -94711292433, -95454368350, 0, -1760978604, -1760978604], [-2834866773298224, -2834080004460803, 558941986035, -1755968716834, 0, 190466509011, -7241224683, -20010305078, 17170048985, 82675221554, -14482449366, 7241224683], [2459344027932343, 2453427064891800, -11050463802195, 6372592484908, 0, -457676702010, 4843504092, 54004780478, -119598644969, -1787071355, 9687008184, -4843504092], [5515766451430817, 441863889822, -8437682746007, -7133874049899, 273521931746, 0, 2409289888, -99642945336, -75450682090, 0, -14010022587, -14010022587], [-2216869484860655, -1358527339174, -1199303917266, -5242168801763, 934293354615, 0, -37871003658, -469712100, -71057848783, 0, -2212667499, -2212667499], [-3690243005711, 1109161969552694, 8812286129200, 3090415840165, 549741586096, 549741586096, 47424454879, 40352812325, -212826265575, 23288445493, -24136009386, 48272018772], [335357002681543, 339302246120047, 2497091114973, -9609870279027, 0, -1195749640090, 4306201281, 161555228352, 17327286546, -44468557501, 8612402562, -4306201281], [-2063793890353944, 638377378186, -2492694181688, -755730486478, -560575753522, 0, -75632497144, -62678741436, 39857200768, 0, -3901621902, -3901621902], [6942258435958950, 3696977464583, -1932215680052, 9007197067999, 456285718247, 0, -9266117819, -39135452901, 103118074978, 0, -4878231666, -4878231666], [7253971688011, 2570461109227442, -11444111073603, -324259291257, 466055154087, 466055154087, -173732813851, -4833073844, 230392266246, -150789364945, 22943448906, -45886897812], [24124273435357, -970301124927914, -18091875129192, 18130824161169, -512779505628, -512779505628, -41543836093, 173876715601, 75939657225, 1446662885, 42990498978, -85980997956], [4918278359032, 1033074853582970, 1151646986124, 8327028612354, 453896460966, 453896460966, 44023239113, 96373916986, -167067588744, 11820879182, -32202359931, 64404719862], [-7596718218954046, -7605118178272523, -11289610591079, 13873142137910, 0, 1130353887673, -3527000169, -103100926165, -114609539048, 8454086262, -7054000338, 3527000169], [7457594536114776, -3727261960334, 7583171194060, -3566516531614, -874778179498, 0, -62362579210, 83533313586, -10927420952, 0, 17777938188, 17777938188], [-998292524246213, -997730186533016, 3475865505181, 2088255632272, 0, -676724991170, -23990912064, -149070829950, 48612627519, 225923174633, -47981824128, 23990912064], [-4774109603738754, -12282324951919, 15632484946976, -21005891726795, 43855997881, 0, -207641341925, 204775330053, -211464193858, 0, 18545357670, 18545357670], [4175612592975237, 280483117730, 3082852512310, 4201289931193, 919899008795, 0, 150280033846, 96976196868, -29731834979, 0, 30258276537, 30258276537], [44707834375565, 49715135729439, 9318287164889, -5396797372001, 0, -348103784840, -10828465095, -69118950188, 105947742368, 110184064205, -21656930190, 10828465095], [-14267163862679, 4075059114093074, 18282034176455, -3077068017519, -653115907868, -653115907868, -141079894772, -10827750060, -174774683271, -105695148596, 35384746176, -70769492352], [3504388000663, -1346022215468317, -4050309889323, 1164972476436, 590672338344, 590672338344, 71613755288, -1361746490, 13553290722, 62980237823, -8633517465, 17267034930], [-129498060557978, -9872584268782, -6854527355376, -36186063174908, -28138060932, 0, -63549063118, -39455208438, -389221258370, 0, 6666016854, 6666016854], [15134682685206, -8604366509190642, -18752179035660, 4053342582636, -1405431824286, -1405431824286, 13647703233, 40084720572, 256753613478, 14972367000, 1324663767, -2649327534], [10050625772135850, -2199938309529, -3161877799396, -9867279352125, 1618121684959, 0, -162184649493, -64344949215, -120942974566, 0, -94600239132, -94600239132], [10263771760650398, 10252903385161728, -22603958743913, 9670482584421, 0, 1166555746265, 36894051978, 48964713316, -190165959478, 174086978018, 73788103956, -36894051978], [23168951559493, 15244013645604371, -20612018135985, 14153707082358, -186663727593, -186663727593, -201085226527, 187824274822, 156655804695, -249525559258, -48440332731, 96880665462], [-1906639772263535, 8620164042286, -16527891768231, 8223134605325, 519883980786, 0, -458764302644, -348664319052, 302037131606, 0, 617186337, 617186337], [-7505547284763835, -7507162084996901, 16935036566109, 22899507261151, 0, 456953503782, -69253694961, -568846215910, 129696171934, -34118417615, -138507389922, 69253694961], [9456556827187998, 4087124334177, -1512680211174, 10728958357461, -488143102539, 0, 108469036566, -2251233384, 125952237078, 0, 68564834919, 68564834919], [-3318584953374375, -3329562405413457, -15719322112850, 16245679962328, 0, -1531885567180, -111180186576, 13512000516, -247804647366, -188425651206, -222360373152, 111180186576], [-31784802326587, -2711703200488769, 20551212089341, -26827743271226, 371080640128, 371080640128, -237479926884, -249804968424, 102464123988, -235230847107, 2249079777, -4498159554], [-1916466064729456, 3937100939010, -10857386176392, 1217441809602, -2595186098382, 0, 349849156758, -105665181414, -19341193620, 0, -2312527500, -2312527500], [10235257339460, 7674795752994321, -34152333319134, -18414352930017, -1727732591451, -1727732591451, -43766316602, -171594644890, 780578431554, -119016527666, -75250211064, 150500422128]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_18_c_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_18_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_18_12_c_b(:prec:=12)
    chi := MakeCharacter_18_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_18_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_18_12_c_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_18_c();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,12,sign)));
    Vf := Kernel([<5,R![448474583397606781991334496643212185600000000, -820539167863250392429545929496715200000000, 1334077263307258555021372670554233000000, -341100708791811680948898657421125000, 98414163923460899226225502595625, -7755296452857862804722105000, 2023176617275204108043550, -126481095811049063400, 29224320364065591, -908116396416, 200445462, -4104, 1]>],Snew);
    return Vf;
end function;