
// Make newform 768.3.h.h in Magma, downloaded from the LMFDB on 23 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_768_h();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_768_h_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_768_3_h_h();".
// 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_768_3_h_h();".
// 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 := [2401, -7056, 11724, -17932, 24840, -25496, 17714, -7060, 555, 640, -66, -104, 50, -28, 14, -4, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-544249893260957625489, 402147901328092287564, -795703763476158680914, 1101140289291794144046, -1135776337355918990048, 615363780535269695166, 61203334305725712986, -202037586301504503744, 7093423907199410714, 24100324820579854794, -1261831727497275602, 529018760445806044, -1233457767323771308, -139688548619286130, -47633572835668896, -73605237118565390], [-88262663720799637363681324, -104408253736098716785228332, -333975898645644202702191118, 394936329964996076653983336, -192281761863540202775765666, -249135055907033040587373936, 434141249588399178636341586, -185396532173326788843206856, -29651658206534911182424006, 22834363346293880559522940, 3156489507901330068044614, -995377489052373457680032, 213271506955874822687428, -654015690334010596895884, 157643615961293517755580, -99362376719317588592644], [-303265474878736101234979238, 998815185235190819052860430, -1417240917087734151396424793, 1132201301739918183217506765, -1486026968627483519601442321, 1574248391414505437517732471, -1216821803698994193762710484, 320568277591574100193142280, 110448656540655743708472337, -40628742994151317163457289, -18840296358896891889846508, 1682269426299819388064648, -3621706423247909764322422, 1553120990278286891368081, -640202263351630099843971, 189224219934601032264355], [-16533045201889393898502397, 27020900329861475554330964, -44569897710476397997173428, 78452027971271711503230598, -93214027840038103299879880, 69392925277420838243005046, -29166355503786286734932230, 2134124510400861462739424, 2864130346548477692928604, -265512122939865771157942, -415306479428912573409582, 161505766591708053420364, -115611452811381285277960, 51123108622447450476286, -16696296122407843524494, 3640490453456954097858], [-187269373357533880, 399142132155581296, -555948001648106716, 845369308904828096, -1015163612568399884, 870266063458707304, -448764552639400932, 76037812918776760, 38143824965723228, -9590853089188752, -5282208866934684, 2428767128904824, -1282221816062488, 808003344635480, -224840478635056, 72684469693760], [73635341491264992735750559, -112158128752047556736724332, 96943521582465721562442746, -249729491763515335269157846, 449020567409998748155182748, -435187087035768768804873974, 234941060542798650808228840, -32569021563057742201550024, -22382276527890369452376370, 4213575685143668590694674, 2767985707332668051783076, -830174841462470676732352, 722317551925352307477868, -351087091130861083128466, 122223497851645985487134, -30964682511934783503810], [36707798999442881296523572, 21468729734104125727704124, 30926645260328445790809788, -103299492669661029430155556, 15786583481454523793225260, 79729091073366660116651896, -105822817363836738019230770, 59396498158646402591599588, 2724335024283234546960200, -8781276532560910172334860, -932380116944940123230634, 521383090631562825694928, 36936950069573329739656, 238371309052252800044600, -32006703464375436767938, 35220176603425455380400], [948191375097728418362664476, -1935825001234129541998511804, 2830934339193932474639480993, -4691038047271369875397782463, 6097981717619334251998696003, -5364246117903744242824857047, 2872720671982035201104284980, -558017997097579641379188182, -233702847930081684199658665, 74147872428604737899472801, 33483168646838080662868536, -15170187401690208428739514, 7674579346797568635198524, -5236363327383127844285983, 1407423641116043044984739, -496011314854612629237607], [-531388868455846783559913470, 1098557546541429389083110714, -1596024018956010006398663969, 2786498808998386784147595327, -3465449247703949276546491501, 2849430799189762299032510721, -1332938102861827597833812202, 129084446355814662641230164, 130623547662795020307028957, -14166933236368567892115763, -16474709494587523434622366, 6619724633870462883487076, -4632646557071839349088766, 2200838562375756723362047, -722283452909459301095925, 168205981222649866459993], [-797051948299789731534756680, 2284234538899424073865200552, -4068255658692241415900074508, 6125863483899854452295642124, -6902862737843796856509056704, 5532641255779921708628630832, -2887010849285275188911969358, 624628548695658880225303860, 217705740186354083996814700, -85094055795357376986267568, -35945008775855893630086130, 17692316089595233177136120, -7688654266282923636617572, 5735315644397360890020964, -1408219547486122305150558, 551433367755288482572036], [-1355563446291770005494690, 26181132013428199701150194, -33176743048971708020631918, 52304577766421834673743632, -81148429500991178855466900, 84288446412857750839274966, -54982088196114388725677778, 16446624534719448243157154, 3750630518098402823426118, -2228428785917414061095450, -573606376298445507057866, 290568605512493599763378, -98301957290644270684438, 106642177371262500986628, -23975944496966615836928, 11913187010808341876886], [-79874676786308848296228229, 190211240740289941355047052, -232158640560184879151842796, 415165850424849819875437414, -570509132045867792137860712, 537165476707658079331848830, -297132976451917827250801510, 63574381834947111771677288, 22863780092201702657803180, -8430821140772456286131806, -3052264204664955485878014, 1686037666090608468184996, -679041821146738360614520, 563850788327923100286814, -137783157785429009305526, 55024520198138880566010], [-55028840081614189320893790, 121084587780806107656104808, -188198004344939422253821672, 306148472751434611559085668, -395686452807303374493405652, 347302706535448206066655268, -181898556717941278052465898, 34387091160570332254797960, 14475875407010959495107452, -4644466413137907833313952, -2064820988020967478333898, 1021272473055663921364308, -477367827448243316342072, 340478365886124775238104, -88206778931937685372070, 31817579385645488535444], [-4957377610955501313794460850, 10403553731305134146927457278, -14520845490988459183442145385, 22502383378998811767386967937, -27921974802000853211099091929, 23399319641003821026377525075, -12029737929564727753564018440, 2064908151313945678083008888, 1029607431255999657920021909, -265454012643265202130323149, -147950314564777996000852984, 63068059782007057113198960, -35505982914351192419445234, 21504052543851716703107285, -6114785714223635371831415, 1944509727790417716480887], [-518021587644632004999733864, 1082580752062076026913195444, -1540230428741537897930332472, 2471016010147884355794089104, -3102265819152201974954549176, 2627341790001511721947146452, -1345616710449714098644922284, 221342755050324522216294260, 116809191218979853253523988, -28253227622269491985415116, -16326080972690283552664140, 6956242868611039002966124, -3994202810179077315449392, 2377104280783034795722072, -685391664748231303553084, 212457904015996007722308]];
    Rf_basisdens := [1, 43737612461167616781, 53820750425127815650841397, 53820750425127815650841397, 698970784741919683777161, 11795069338202997, 4892795493193437786440127, 4892795493193437786440127, 53820750425127815650841397, 17940250141709271883613799, 53820750425127815650841397, 1098382661737302360221253, 4892795493193437786440127, 1630931831064479262146709, 53820750425127815650841397, 4892795493193437786440127];
    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_768_h();"
function MakeCharacter_768_h()
    N := 768;
    order := 2;
    char_gens := [511, 517, 257];
    v := [2, 1, 1];
    // chi(gens[i]) = zeta^v[i]
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    F := CyclotomicField(order);
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),[F|F.1^e:e in v]);
    return MinimalBaseRingCharacter(chi);
end function;

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


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


function qexpCoeffs()
    // To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
    weight := 3;
    raw_aps := [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0], [1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, -1, 0, 0, -1, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0], [0, 0, 0, 1, 0, -1, 0, 0, -2, 1, 0, 0, 0, 0, 0, 0], [0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -2, 1, 0, -1], [0, 0, 0, -1, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, -1, 0], [0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, -2, 0, 2], [0, 0, 0, 0, 0, -1, 0, 0, 6, 2, 2, 1, 0, 0, 0, 0], [7, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, -1, 2, 0, 0], [0, 0, 0, -1, 0, 0, 0, 0, -6, 1, 0, 0, 0, 0, -2, 0], [0, 0, 0, 0, 5, 0, 0, 2, 0, 0, 0, 0, 1, -2, 0, 3], [0, 0, 0, 3, 0, -6, 0, 0, -1, 1, 0, 0, 0, 0, -1, 0], [0, -2, 0, 0, 3, 0, -2, 0, 0, 0, 0, 0, -1, 2, 0, 0], [0, 0, -4, 0, 0, 0, 0, 0, 12, 4, -4, 3, 0, 0, 0, 0], [0, 0, -8, 0, 0, -4, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 2, 0, 0, -10, 3, 0, 0, 0, 0, -2, 0], [0, 0, 0, 0, 0, -10, 0, 0, -5, 3, 0, 0, 0, 0, 4, 0], [0, -1, 0, 0, -7, 0, -1, -3, 0, 0, 0, 0, -3, 4, 0, 2], [10, 2, 0, 0, -2, 0, -2, 2, 0, 0, 0, 0, 2, 0, 0, 0], [51, 0, 0, 0, -3, 0, -3, 1, 0, 0, 0, 0, 3, -2, 0, 0], [0, 0, 5, 0, 0, 3, 0, 0, 6, 2, -1, 9, 0, 0, 0, 0], [0, -3, 0, 0, 9, 0, -3, 2, 0, 0, 0, 0, -1, 1, 0, -8], [12, -1, 0, 0, -3, 0, -3, -2, 0, 0, 0, 0, 3, -5, 0, 0], [0, 0, -12, 0, 0, -11, 0, 0, 6, 2, 10, -7, 0, 0, 0, 0], [61, 9, 0, 0, 2, 0, 2, -2, 0, 0, 0, 0, -2, 0, 0, 0], [0, 0, -6, 0, 0, 0, 0, 0, -3, -1, -6, -2, 0, 0, 0, 0], [0, 0, 0, -7, 0, -4, 0, 0, -10, 3, 0, 0, 0, 0, 6, 0], [0, 2, 0, 0, -2, 0, 2, 4, 0, 0, 0, 0, -6, -6, 0, 0], [47, 6, 0, 0, 3, 0, 3, -13, 0, 0, 0, 0, -3, -10, 0, 0], [0, 0, 6, 0, 0, 0, 0, 0, 9, 3, 6, 18, 0, 0, 0, 0], [0, -6, 0, 0, -3, 0, -6, -6, 0, 0, 0, 0, -3, 12, 0, 5], [0, 0, 0, 0, 0, -28, 0, 0, 1, -3, 0, 0, 0, 0, -8, 0], [0, 0, -16, 0, 0, -8, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0], [101, -13, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 12, 0, 0], [0, 0, 0, -7, 0, 23, 0, 0, 14, -7, 0, 0, 0, 0, 0, 0], [0, 0, 0, -3, 0, -14, 0, 0, 17, -9, 0, 0, 0, 0, -7, 0], [0, 3, 0, 0, -10, 0, 3, -1, 0, 0, 0, 0, -2, -2, 0, -10], [0, 0, -12, 0, 0, -8, 0, 0, -12, -4, 4, -1, 0, 0, 0, 0], [0, 0, 8, 0, 0, 0, 0, 0, -21, -7, 8, -24, 0, 0, 0, 0], [0, 0, 0, -1, 0, 13, 0, 0, 34, -13, 0, 0, 0, 0, -4, 0], [0, 8, 0, 0, -21, 0, 8, -6, 0, 0, 0, 0, 7, -2, 0, -12], [-26, -6, 0, 0, 6, 0, 6, 6, 0, 0, 0, 0, -6, 12, 0, 0], [0, 0, 0, 0, 0, 3, 0, 0, -18, -6, -6, 13, 0, 0, 0, 0], [69, -17, 0, 0, 4, 0, 4, 0, 0, 0, 0, 0, -4, 4, 0, 0], [0, 0, 0, 2, 0, -48, 0, 0, -29, 11, 0, 0, 0, 0, 2, 0], [19, 16, 0, 0, 13, 0, 13, 1, 0, 0, 0, 0, -13, 14, 0, 0], [0, 0, -19, 0, 0, -5, 0, 0, -6, -2, -9, 17, 0, 0, 0, 0], [0, 0, 0, -9, 0, -11, 0, 0, 18, -5, 0, 0, 0, 0, 12, 0], [0, 17, 0, 0, -5, 0, 17, 6, 0, 0, 0, 0, 17, -23, 0, 18], [0, -14, 0, 0, 21, 0, -14, 8, 0, 0, 0, 0, -23, 6, 0, -8], [14, -26, 0, 0, 10, 0, 10, -2, 0, 0, 0, 0, -10, 8, 0, 0], [0, 0, -3, 0, 0, -5, 0, 0, 30, 10, 7, -31, 0, 0, 0, 0], [0, 2, 0, 0, -4, 0, 2, 0, 0, 0, 0, 0, 0, -2, 0, -10], [0, 15, 0, 0, 15, 0, 15, 1, 0, 0, 0, 0, 43, -16, 0, 10], [0, 0, -8, 0, 0, -8, 0, 0, -24, -8, 8, 7, 0, 0, 0, 0], [115, 8, 0, 0, -11, 0, -11, 9, 0, 0, 0, 0, 11, -2, 0, 0], [0, 0, 0, 7, 0, 4, 0, 0, 10, -7, 0, 0, 0, 0, -18, 0], [0, 7, 0, 0, -35, 0, 7, -6, 0, 0, 0, 0, -9, -1, 0, -2], [0, 0, 0, 14, 0, -46, 0, 0, 41, -11, 0, 0, 0, 0, -6, 0], [0, 0, 24, 0, 0, 25, 0, 0, -30, -10, -26, -15, 0, 0, 0, 0], [0, 0, 0, -14, 0, 10, 0, 0, 39, -13, 0, 0, 0, 0, 14, 0], [0, -11, 0, 0, 7, 0, -11, -1, 0, 0, 0, 0, -13, 12, 0, -2], [44, -19, 0, 0, -1, 0, -1, -8, 0, 0, 0, 0, 1, -9, 0, 0], [0, 0, -64, 0, 0, -34, 0, 0, 12, 4, 4, -17, 0, 0, 0, 0], [0, 0, 0, -12, 0, 2, 0, 0, -11, 5, 0, 0, 0, 0, 16, 0], [-80, 33, 0, 0, -5, 0, -5, -4, 0, 0, 0, 0, 5, -9, 0, 0], [0, 0, 13, 0, 0, 15, 0, 0, -42, -14, -17, 9, 0, 0, 0, 0], [0, 0, 0, -7, 0, 73, 0, 0, -2, 1, 0, 0, 0, 0, 8, 0], [0, -4, 0, 0, 28, 0, -4, -8, 0, 0, 0, 0, 36, 12, 0, 4], [0, 3, 0, 0, -5, 0, 3, -3, 0, 0, 0, 0, 7, 0, 0, 18], [47, -8, 0, 0, -15, 0, -15, -7, 0, 0, 0, 0, 15, -22, 0, 0], [0, 0, 0, -17, 0, 53, 0, 0, 2, -9, 0, 0, 0, 0, -8, 0], [0, 0, 0, 1, 0, 14, 0, 0, -61, 17, 0, 0, 0, 0, -11, 0], [0, 12, 0, 0, -17, 0, 12, -2, 0, 0, 0, 0, 11, -10, 0, -12], [0, 0, 36, 0, 0, 18, 0, 0, 72, 24, 0, 67, 0, 0, 0, 0], [0, 0, 0, -23, 0, -62, 0, 0, -58, 15, 0, 0, 0, 0, 10, 0], [0, 1, 0, 0, -4, 0, 1, -8, 0, 0, 0, 0, 14, 7, 0, 37], [-74, 16, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 0, 28, 0, 0], [0, 0, 19, 0, 0, -5, 0, 0, -60, -20, 29, 3, 0, 0, 0, 0], [0, 0, 0, 23, 0, -33, 0, 0, 2, 7, 0, 0, 0, 0, 0, 0], [0, 18, 0, 0, 21, 0, 18, 24, 0, 0, 0, 0, 9, -42, 0, 40], [124, -17, 0, 0, -3, 0, -3, 14, 0, 0, 0, 0, 3, 11, 0, 0], [-99, -29, 0, 0, 8, 0, 8, 28, 0, 0, 0, 0, -8, 36, 0, 0], [0, 0, 67, 0, 0, 27, 0, 0, 72, 24, 13, 51, 0, 0, 0, 0], [0, 3, 0, 0, 18, 0, 3, 20, 0, 0, 0, 0, -16, -23, 0, 13], [142, -4, 0, 0, -12, 0, -12, 20, 0, 0, 0, 0, 12, 8, 0, 0], [0, 0, -40, 0, 0, -9, 0, 0, -18, -6, -22, -19, 0, 0, 0, 0], [103, 2, 0, 0, -1, 0, -1, 7, 0, 0, 0, 0, 1, 6, 0, 0], [0, 0, -17, 0, 0, -13, 0, 0, 108, 36, 9, 39, 0, 0, 0, 0], [0, 24, 0, 0, -18, 0, 24, 20, 0, 0, 0, 0, -10, -44, 0, -16], [-303, 41, 0, 0, 6, 0, 6, 14, 0, 0, 0, 0, -6, 20, 0, 0], [0, 0, 4, 0, 0, 12, 0, 0, -45, -15, -20, 20, 0, 0, 0, 0], [0, 0, 0, -2, 0, -16, 0, 0, 91, -37, 0, 0, 0, 0, -18, 0], [0, 17, 0, 0, 13, 0, 17, 23, 0, 0, 0, 0, 1, -40, 0, 6], [0, 0, 68, 0, 0, 38, 0, 0, 48, 16, -8, -81, 0, 0, 0, 0], [0, -22, 0, 0, -3, 0, -22, -22, 0, 0, 0, 0, -3, 44, 0, -47], [0, 0, 0, 11, 0, 88, 0, 0, -21, 9, 0, 0, 0, 0, -5, 0], [0, 0, 0, 1, 0, 108, 0, 0, 6, -9, 0, 0, 0, 0, -22, 0], [0, 0, 0, -15, 0, 80, 0, 0, 69, -17, 0, 0, 0, 0, 33, 0], [0, 0, 36, 0, 0, 25, 0, 0, 126, 42, -14, 9, 0, 0, 0, 0], [0, 0, 63, 0, 0, 39, 0, 0, -108, -36, -15, 15, 0, 0, 0, 0], [0, 2, 0, 0, 11, 0, 2, 22, 0, 0, 0, 0, -29, -24, 0, 43], [0, 0, 0, -2, 0, -42, 0, 0, -111, 37, 0, 0, 0, 0, 2, 0], [40, -75, 0, 0, -9, 0, -9, 28, 0, 0, 0, 0, 9, 19, 0, 0], [0, 0, 46, 0, 0, 28, 0, 0, 33, 11, -10, 82, 0, 0, 0, 0], [0, -28, 0, 0, -2, 0, -28, -4, 0, 0, 0, 0, -50, 32, 0, -34], [0, 13, 0, 0, -48, 0, 13, 5, 0, 0, 0, 0, -32, -18, 0, -14], [-166, -6, 0, 0, 6, 0, 6, -14, 0, 0, 0, 0, -6, -8, 0, 0], [175, 90, 0, 0, -17, 0, -17, -33, 0, 0, 0, 0, 17, -50, 0, 0], [0, 0, 0, -17, 0, -58, 0, 0, -54, 1, 0, 0, 0, 0, -34, 0], [0, -5, 0, 0, 55, 0, -5, 14, 0, 0, 0, 0, 17, -9, 0, -4], [0, 0, 0, -8, 0, 110, 0, 0, 69, -27, 0, 0, 0, 0, -4, 0], [-455, 57, 0, 0, -2, 0, -2, -18, 0, 0, 0, 0, 2, -20, 0, 0], [0, 13, 0, 0, 22, 0, 13, -4, 0, 0, 0, 0, 56, -9, 0, 15], [0, 0, 0, -63, 0, 36, 0, 0, -19, -17, 0, 0, 0, 0, -7, 0], [0, -21, 0, 0, -34, 0, -21, -17, 0, 0, 0, 0, -42, 38, 0, 14], [0, 0, -16, 0, 0, -37, 0, 0, 78, 26, 58, 85, 0, 0, 0, 0], [0, 0, 8, 0, 0, 16, 0, 0, 51, 17, -24, -40, 0, 0, 0, 0], [0, 0, 0, 7, 0, 86, 0, 0, 122, -39, 0, 0, 0, 0, -2, 0], [36, 11, 0, 0, 17, 0, 17, 38, 0, 0, 0, 0, -17, 55, 0, 0], [0, 0, 52, 0, 0, 15, 0, 0, 42, 14, 22, -67, 0, 0, 0, 0], [0, 0, -99, 0, 0, -69, 0, 0, 42, 14, 39, 33, 0, 0, 0, 0], [0, 0, 0, 35, 0, 38, 0, 0, 101, -25, 0, 0, 0, 0, -9, 0], [0, 0, 36, 0, 0, 3, 0, 0, -126, -42, 30, -95, 0, 0, 0, 0], [0, 0, 0, -65, 0, 36, 0, 0, 26, -31, 0, 0, 0, 0, -2, 0], [0, 26, 0, 0, 30, 0, 26, -2, 0, 0, 0, 0, 86, -24, 0, -4], [-411, 17, 0, 0, 2, 0, 2, -26, 0, 0, 0, 0, -2, -24, 0, 0], [0, 0, 0, 57, 0, 75, 0, 0, -50, 37, 0, 0, 0, 0, 4, 0], [0, 0, 0, 20, 0, 140, 0, 0, 79, -37, 0, 0, 0, 0, -52, 0], [0, 27, 0, 0, -16, 0, 27, 19, 0, 0, 0, 0, 0, -46, 0, 78], [179, 74, 0, 0, 19, 0, 19, -49, 0, 0, 0, 0, -19, -30, 0, 0], [0, 0, 0, -1, 0, 67, 0, 0, -14, 15, 0, 0, 0, 0, 32, 0], [0, -12, 0, 0, -17, 0, -12, -42, 0, 0, 0, 0, 43, 54, 0, -35], [-114, 102, 0, 0, 10, 0, 10, -26, 0, 0, 0, 0, -10, -16, 0, 0], [0, 0, -28, 0, 0, -15, 0, 0, -114, -38, 2, 9, 0, 0, 0, 0], [0, 0, 0, 51, 0, -110, 0, 0, -99, 39, 0, 0, 0, 0, -33, 0], [0, 0, 124, 0, 0, 57, 0, 0, -42, -14, 10, 21, 0, 0, 0, 0], [0, -12, 0, 0, 61, 0, -12, 2, 0, 0, 0, 0, 33, 10, 0, -41], [0, 0, 0, 19, 0, 88, 0, 0, 11, -23, 0, 0, 0, 0, -77, 0], [0, 0, 84, 0, 0, 47, 0, 0, -150, -50, -10, -7, 0, 0, 0, 0], [25, -119, 0, 0, 14, 0, 14, 46, 0, 0, 0, 0, -14, 60, 0, 0], [0, 0, -22, 0, 0, 8, 0, 0, 129, 43, -38, -34, 0, 0, 0, 0], [0, 0, 0, -55, 0, 175, 0, 0, 78, -39, 0, 0, 0, 0, 16, 0], [0, 3, 0, 0, 51, 0, 3, 53, 0, 0, 0, 0, -49, -56, 0, -22], [0, 0, 0, -49, 0, 31, 0, 0, 82, -29, 0, 0, 0, 0, 44, 0], [0, -18, 0, 0, -57, 0, -18, -18, 0, 0, 0, 0, -57, 36, 0, -33], [0, 0, 0, -47, 0, -94, 0, 0, 107, -47, 0, 0, 0, 0, 13, 0], [0, -68, 0, 0, 43, 0, -68, 14, 0, 0, 0, 0, -121, 54, 0, -68], [0, 0, 0, 1, 0, -145, 0, 0, -66, 29, 0, 0, 0, 0, 20, 0], [0, 70, 0, 0, -90, 0, 70, -12, 0, 0, 0, 0, 74, -58, 0, -8], [0, 0, 0, -57, 0, 224, 0, 0, 161, -65, 0, 0, 0, 0, 23, 0], [0, -27, 0, 0, -79, 0, -27, -37, 0, 0, 0, 0, -59, 64, 0, -42], [0, 0, 0, -29, 0, 90, 0, 0, -49, 1, 0, 0, 0, 0, -17, 0], [0, 50, 0, 0, -113, 0, 50, -20, 0, 0, 0, 0, 27, -30, 0, 88], [-607, 13, 0, 0, 18, 0, 18, -38, 0, 0, 0, 0, -18, -20, 0, 0], [0, 33, 0, 0, 42, 0, 33, 36, 0, 0, 0, 0, 36, -69, 0, 51], [-200, 35, 0, 0, 9, 0, 9, 10, 0, 0, 0, 0, -9, 19, 0, 0], [0, 0, 136, 0, 0, 105, 0, 0, -270, -90, -74, -55, 0, 0, 0, 0], [0, 0, -110, 0, 0, -36, 0, 0, -111, -37, -38, 110, 0, 0, 0, 0], [0, 38, 0, 0, 3, 0, 38, 22, 0, 0, 0, 0, 35, -60, 0, 7], [841, 49, 0, 0, -10, 0, -10, -10, 0, 0, 0, 0, 10, -20, 0, 0], [0, 0, 97, 0, 0, 103, 0, 0, -18, -6, -109, 85, 0, 0, 0, 0], [0, 23, 0, 0, 24, 0, 23, 48, 0, 0, 0, 0, -26, -71, 0, 115], [0, -15, 0, 0, 37, 0, -15, -17, 0, 0, 0, 0, 41, 32, 0, -2], [-181, -26, 0, 0, -49, 0, -49, -45, 0, 0, 0, 0, 49, -94, 0, 0], [0, 0, 0, 15, 0, 42, 0, 0, -54, 45, 0, 0, 0, 0, 66, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_768_h_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_768_3_h_h();".
// 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_768_3_h_h(:prec:=16)
    chi := MakeCharacter_768_h();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 3));
    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_768_3_h_h();".
// 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_768_3_h_h( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_768_h();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,3,sign)));
    Vf := Kernel([<5,R![2304, 0, -7040, 0, 3504, 0, -120, 0, 1]>,<7,R![-176, 368, -108, -4, 1]>],Snew);
    return Vf;
end function;