
// Make newform 768.3.h.g in Magma, downloaded from the LMFDB on 24 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_g();".
// 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_g();".
// 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], [-16770232351270099881643730, 8432842812409739274374800, 3348941406271578947371772, 66382956995526699323432768, -90516260002504758373545068, 86101668205869548404416256, -41036849046439204403549354, -4995708608434525709605928, 6318318031153194229138628, 1360236687693649749902812, -302395664081805849187938, 94575406157735378286932, -175989961158120001904648, 31986679955180037165596, -24596850319687148065498, -566862203411123630952], [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], [-113537031763145533567771768, -161547730542490666137459340, 182330596849811683155607769, 772337936533064908032680371, -1146505501287901455850762181, 940566927299476506274613855, -322960765421213409507762294, 108365273150190878544815738, -7369356273369079815842629, -19352196198084852843899749, 1831837206646334661600338, 6868193341519926157187790, 579773633522180478212664, 1482403774729084229555855, -44937924854953644044843, 138581113697361730513259], [531388868455846783559913470, -1098557546541429389083110714, 1596024018956010006398663969, -2786498808998386784147595327, 3465449247703949276546491501, -2849430799189762299032510721, 1332938102861827597833812202, -129084446355814662641230164, -130623547662795020307028957, 14166933236368567892115763, 16474709494587523434622366, -6619724633870462883487076, 4632646557071839349088766, -2200838562375756723362047, 722283452909459301095925, -168205981222649866459993], [-33270747811493876570369357, 53436556064592025450989376, -88811409075594967963341452, 150694128699661383327386734, -165259818508272519185846968, 123778239142807290270260226, -50091103347213961609340462, 3057864094911744963227876, 4607042345588424627234784, -336593765301731954566586, -605829474546069837819814, 356693056433770088067712, -179996270019397229483176, 97830933106830087692206, -27059868000455474824030, 6790401932708182938854], [2973846310014844840669276, 11578823514892955026274212, -24438696818464476779749826, 38235057495590049928335908, -42416375610402556040640946, 36954355156331010797118136, -25988677324848921357649788, 9450316606705609400250244, 1496073740349176369527222, -1309499576510442259114844, -306098914916847928635740, 155209392964191379095072, -41860490565361010185488, 55151477852948657886232, -11018753819774313163018, 6513008970418506155080], [-187269373357533880, 399142132155581296, -555948001648106716, 845369308904828096, -1015163612568399884, 870266063458707304, -448764552639400932, 76037812918776760, 38143824965723228, -9590853089188752, -5282208866934684, 2428767128904824, -1282221816062488, 808003344635480, -224840478635056, 72684469693760], [1355563446291770005494690, -26181132013428199701150194, 33176743048971708020631918, -52304577766421834673743632, 81148429500991178855466900, -84288446412857750839274966, 54982088196114388725677778, -16446624534719448243157154, -3750630518098402823426118, 2228428785917414061095450, 573606376298445507057866, -290568605512493599763378, 98301957290644270684438, -106642177371262500986628, 23975944496966615836928, -11913187010808341876886], [13684821395007567982090991, -31292553550792027697485096, 39673385329533537320290348, -73178237160681092916555914, 103889695914473851097068424, -93083033745883153746014782, 50146307848111421366757962, -9905665874716843874452804, -4155937925896538946657008, 1325660672206617260076806, 591703019575590569469378, -249499837561607796846344, 135476168681173667015816, -89745678480652141506314, 24782518091559641357842, -8590963939173287204922], [-46686519020778643421797319, 105733915211096336853554044, -185137221179726910144009926, 309754167628716953270813298, -380664176575104821593938596, 307218073267831130526672458, -153191271875729544128575552, 25709033962120106517407536, 13273079500814614399892122, -3352397998641378076052014, -1969395595180132411073940, 816380125847849561708776, -474786203606817420148460, 277024202851992353422070, -79460875658277059697770, 24715216064579606069486], [145148953596669786547801528, -393155335888932187970393348, 530318426368218242023283456, -881528882580169504570534216, 1261789034942960358060536764, -1207738878885580826721033956, 692555336564099776580177818, -157562063031922873646387540, -52470279276469307261421184, 21354439084280983922373904, 7429238745089648407420266, -3679775915956289968074784, 1571156493433276621191208, -1291793086665807162924508, 321223890579875640949646, -130106052556950797355780], [-948191375097728418362664476, 1935825001234129541998511804, -2830934339193932474639480993, 4691038047271369875397782463, -6097981717619334251998696003, 5364246117903744242824857047, -2872720671982035201104284980, 558017997097579641379188182, 233702847930081684199658665, -74147872428604737899472801, -33483168646838080662868536, 15170187401690208428739514, -7674579346797568635198524, 5236363327383127844285983, -1407423641116043044984739, 496011314854612629237607], [4540575104313619678991709844, -9566286276612433994012056188, 13285935170750536715201328361, -20597844140725828676136780801, 25289442332085468235646887427, -20884504322289839082585178749, 10489955360444520150293545662, -1635974600572180699345050870, -926528130988712994027392201, 205473073451029032122966111, 130941855412527438772606814, -54517597014187311567946522, 32464050124625463133335476, -18468527778844345582183349, 5429645526017051627942601, -1616704394158454953703273], [-518021587644632004999733864, 1082580752062076026913195444, -1540230428741537897930332472, 2471016010147884355794089104, -3102265819152201974954549176, 2627341790001511721947146452, -1345616710449714098644922284, 221342755050324522216294260, 116809191218979853253523988, -28253227622269491985415116, -16326080972690283552664140, 6956242868611039002966124, -3994202810179077315449392, 2377104280783034795722072, -685391664748231303553084, 212457904015996007722308]];
    Rf_basisdens := [1, 4892795493193437786440127, 43737612461167616781, 53820750425127815650841397, 53820750425127815650841397, 53820750425127815650841397, 1630931831064479262146709, 1098382661737302360221253, 11795069338202997, 1098382661737302360221253, 698970784741919683777161, 1630931831064479262146709, 4892795493193437786440127, 17940250141709271883613799, 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, 1, 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], [-1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -1, -2, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0], [0, -1, 1, 0, 0, 0, 2, 0, 0, 0, 0, -1, 0, 0, 0, 1], [0, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0], [0, -2, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 1, 0, 0, 2], [0, 0, 0, 2, 0, 6, 0, -2, -1, 1, 0, 0, 0, 2, 0, 0], [-7, 2, 0, 0, 0, 0, -1, 0, 0, 0, -1, -1, 1, 0, 0, 0], [0, 0, 0, 0, 1, -6, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0], [0, 2, 0, 0, 0, 0, -1, 0, 0, 0, 5, 0, -2, 0, 0, -3], [0, 0, 0, 0, 3, 1, 0, 0, 6, 0, 0, 0, 0, -1, -1, 0], [0, 2, -2, 0, 0, 0, -1, 0, 0, 0, -3, 2, 0, 0, 0, 0], [0, 0, 0, -8, 0, 12, 0, 4, 4, 3, 0, 0, 0, 4, 0, 0], [0, 0, 0, 8, 0, -3, 0, 0, -4, 0, 0, 0, 0, -1, 0, 0], [0, 0, 0, 0, -1, -10, 0, 0, 2, 0, 0, 0, 0, 3, 2, 0], [0, 0, 0, 0, 0, 5, 0, 0, 10, 0, 0, 0, 0, -3, 4, 0], [0, 4, -1, 0, 0, 0, -3, 0, 0, 0, 7, 1, -3, 0, 0, 2], [10, 0, -2, 0, 0, 0, -2, 0, 0, 0, -2, -2, -2, 0, 0, 0], [-51, -2, 0, 0, 0, 0, 3, 0, 0, 0, 3, 3, 1, 0, 0, 0], [0, 0, 0, -4, 0, -6, 0, -1, 2, -9, 0, 0, 0, -2, 0, 0], [0, -1, 3, 0, 0, 0, 1, 0, 0, 0, 9, -3, -2, 0, 0, 8], [12, 5, 1, 0, 0, 0, -3, 0, 0, 0, -3, -3, 2, 0, 0, 0], [0, 0, 0, -2, 0, 6, 0, -10, 1, -7, 0, 0, 0, 2, 0, 0], [-61, 0, 9, 0, 0, 0, -2, 0, 0, 0, -2, -2, -2, 0, 0, 0], [0, 0, 0, 12, 0, 3, 0, -6, -6, 2, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 7, -10, 0, 0, -4, 0, 0, 0, 0, 3, -6, 0], [0, 6, -2, 0, 0, 0, 6, 0, 0, 0, -2, 2, -4, 0, 0, 0], [-47, -10, 6, 0, 0, 0, -3, 0, 0, 0, -3, -3, -13, 0, 0, 0], [0, 0, 0, -12, 0, -9, 0, 6, 6, -18, 0, 0, 0, -3, 0, 0], [0, -12, 6, 0, 0, 0, 3, 0, 0, 0, -3, -6, 6, 0, 0, -5], [0, 0, 0, 0, 0, -1, 0, 0, 28, 0, 0, 0, 0, 3, -8, 0], [0, 0, 0, -16, 0, 0, 0, 0, 8, 11, 0, 0, 0, 0, 0, 0], [-101, 12, -13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0], [0, 0, 0, 0, 7, 14, 0, 0, 23, 0, 0, 0, 0, -7, 0, 0], [0, 0, 0, 0, -3, -17, 0, 0, 14, 0, 0, 0, 0, 9, -7, 0], [0, -2, 3, 0, 0, 0, -2, 0, 0, 0, 10, -3, -1, 0, 0, -10], [0, 0, 0, -8, 0, -12, 0, -4, 4, -1, 0, 0, 0, -4, 0, 0], [0, 0, 0, -16, 0, 21, 0, 8, 8, 24, 0, 0, 0, 7, 0, 0], [0, 0, 0, 0, 1, 34, 0, 0, 13, 0, 0, 0, 0, -13, 4, 0], [0, -2, 8, 0, 0, 0, 7, 0, 0, 0, 21, -8, -6, 0, 0, -12], [-26, -12, 6, 0, 0, 0, 6, 0, 0, 0, 6, 6, -6, 0, 0, 0], [0, 0, 0, -6, 0, -18, 0, 6, 3, 13, 0, 0, 0, -6, 0, 0], [-69, 4, -17, 0, 0, 0, -4, 0, 0, 0, -4, -4, 0, 0, 0, 0], [0, 0, 0, 0, 2, 29, 0, 0, 48, 0, 0, 0, 0, -11, 2, 0], [-19, 14, 16, 0, 0, 0, -13, 0, 0, 0, -13, -13, 1, 0, 0, 0], [0, 0, 0, 28, 0, 6, 0, -9, -14, -17, 0, 0, 0, 2, 0, 0], [0, 0, 0, 0, 9, 18, 0, 0, -11, 0, 0, 0, 0, -5, -12, 0], [0, 23, -17, 0, 0, 0, -17, 0, 0, 0, -5, 17, -6, 0, 0, -18], [0, 6, -14, 0, 0, 0, -23, 0, 0, 0, -21, 14, 8, 0, 0, -8], [14, -8, 26, 0, 0, 0, 10, 0, 0, 0, 10, 10, 2, 0, 0, 0], [0, 0, 0, -4, 0, -30, 0, 7, 2, 31, 0, 0, 0, -10, 0, 0], [0, 2, -2, 0, 0, 0, 0, 0, 0, 0, -4, 2, 0, 0, 0, 10], [0, -16, 15, 0, 0, 0, 43, 0, 0, 0, -15, -15, 1, 0, 0, 10], [0, 0, 0, 0, 0, -24, 0, -8, 0, 7, 0, 0, 0, -8, 0, 0], [-115, -2, 8, 0, 0, 0, 11, 0, 0, 0, 11, 11, 9, 0, 0, 0], [0, 0, 0, 0, -7, 10, 0, 0, 4, 0, 0, 0, 0, -7, 18, 0], [0, 1, -7, 0, 0, 0, 9, 0, 0, 0, -35, 7, 6, 0, 0, 2], [0, 0, 0, 0, 14, -41, 0, 0, 46, 0, 0, 0, 0, 11, -6, 0], [0, 0, 0, -2, 0, -30, 0, 26, 1, -15, 0, 0, 0, -10, 0, 0], [0, 0, 0, 0, -14, -39, 0, 0, -10, 0, 0, 0, 0, 13, 14, 0], [0, 12, -11, 0, 0, 0, -13, 0, 0, 0, -7, 11, -1, 0, 0, -2], [44, 9, 19, 0, 0, 0, -1, 0, 0, 0, -1, -1, 8, 0, 0, 0], [0, 0, 0, -60, 0, 12, 0, -4, 30, -17, 0, 0, 0, 4, 0, 0], [0, 0, 0, 0, -12, 11, 0, 0, -2, 0, 0, 0, 0, -5, 16, 0], [-80, 9, -33, 0, 0, 0, -5, 0, 0, 0, -5, -5, 4, 0, 0, 0], [0, 0, 0, 4, 0, 42, 0, -17, -2, -9, 0, 0, 0, 14, 0, 0], [0, 0, 0, 0, 7, -2, 0, 0, 73, 0, 0, 0, 0, 1, -8, 0], [0, -12, 4, 0, 0, 0, -36, 0, 0, 0, 28, -4, 8, 0, 0, -4], [0, 0, 3, 0, 0, 0, 7, 0, 0, 0, 5, -3, -3, 0, 0, 18], [-47, -22, -8, 0, 0, 0, 15, 0, 0, 0, 15, 15, -7, 0, 0, 0], [0, 0, 0, 0, 17, 2, 0, 0, 53, 0, 0, 0, 0, -9, 8, 0], [0, 0, 0, 0, 1, 61, 0, 0, -14, 0, 0, 0, 0, -17, -11, 0], [0, -10, 12, 0, 0, 0, 11, 0, 0, 0, 17, -12, -2, 0, 0, -12], [0, 0, 0, 36, 0, 72, 0, 0, -18, 67, 0, 0, 0, 24, 0, 0], [0, 0, 0, 0, 23, -58, 0, 0, -62, 0, 0, 0, 0, 15, -10, 0], [0, -7, -1, 0, 0, 0, -14, 0, 0, 0, -4, 1, 8, 0, 0, -37], [-74, -28, -16, 0, 0, 0, 0, 0, 0, 0, 0, 0, -28, 0, 0, 0], [0, 0, 0, -48, 0, 60, 0, 29, 24, -3, 0, 0, 0, 20, 0, 0], [0, 0, 0, 0, -23, 2, 0, 0, -33, 0, 0, 0, 0, 7, 0, 0], [0, -42, 18, 0, 0, 0, 9, 0, 0, 0, -21, -18, 24, 0, 0, 40], [124, -11, 17, 0, 0, 0, -3, 0, 0, 0, -3, -3, -14, 0, 0, 0], [99, 36, -29, 0, 0, 0, -8, 0, 0, 0, -8, -8, 28, 0, 0, 0], [0, 0, 0, -80, 0, -72, 0, 13, 40, -51, 0, 0, 0, -24, 0, 0], [0, 23, -3, 0, 0, 0, 16, 0, 0, 0, 18, 3, -20, 0, 0, -13], [142, -8, 4, 0, 0, 0, -12, 0, 0, 0, -12, -12, -20, 0, 0, 0], [0, 0, 0, -62, 0, -18, 0, 22, 31, -19, 0, 0, 0, -6, 0, 0], [-103, 6, 2, 0, 0, 0, 1, 0, 0, 0, 1, 1, 7, 0, 0, 0], [0, 0, 0, 8, 0, -108, 0, 9, -4, -39, 0, 0, 0, -36, 0, 0], [0, -44, 24, 0, 0, 0, -10, 0, 0, 0, 18, -24, 20, 0, 0, -16], [303, 20, 41, 0, 0, 0, -6, 0, 0, 0, -6, -6, 14, 0, 0, 0], [0, 0, 0, 16, 0, 45, 0, -20, -8, -20, 0, 0, 0, 15, 0, 0], [0, 0, 0, 0, -2, -91, 0, 0, 16, 0, 0, 0, 0, 37, -18, 0], [0, -40, 17, 0, 0, 0, 1, 0, 0, 0, -13, -17, 23, 0, 0, 6], [0, 0, 0, 60, 0, 48, 0, 8, -30, -81, 0, 0, 0, 16, 0, 0], [0, -44, 22, 0, 0, 0, 3, 0, 0, 0, -3, -22, 22, 0, 0, 47], [0, 0, 0, 0, 11, 21, 0, 0, -88, 0, 0, 0, 0, -9, -5, 0], [0, 0, 0, 0, -1, 6, 0, 0, 108, 0, 0, 0, 0, -9, 22, 0], [0, 0, 0, 0, -15, -69, 0, 0, -80, 0, 0, 0, 0, 17, 33, 0], [0, 0, 0, 22, 0, 126, 0, 14, -11, 9, 0, 0, 0, 42, 0, 0], [0, 0, 0, -48, 0, 108, 0, -15, 24, -15, 0, 0, 0, 36, 0, 0], [0, 24, -2, 0, 0, 0, 29, 0, 0, 0, 11, 2, -22, 0, 0, -43], [0, 0, 0, 0, -2, 111, 0, 0, 42, 0, 0, 0, 0, -37, 2, 0], [40, -19, 75, 0, 0, 0, -9, 0, 0, 0, -9, -9, -28, 0, 0, 0], [0, 0, 0, -36, 0, -33, 0, -10, 18, -82, 0, 0, 0, -11, 0, 0], [0, -32, 28, 0, 0, 0, 50, 0, 0, 0, -2, -28, 4, 0, 0, 34], [0, -18, 13, 0, 0, 0, -32, 0, 0, 0, 48, -13, 5, 0, 0, -14], [-166, 8, 6, 0, 0, 0, 6, 0, 0, 0, 6, 6, 14, 0, 0, 0], [-175, -50, 90, 0, 0, 0, 17, 0, 0, 0, 17, 17, -33, 0, 0, 0], [0, 0, 0, 0, 17, -54, 0, 0, -58, 0, 0, 0, 0, 1, 34, 0], [0, 9, 5, 0, 0, 0, -17, 0, 0, 0, 55, -5, -14, 0, 0, 4], [0, 0, 0, 0, -8, -69, 0, 0, -110, 0, 0, 0, 0, 27, -4, 0], [455, -20, 57, 0, 0, 0, 2, 0, 0, 0, 2, 2, -18, 0, 0, 0], [0, 9, -13, 0, 0, 0, -56, 0, 0, 0, 22, 13, 4, 0, 0, -15], [0, 0, 0, 0, -63, 19, 0, 0, -36, 0, 0, 0, 0, 17, -7, 0], [0, 38, -21, 0, 0, 0, -42, 0, 0, 0, 34, 21, -17, 0, 0, 14], [0, 0, 0, 42, 0, 78, 0, -58, -21, 85, 0, 0, 0, 26, 0, 0], [0, 0, 0, 16, 0, -51, 0, -24, -8, 40, 0, 0, 0, -17, 0, 0], [0, 0, 0, 0, -7, 122, 0, 0, 86, 0, 0, 0, 0, -39, 2, 0], [36, -55, -11, 0, 0, 0, 17, 0, 0, 0, 17, 17, -38, 0, 0, 0], [0, 0, 0, 74, 0, 42, 0, -22, -37, -67, 0, 0, 0, 14, 0, 0], [0, 0, 0, 60, 0, -42, 0, 39, -30, -33, 0, 0, 0, -14, 0, 0], [0, 0, 0, 0, 35, -101, 0, 0, -38, 0, 0, 0, 0, 25, -9, 0], [0, 0, 0, 66, 0, -126, 0, -30, -33, -95, 0, 0, 0, -42, 0, 0], [0, 0, 0, 0, 65, 26, 0, 0, 36, 0, 0, 0, 0, -31, 2, 0], [0, -24, 26, 0, 0, 0, 86, 0, 0, 0, -30, -26, -2, 0, 0, -4], [411, -24, 17, 0, 0, 0, -2, 0, 0, 0, -2, -2, -26, 0, 0, 0], [0, 0, 0, 0, -57, -50, 0, 0, 75, 0, 0, 0, 0, 37, -4, 0], [0, 0, 0, 0, 20, -79, 0, 0, -140, 0, 0, 0, 0, 37, -52, 0], [0, -46, 27, 0, 0, 0, 0, 0, 0, 0, 16, -27, 19, 0, 0, 78], [-179, -30, 74, 0, 0, 0, -19, 0, 0, 0, -19, -19, -49, 0, 0, 0], [0, 0, 0, 0, 1, -14, 0, 0, 67, 0, 0, 0, 0, 15, -32, 0], [0, -54, 12, 0, 0, 0, -43, 0, 0, 0, -17, -12, 42, 0, 0, 35], [-114, 16, -102, 0, 0, 0, 10, 0, 0, 0, 10, 10, 26, 0, 0, 0], [0, 0, 0, -26, 0, -114, 0, -2, 13, 9, 0, 0, 0, -38, 0, 0], [0, 0, 0, 0, 51, 99, 0, 0, 110, 0, 0, 0, 0, -39, -33, 0], [0, 0, 0, 134, 0, -42, 0, -10, -67, 21, 0, 0, 0, -14, 0, 0], [0, -10, 12, 0, 0, 0, -33, 0, 0, 0, 61, -12, -2, 0, 0, 41], [0, 0, 0, 0, 19, -11, 0, 0, -88, 0, 0, 0, 0, 23, -77, 0], [0, 0, 0, 74, 0, -150, 0, 10, -37, -7, 0, 0, 0, -50, 0, 0], [-25, 60, -119, 0, 0, 0, -14, 0, 0, 0, -14, -14, 46, 0, 0, 0], [0, 0, 0, 60, 0, -129, 0, -38, -30, 34, 0, 0, 0, -43, 0, 0], [0, 0, 0, 0, 55, 78, 0, 0, 175, 0, 0, 0, 0, -39, -16, 0], [0, -56, 3, 0, 0, 0, -49, 0, 0, 0, -51, -3, 53, 0, 0, -22], [0, 0, 0, 0, 49, 82, 0, 0, 31, 0, 0, 0, 0, -29, -44, 0], [0, -36, 18, 0, 0, 0, 57, 0, 0, 0, -57, -18, 18, 0, 0, 33], [0, 0, 0, 0, -47, -107, 0, 0, 94, 0, 0, 0, 0, 47, 13, 0], [0, 54, -68, 0, 0, 0, -121, 0, 0, 0, -43, 68, 14, 0, 0, -68], [0, 0, 0, 0, -1, -66, 0, 0, -145, 0, 0, 0, 0, 29, -20, 0], [0, 58, -70, 0, 0, 0, -74, 0, 0, 0, -90, 70, 12, 0, 0, 8], [0, 0, 0, 0, -57, -161, 0, 0, -224, 0, 0, 0, 0, 65, 23, 0], [0, 64, -27, 0, 0, 0, -59, 0, 0, 0, 79, 27, -37, 0, 0, -42], [0, 0, 0, 0, -29, 49, 0, 0, -90, 0, 0, 0, 0, -1, -17, 0], [0, -30, 50, 0, 0, 0, 27, 0, 0, 0, 113, -50, -20, 0, 0, 88], [607, -20, 13, 0, 0, 0, -18, 0, 0, 0, -18, -18, -38, 0, 0, 0], [0, 69, -33, 0, 0, 0, -36, 0, 0, 0, 42, 33, -36, 0, 0, -51], [-200, -19, -35, 0, 0, 0, 9, 0, 0, 0, 9, 9, -10, 0, 0, 0], [0, 0, 0, 62, 0, -270, 0, 74, -31, -55, 0, 0, 0, -90, 0, 0], [0, 0, 0, 148, 0, 111, 0, -38, -74, -110, 0, 0, 0, 37, 0, 0], [0, 60, -38, 0, 0, 0, -35, 0, 0, 0, 3, 38, -22, 0, 0, -7], [-841, -20, 49, 0, 0, 0, 10, 0, 0, 0, 10, 10, -10, 0, 0, 0], [0, 0, 0, 12, 0, 18, 0, -109, -6, -85, 0, 0, 0, 6, 0, 0], [0, 71, -23, 0, 0, 0, 26, 0, 0, 0, 24, 23, -48, 0, 0, -115], [0, 32, -15, 0, 0, 0, 41, 0, 0, 0, -37, 15, -17, 0, 0, -2], [181, -94, -26, 0, 0, 0, 49, 0, 0, 0, 49, 49, -45, 0, 0, 0], [0, 0, 0, 0, -15, -54, 0, 0, 42, 0, 0, 0, 0, 45, -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_g();".
// 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_g(: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_g();".
// 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_g( : 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;