
// Make newform 1197.2.j.m in Magma, downloaded from the LMFDB on 22 May 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_1197_j();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_1197_j_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_1197_2_j_m();".
// 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_1197_2_j_m();".
// 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 := [256, 96, 1076, -294, 3427, -401, 2902, -101, 1743, -21, 534, -16, 118, -2, 13, 0, 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], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-4848988987567046720, 1178958338823643220, -23332822330525383270, 5117126955374168355, -23582770889516923889, 1093679734505135478, -14428361603695616645, 454288783689702735, -4577959923202710069, 146993906883715062, -990974763601782960, 18889749946768598, -110484051698484802, -253947244777939, -8183630901463360, 58831967328673], [650853082056288906, 4279306793251616, -29383756672265508, 132117534937979149, -110608391429834333, 100200488595597164, -146466106980153671, 59814827171867245, -47352708399441465, 20277347422946324, -12929206390481440, 4558885329941670, -1480929720400390, 480754785462561, -121908751271206, 38192915263935], [2899659058735329104, 369783366937297924, 4497755865335072406, -40280055778521003, 3995933852571636185, 549332106461749050, 1411613542818379157, -85997045824314951, 321030244099618245, -19640774367057462, 30109983085916064, -19373728549833518, 2525214963188266, -2609899817109413, -228304043811896, -348452801576113], [4713692994769524096, -1667780214419258772, 16027489832235777454, -7759407807510382587, 13053575931850368929, -5776245601811493166, 8190027710503165693, -3521032665589253191, 2513078766861552341, -1153106918916083094, 601718189770090528, -255540684668112662, 67460092517685066, -27285423292256237, 5009143213735848, -2145885379729169], [68668332151333408, 614962248902940540, 80149056771165884, 1924574941324425221, -50682326397315053, 1524134486822371520, 56389221270319409, 996661660893814953, 27405693909836047, 308501896735904974, -900515767588356, 70923002961802978, -290776232508840, 7896040219778341, 76385830527870, 626142901716981], [1011314580589448176, -279929058268314052, -5288591952277074270, 2085049429379831493, -6908805627969546083, 1820769351773713206, -4822815334821622091, 1485051003150061977, -1576988649146280951, 557355583051977762, -371513728557153816, 126920838981045794, -41463073626273634, 13875448541577359, -3006199452290428, 1075924803191539], [7335786758234254640, 552149112438808780, -12224674319923351614, 22498509044487443727, -22995978812706558085, 23710468516475817630, -10155264105074874721, 15868269063971110779, -2822345194027116993, 4940218363990167438, -508476706220025216, 1053180500464633030, -48279925654639346, 114825991572243745, -1047707995741160, 8394848857362605], [-815029669563857568, 1667780214419258772, -14727935390500555278, 7759407807510382587, -13053575931850368929, 5776245601811493166, -8190027710503165693, 3521032665589253191, -2513078766861552341, 1153106918916083094, -601718189770090528, 255540684668112662, -67460092517685066, 27285423292256237, -5009143213735848, 2145885379729169], [2658471587230075776, -23935205753681241460, 9362689276194422246, -1731277998446049959, 4117994537091722693, 4906142949487792314, 4742341270308574977, 8553288360553725725, 1932571771789537273, 3094474400089210514, 439913169984420256, 835721814541779074, 51683499284884898, 99996871482980447, 6383676671345528, 8460360918821435], [934627853439632256, 4002827951385293564, 3118284146694505030, -2049856036630194839, 3753163113403666773, -2730845878257477350, 1637205457644383201, -2845927702574635923, 422639712570256889, -954693833276226862, 105900407819171328, -240840785150178158, 12461136816920114, -27229685442648593, 495405685296776, -2300317864905221], [2002616988091115904, 17497621277669387708, 6373759045074143294, -7444713436449673763, 12780089037498783161, -15438747779630351262, 4210059106092116805, -17752015355785258063, 855751480885727581, -6415269751070391718, 389608133855379520, -1663865474167047382, 50116646708687306, -192632882049956389, 1279399133860088, -16209963227398873], [3885517347237860384, 24678429459840255036, 11636840137228983918, 74254494635612222881, 12487860697968112149, 69159850832671641122, 11780994248148259497, 37702821334136582341, 3532037442177591657, 11130272712922525394, 642063090192980912, 2275224887453053522, 71337326419438266, 246545904636165535, 8502078112790352, 17544793681228859], [-9817179804918632504, -16630771799539948708, -30774498167008654824, -51459973954540475637, -29973962287789075367, -46998762881737821612, -20671164443695430657, -30034315484087453865, -6867726518155602255, -9304039868070924222, -1254489689011962012, -2138471102993227030, -134654190054387484, -240935155062433561, -12667034227471966, -18827840128226657], [-6737058545433430752, -38354483754675246564, -30172011221283263434, -113733738832006988487, -28464156090283972331, -101461406480277484022, -24035230990773108079, -59256394643020182275, -7968189780768829127, -17879410163670206766, -1414069651780337824, -3930974228686586830, -150389692718435550, -436280790339963889, -16848666241229544, -33310648856689957]];
    Rf_basisdens := [1, 1, 1670855710802428512, 243666457825354158, 835427855401214256, 3898663325205666528, 487332915650708316, 835427855401214256, 5847994987808499792, 1299554441735222176, 3898663325205666528, 556951903600809504, 3898663325205666528, 3898663325205666528, 2923997493904249896, 3898663325205666528];
    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_1197_j();"
function MakeCharacter_1197_j()
    N := 1197;
    order := 3;
    char_gens := [533, 514, 1009];
    v := [3, 2, 3];
    // 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_1197_j_Hecke();"
function MakeCharacter_1197_j_Hecke(Kf)
    N := 1197;
    order := 3;
    char_gens := [533, 514, 1009];
    char_values := [[1, 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], [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 := 2;
    raw_aps := [[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, -1, 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, 1, 0, 0, 0, -1, 0, -1], [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1], [0, 0, 0, 1, -1, 0, 0, 2, -1, -2, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, -1, 0, -1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0], [-1, 2, 1, 0, 0, 0, -2, 0, -1, -1, 0, 0, -1, 1, 0, 0], [2, 0, -1, 1, -1, -2, -2, 1, -1, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 1, -2, 0, 0, -1, 0, 2, 0, 0, 0, 0, 0], [1, 2, 1, 0, -1, 1, -2, -3, 1, 1, 1, 3, -1, 1, -1, 3], [0, -2, 2, 0, 1, 1, 2, -1, 0, 0, 1, 0, -1, 1, -1, 0], [0, -2, 1, 1, 0, -2, 0, -1, 1, -1, 1, -1, 1, 0, 0, 0], [-1, 0, 2, -2, 2, 1, 2, 0, 2, 2, 0, 0, 0, 0, 0, -1], [-2, 0, 1, 1, -1, 2, -2, 1, -1, -2, 0, 0, 0, 1, -1, 0], [0, 0, -1, 1, 1, -1, 0, 1, -2, -1, -1, 0, -1, 0, 0, 0], [-2, 0, 1, -1, 1, 2, 0, 0, 1, 1, 0, 0, 0, 1, 0, -1], [-5, 2, 3, -2, 2, 1, -2, 0, -1, -1, 1, 2, -2, 2, -1, 2], [1, 0, 1, -1, 1, -1, 0, 0, 1, -2, 0, 0, 0, 2, 0, -1], [0, 2, 0, 2, 1, 0, 0, 0, -1, -2, -2, 0, 0, 0, 0, 0], [7, -4, -2, 2, 0, -1, 4, 2, 0, 0, -1, -2, 3, -3, 1, -2], [0, 0, 2, 0, -1, 0, 0, -2, 3, 0, 0, 2, -2, 0, 0, 0], [-2, 4, 0, -2, -1, 1, -4, -3, 2, 2, 1, 5, -2, 2, -1, 5], [1, 0, 1, -3, 3, -1, 2, -1, 3, 2, 0, 0, 0, -3, 1, 0], [0, -2, 1, 0, -1, 3, 0, -1, 2, 0, 1, -1, 0, 0, 0, 0], [0, 0, -2, -1, -2, -4, 0, 2, 0, 1, -3, 1, -1, 0, 0, 0], [-6, 0, -2, 1, -1, 6, 0, -2, -1, 1, 0, 0, 0, -1, -1, 2], [6, 0, 0, 0, 0, 1, 0, -2, 2, 2, 1, -2, 3, -3, -1, -2], [3, 0, 0, 2, 0, 1, 0, -2, 2, 2, 1, -1, 1, -1, -1, -1], [0, 0, -1, -1, -2, 0, 0, 1, 1, 1, 1, 0, 2, 0, 0, 0], [-1, 0, 2, 0, 0, 1, -2, 2, 0, -3, 0, 0, 0, 3, 0, 0], [-3, 4, 3, -1, 1, 1, -4, -1, -1, -1, 1, 2, 0, 0, -1, 2], [0, -2, 1, -1, 1, -5, 0, -1, 0, 1, 0, -1, 2, 0, 0, 0], [-2, 0, -1, -1, 1, 2, 0, 0, 1, 3, 0, 0, 0, -1, 2, -1], [5, 0, -1, 1, -1, -5, 0, 3, -1, 2, 0, 0, 0, 3, 3, -2], [0, 4, 2, -2, 0, 1, 0, -2, 2, 2, 2, 2, -2, 0, 0, 0], [9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -2, 2, 0, 1], [0, -2, -2, 0, 3, -1, 0, 2, -5, 0, -2, -1, 0, 0, 0, 0], [7, 0, -4, 2, -2, -7, -4, 0, -2, 0, 0, 0, 0, -2, 2, -1], [6, 2, 0, 0, 2, -1, -2, 4, -2, -2, -1, -2, 1, -1, 1, -2], [0, 0, 1, 1, -2, -7, 0, -1, 3, -1, 0, -1, 0, 0, 0, 0], [-2, 0, 1, -2, 2, 2, 6, 2, 2, 2, 0, 0, 0, -2, 3, -1], [4, 2, 4, 2, 4, 1, -2, 2, -2, -2, 1, 1, -1, 1, -1, 1], [4, 0, -1, 1, -1, -4, -4, -1, -1, 0, 0, 0, 0, 2, -1, 3], [-2, 0, 8, -4, 7, 3, 0, 1, -2, -2, 3, -1, -2, 2, -3, -1], [-3, 0, -2, 6, -1, -2, 0, 3, -2, -2, -2, -6, -1, 1, 2, -6], [-5, 0, -6, 5, -5, 5, -4, 0, -5, 1, 0, 0, 0, -1, 1, -1], [0, -10, 1, 0, 0, 0, 0, -1, 1, 0, 2, -3, 3, 0, 0, 0], [0, -2, -5, 9, -1, -6, 0, 5, -4, -9, -3, -2, 2, 0, 0, 0], [5, -4, 3, -1, 5, 1, 4, 3, -1, -1, 1, -1, 1, -1, -1, -1], [-3, 0, 3, -2, 2, 3, -2, 1, 2, -1, 0, 0, 0, 0, 0, 3], [0, 0, 2, -2, 2, 1, 0, 0, 0, 0, 1, -1, -4, 4, -1, -1], [0, 0, 3, 1, 2, 0, 0, -3, 1, -1, 2, -3, -1, 0, 0, 0], [-1, 0, -2, -1, 1, 1, -10, -2, 1, 0, 0, 0, 0, 1, 1, 3], [-11, 0, 5, -2, 2, 11, 0, 2, 2, -2, 0, 0, 0, 2, -1, -2], [0, -4, 1, 1, 2, 7, 0, -1, -1, -1, 2, -1, -3, 0, 0, 0], [2, 0, -2, 5, -5, -2, 0, 6, -5, -10, 0, 0, 0, 2, 3, 1], [5, -2, 1, 4, 4, -3, 2, 10, -7, -7, -3, -4, 2, -2, 3, -4], [2, 0, 2, 0, 0, -2, 0, 2, 0, 4, 0, 0, 0, -5, 0, -3], [3, -4, 0, 6, 2, -2, 4, 6, -4, -4, -2, -3, 0, 0, 2, -3], [1, 10, 1, 2, 1, -2, -10, 5, -5, -5, -2, 3, -6, 6, 2, 3], [-1, 0, -1, -3, 3, 1, 0, -3, 3, 5, 0, 0, 0, 3, 1, -1], [0, 2, 3, -3, 0, 4, 0, -3, 3, 3, 0, 0, 1, 0, 0, 0], [0, 4, 2, -4, 5, -2, 0, -2, -3, 4, 0, 2, -4, 0, 0, 0], [0, -4, -2, 3, 0, -12, 0, 2, -2, -3, -1, 1, 1, 0, 0, 0], [1, 4, 0, 0, -1, -2, -4, 3, -4, -4, -2, 0, -3, 3, 2, 0], [0, 0, -3, 4, -4, 0, 4, 1, -4, -5, 0, 0, 0, -3, 0, -1], [5, 0, -3, -7, -4, 3, 0, -10, 9, 9, 3, 2, 4, -4, -3, 2], [-5, 0, 7, -8, 8, 5, 0, -3, 8, 7, 0, 0, 0, -2, -2, -3], [0, 4, -2, 2, 0, -3, 0, 2, -2, -2, 1, -1, -2, 0, 0, 0], [0, 0, 1, -3, 3, 0, 0, -3, 3, 0, 0, 0, 0, -1, -1, 0], [0, 2, 0, -4, 0, -13, 0, 0, 0, 4, -2, 1, -6, 0, 0, 0], [-3, 0, -10, 2, -5, -6, 0, 7, -2, -2, -6, -4, -1, 1, 6, -4], [0, -4, -5, 2, -3, -4, 0, 5, -2, -2, 1, 0, 6, 0, 0, 0], [-2, 0, 9, -3, 3, 2, 6, 0, 3, -4, 0, 0, 0, 1, -6, -1], [0, -8, -2, 7, -3, 18, 0, 2, 1, -7, -2, -4, 4, 0, 0, 0], [0, -2, 4, -3, 1, 1, 0, -4, 3, 3, 5, 4, 1, 0, 0, 0], [-2, 0, 4, -5, 5, 2, 6, -5, 5, 8, 0, 0, 0, -7, -4, -1], [-1, 0, 5, -6, 0, 2, 0, -4, -1, -1, 2, 1, -1, 1, -2, 1], [3, 0, -2, 8, 1, -2, 0, 5, -2, -2, -2, -6, 5, -5, 2, -6], [-9, 0, 2, -3, 3, 9, 2, -2, 3, -1, 0, 0, 0, -1, -1, 1], [3, 4, -1, 0, 1, -1, -4, 3, -1, -1, -1, -3, 5, -5, 1, -3], [0, 2, -7, 3, -2, 6, 0, 7, -5, -3, -2, -3, 3, 0, 0, 0], [0, -2, -3, 3, 2, -5, 0, 3, -5, -3, 1, 1, 2, 0, 0, 0], [11, 2, 5, -2, 2, 2, -2, -2, -1, -1, 2, 0, 3, -3, -2, 0], [0, 2, 4, -9, 0, 6, 0, -4, 4, 9, 4, 5, 3, 0, 0, 0], [-11, 0, 5, -7, 4, 4, 0, -4, 3, 3, 4, 1, -4, 4, -4, 1], [-4, 2, 5, -7, 0, 5, -2, -10, 5, 5, 5, 8, -1, 1, -5, 8], [0, 0, 5, -6, 0, 0, 0, -5, 5, 6, 6, 6, 2, 0, 0, 0], [-8, 0, -3, -1, 1, 8, 0, -5, 1, 4, 0, 0, 0, -5, -1, 5], [5, 0, 2, -5, 5, -5, 4, -5, 5, 2, 0, 0, 0, 1, -2, 0], [-10, 2, 9, -8, 6, 6, -2, -6, 3, 3, 6, 2, 3, -3, -6, 2], [0, -2, -2, -1, 3, -11, 0, 2, -5, 1, -1, -3, 2, 0, 0, 0], [15, -6, -4, 4, -3, 0, 6, -3, 4, 4, 0, -1, 3, -3, 0, -1], [0, -2, 7, -4, 5, -10, 0, -7, 2, 4, 1, 2, -4, 0, 0, 0], [-1, 0, -1, 2, -2, 1, 4, 1, -2, 5, 0, 0, 0, 0, 0, -1], [0, -4, -3, -2, 1, 3, 0, 3, -4, 2, -3, -3, 2, 0, 0, 0], [0, 2, 1, 0, 0, -4, 0, -1, 1, 0, -3, 1, 7, 0, 0, 0], [-6, -2, -2, 8, -1, -2, 2, 3, -2, -2, -2, -1, -3, 3, 2, -1], [0, 0, -6, 6, -6, 0, -6, 6, -6, -10, 0, 0, 0, 3, 6, -1], [-3, 0, 0, 1, -1, 3, 6, 1, -1, 0, 0, 0, 0, 5, 0, 0], [0, 2, -4, -3, -4, 1, 0, 4, 0, 3, -1, -4, 1, 0, 0, 0], [16, 0, 0, 1, -1, -16, 4, -1, -1, -4, 0, 0, 0, 3, -2, 2], [-5, 0, -1, 2, -2, 5, -10, -2, -2, -1, 0, 0, 0, 5, -3, 9], [13, 4, -6, -1, -6, -4, -4, 2, -2, -2, -4, 3, 0, 0, 4, 3], [0, 0, -4, 6, 1, -1, 0, 4, -5, -6, -8, -4, -2, 0, 0, 0], [-2, 0, 0, 4, -4, 2, 6, 3, -4, -7, 0, 0, 0, 4, -1, -1], [16, -12, -6, 8, -3, -4, 12, 5, -2, -2, -4, -5, 7, -7, 4, -5], [0, 6, 5, 0, 1, 10, 0, -5, 4, 0, 1, 6, 2, 0, 0, 0], [0, 0, -3, 5, -5, 0, -10, -1, -5, -5, 0, 0, 0, -5, -3, 2], [17, 4, -4, -2, -7, 0, -4, -7, 4, 4, 0, 3, 6, -6, 0, 3], [5, 0, 4, -1, 1, -5, -2, 3, 1, 0, 0, 0, 0, -5, 0, -5], [-9, 12, -6, -4, -6, -3, -12, 0, 0, 0, -3, 4, -8, 8, 3, 4], [0, 0, -3, 3, -3, 0, -2, 0, -3, -5, 0, 0, 0, 5, 0, 7], [7, -6, -3, 3, -1, -2, 6, 3, -1, -1, -2, -3, 10, -10, 2, -3], [-5, 0, 5, -1, 1, 5, 12, 0, 1, -1, 0, 0, 0, -2, -4, -5], [0, -14, 1, 5, -1, 6, 0, -1, 2, -5, 1, -4, 0, 0, 0, 0], [-4, 2, -11, 2, -12, -3, -2, -6, 5, 5, -3, 1, 0, 0, 3, 1], [-13, 0, 0, 0, 0, 13, 6, 4, 0, -6, 0, 0, 0, 6, 4, 3], [4, -6, -6, 0, -1, -2, 6, 3, 2, 2, -2, -1, 3, -3, 2, -1], [0, -4, 3, -7, 0, -10, 0, -3, 3, 7, 0, 3, 1, 0, 0, 0], [-3, 0, -2, 3, -3, 3, -8, 2, -3, -13, 0, 0, 0, 7, 1, 5], [0, 6, -4, 2, -6, 3, 0, 4, 2, -2, 1, 2, 3, 0, 0, 0], [8, -4, 2, 6, 2, 0, 4, 2, -2, -2, 0, -5, 4, -4, 0, -5], [0, -12, -3, 1, 1, -6, 0, 3, -4, -1, 0, 0, -5, 0, 0, 0], [0, 6, 3, -5, 1, 2, 0, -3, 2, 5, 1, 4, 6, 0, 0, 0], [-14, -2, 2, 2, 6, 1, 2, 4, 0, 0, 1, -3, 0, 0, -1, -3], [0, 10, 2, -10, 5, -12, 0, -2, -3, 10, 2, 4, -8, 0, 0, 0], [-7, 0, 4, -6, 6, 7, 16, -5, 6, 6, 0, 0, 0, 0, -3, -4], [-2, 10, 5, -4, 7, 1, -10, 5, -3, -3, 1, 0, 1, -1, -1, 0], [0, -2, -5, 5, -3, -2, 0, 5, -2, -5, -6, -5, -3, 0, 0, 0], [-2, 6, 2, -7, 6, 2, -6, 2, 2, 2, 2, -1, 3, -3, -2, -1], [0, 10, 8, 0, 1, 7, 0, -8, 7, 0, 2, 6, -5, 0, 0, 0], [-1, 2, 9, 4, 4, 1, -2, 2, -7, -7, 1, -1, 1, -1, -1, -1], [13, 0, 0, 2, -2, -13, 4, 5, -2, 9, 0, 0, 0, 0, 3, -2], [-3, 0, 0, 2, -2, 3, -10, 2, -2, -4, 0, 0, 0, -2, 0, -1], [-8, 10, -8, 10, -8, -6, -10, 4, -4, -4, -6, -2, 4, -4, 6, -2], [3, 0, 1, 0, 0, -3, 10, 4, 0, 2, 0, 0, 0, 1, 3, 3], [-5, -14, 1, -2, 0, 2, 14, -4, 3, 3, 2, 0, -1, 1, -2, 0], [0, 0, 0, 0, -2, -5, 0, 0, 2, 0, -7, 1, 6, 0, 0, 0], [7, 0, -1, 5, -5, -7, 8, 2, -5, 2, 0, 0, 0, 6, -2, -1], [21, -2, -10, 6, -2, -5, 2, 8, 0, 0, -5, -9, 7, -7, 5, -9], [0, 0, -9, 0, 0, 0, 8, -5, 0, 5, 0, 0, 0, -10, 4, 0], [12, 0, 2, -8, 4, 2, 0, 0, 2, 2, 2, 2, 0, 0, -2, 2], [-10, 4, -3, -2, -4, 2, -4, -8, 7, 7, 2, 8, 1, -1, -2, 8], [2, 0, -4, 0, 0, -2, 6, -6, 0, 8, 0, 0, 0, -2, -2, -6], [0, -2, 3, -5, -2, 17, 0, -3, 5, 5, 0, -3, -2, 0, 0, 0], [0, 12, -4, -1, 2, -6, 0, 4, -6, 1, -1, 9, -5, 0, 0, 0], [0, 0, 5, -3, 1, -7, 0, -5, 4, 3, 4, 10, -5, 0, 0, 0], [-9, 14, 0, -1, -5, -1, -14, -3, -2, -2, -1, 6, -6, 6, 1, 6], [-3, -12, 0, -3, -2, 0, 12, -2, 0, 0, 0, 1, 0, 0, 0, 1], [0, -6, -9, 7, -4, -12, 0, 9, -5, -7, -2, -5, -3, 0, 0, 0], [-3, 0, -6, 6, -6, 3, -2, 1, -6, -11, 0, 0, 0, 6, 1, 0], [20, 4, -4, 2, -7, 0, -4, -7, 4, 4, 0, 3, -1, 1, 0, 3], [0, -2, -1, 2, -3, 2, 0, 1, 2, -2, 1, 1, 0, 0, 0, 0], [0, -12, -7, 10, -5, -10, 0, 7, -2, -10, -3, -13, 2, 0, 0, 0], [13, -2, 11, 12, 6, 3, 2, 0, -5, -5, 3, -5, 5, -5, -3, -5], [15, 0, -4, 3, -3, -15, 0, 8, -3, 5, 0, 0, 0, -3, 9, -9], [0, -4, 3, -1, -4, 14, 0, -3, 7, 1, 4, -5, 7, 0, 0, 0], [2, -2, -2, -2, 2, -1, 2, 4, 0, 0, -1, 2, -3, 3, 1, 2], [6, 14, 0, -10, 1, -1, -14, 3, -2, -2, -1, 7, -12, 12, 1, 7], [0, -10, 4, 0, 2, 6, 0, -4, 2, 0, 6, 2, 0, 0, 0, 0], [-2, 0, 6, 3, -3, 2, 0, 8, -3, -15, 0, 0, 0, 3, -1, 0], [-19, 0, -5, 2, -2, 19, -10, -5, -2, -1, 0, 0, 0, -4, -2, 3], [8, 0, -4, -1, 1, -8, -2, -2, 1, 11, 0, 0, 0, -5, 3, 0], [6, 0, 7, -4, 4, -6, 0, 2, 4, -3, 0, 0, 0, 0, -1, -3], [10, 6, -3, 8, -7, 3, -6, -13, 9, 9, 3, -2, 5, -5, -3, -2], [0, 2, -6, 4, -2, -4, 0, 6, -4, -4, -3, -8, -2, 0, 0, 0], [-4, 0, 1, -5, 5, 4, 0, -8, 5, 11, 0, 0, 0, -1, -4, 3], [4, -8, -4, 4, 1, -6, 8, 13, -8, -8, -6, -5, -5, 5, 6, -5], [0, -8, -6, 12, 0, -8, 0, 6, -6, -12, -2, -4, 4, 0, 0, 0], [-25, 0, 3, -5, 5, 25, -8, -5, 5, -4, 0, 0, 0, 9, -3, 6], [-6, 0, 0, 6, -6, 6, 0, 6, -6, -8, 0, 0, 0, -2, 0, -6], [-23, 12, 4, -8, 2, 4, -12, -6, 4, 4, 4, 2, -1, 1, -4, 2], [3, 0, 11, -2, 6, 9, 0, -12, 7, 7, 9, -5, 2, -2, -9, -5], [-11, 0, 8, 0, 0, 11, 0, 5, 0, -1, 0, 0, 0, -1, -3, -9], [8, 8, -7, 6, -6, -3, -8, 0, 1, 1, -3, 5, 2, -2, 3, 5], [0, -8, 0, -1, -7, -8, 0, 0, 7, 1, -2, 3, -3, 0, 0, 0], [0, 4, 1, 7, 0, 18, 0, -1, 1, -7, 4, -2, 16, 0, 0, 0], [-2, 8, -5, -6, -1, -1, -8, 1, 3, 3, -1, 6, -3, 3, 1, 6], [19, 2, -1, -10, -4, 3, -2, -10, 7, 7, 3, -4, 10, -10, -3, -4], [0, -6, -12, 6, -4, 6, 0, 12, -8, -6, -2, -4, 2, 0, 0, 0], [0, 0, 1, 2, -2, 0, 0, 9, -2, 4, 0, 0, 0, 0, 6, -12], [6, 0, -4, 4, -4, -6, -14, -3, -4, 0, 0, 0, 0, -6, -3, 5], [-7, 0, 8, -8, 8, 7, 0, -1, 8, 11, 0, 0, 0, -8, -1, -6], [-7, 0, 6, -5, 5, 7, -2, -8, 5, -1, 0, 0, 0, -3, -9, -1], [0, -18, 0, 8, 0, 13, 0, 0, 0, -8, -2, -1, 10, 0, 0, 0], [-18, 0, -4, 8, -8, 18, -8, 9, -8, -13, 0, 0, 0, -2, 5, 0], [0, -8, 2, 7, -4, 9, 0, -2, 6, -7, -3, -4, -1, 0, 0, 0], [1, -6, 1, -1, 7, 4, 6, -1, 7, 7, 4, -5, 6, -6, -4, -5], [0, -6, -2, 0, -2, -22, 0, 2, 0, 0, -2, 2, -12, 0, 0, 0], [0, -2, 4, 2, 1, 8, 0, -4, 3, -2, 2, 6, 0, 0, 0, 0], [3, 0, 6, -1, 1, -3, -4, 2, 1, -3, 0, 0, 0, 3, -3, 5], [-4, 0, 5, -5, 5, 4, -8, -1, 5, 4, 0, 0, 0, 5, -1, 4], [3, 0, 0, -4, 4, -3, -10, -7, 4, 15, 0, 0, 0, -5, -3, 1], [0, 0, -5, 6, 0, 6, 0, 5, -5, -6, -7, -5, 10, 0, 0, 0], [0, 10, -20, 12, -17, -11, -10, 5, -2, -2, -11, 4, 0, 0, 11, 4], [0, 14, -2, 5, 1, -2, 0, 2, -3, -5, -1, 6, 0, 0, 0, 0], [11, 0, -3, 0, 0, -11, 16, 2, 0, 10, 0, 0, 0, -4, 5, -4], [-19, 2, 11, -12, 5, 4, -2, -3, -3, -3, 4, 9, -8, 8, -4, 9], [0, 18, -2, 2, 1, 11, 0, 2, -3, -2, -2, 5, -2, 0, 0, 0], [-7, 0, -2, 5, -5, 7, 0, 3, -5, -4, 0, 0, 0, 5, 0, 2], [-22, -8, -4, 2, 1, 0, 8, 1, 4, 4, 0, -5, -5, 5, 0, -5], [-17, 0, -2, 3, -3, 17, 0, 6, -3, -14, 0, 0, 0, 12, 5, 6], [0, -8, -3, 2, 2, 11, 0, 3, -5, -2, 0, 3, 4, 0, 0, 0], [0, -8, -1, 6, 5, 1, 0, 1, -6, -6, 5, -3, 0, 0, 0, 0], [-4, -6, -3, -5, -4, -1, 6, -2, 1, 1, -1, 1, -8, 8, 1, 1], [-5, 0, -5, 11, -11, 5, -4, 5, -11, -6, 0, 0, 0, -7, -1, 9], [0, 18, 9, -1, -5, 23, 0, -9, 14, 1, 0, 3, 5, 0, 0, 0], [-19, -4, 2, 2, 0, -1, 4, 2, -4, -4, -1, -7, 1, -1, 1, -7], [0, -12, 8, 5, 11, -1, 12, 13, -10, -10, -1, 0, -1, 1, 1, 0], [0, -4, -8, 2, -12, -13, 0, 8, 4, -2, -10, 1, 6, 0, 0, 0], [-14, 0, 6, -8, 8, 14, 10, -7, 8, -3, 0, 0, 0, -6, -5, -5], [0, 6, 6, -5, 4, -28, 0, -6, 2, 5, -1, 5, -1, 0, 0, 0], [19, 0, -2, 1, -1, -19, 6, -2, -1, -1, 0, 0, 0, -7, -1, -12], [-9, 0, -1, -2, 2, 9, 2, -5, 2, 3, 0, 0, 0, -8, -2, -3], [0, 12, 2, -7, 7, -7, 0, -2, -5, 7, 1, 2, -13, 0, 0, 0], [12, 10, -8, 1, -2, -5, -10, 8, -2, -2, -5, -9, 2, -2, 5, -9], [0, 16, 0, 0, -2, -7, 0, 0, 2, 0, 2, -1, 2, 0, 0, 0], [-23, 0, 4, -4, -2, 5, 0, -12, 6, 6, 5, 3, -5, 5, -5, 3], [0, 10, 5, -2, 7, -18, 0, -5, -2, 2, 3, 10, 2, 0, 0, 0], [0, -12, -12, 4, -4, 8, 0, 12, -8, -4, -3, -5, 9, 0, 0, 0], [-10, -4, 0, -4, 2, 1, 4, 0, 2, 2, 1, 2, -9, 9, -1, 2], [-26, -6, -7, -16, 3, 0, 6, 3, 7, 7, 0, 1, 9, -9, 0, 1], [0, 12, 3, -12, -8, 3, 0, -3, 11, 12, 1, 7, 2, 0, 0, 0], [16, 0, -6, 6, -6, -16, -2, 1, -6, -1, 0, 0, 0, -2, 1, -3], [0, 4, 7, 1, -4, 10, 0, -7, 11, -1, 4, -7, 1, 0, 0, 0], [0, 2, 2, 6, 3, 15, 0, -2, -1, -6, -6, -4, -5, 0, 0, 0], [10, 0, 1, -10, 10, -10, 2, -9, 10, 19, 0, 0, 0, -11, 0, -1], [0, 0, -12, 8, -8, 0, -2, 3, -8, 3, 0, 0, 0, 2, 7, 1], [16, -10, 6, 0, 1, 4, 10, -7, 2, 2, 4, -7, 5, -5, -4, -7], [8, 0, -1, 4, -4, -8, -10, -2, -4, 4, 0, 0, 0, -6, -5, -1], [-34, 6, 8, -21, 7, 6, -6, -5, 4, 4, 6, 7, -9, 9, -6, 7], [-12, 0, -1, 2, -2, 12, 0, 3, -2, -6, 0, 0, 0, 0, 2, -4], [0, 10, -4, 6, -4, -11, 0, 4, 0, -6, -6, 2, -9, 0, 0, 0], [0, 2, 6, -1, 3, -29, 0, -6, 3, 1, 6, 1, 4, 0, 0, 0], [-6, 6, 0, -6, 1, -3, -6, 7, -6, -6, -3, 2, -4, 4, 3, 2], [-1, -10, 3, -2, 12, -1, 10, 14, -5, -5, -1, -4, 0, 0, 1, -4], [-2, 0, 10, -4, 4, 2, 0, 7, 4, 3, 0, 0, 0, 8, 1, -7], [0, 20, 2, -2, -7, 13, 0, -2, 9, 2, -2, 4, 9, 0, 0, 0], [6, 0, 8, -11, 11, -6, 8, -12, 11, 19, 0, 0, 0, -13, -9, 5], [0, -12, -3, 6, -4, -1, 0, 3, 1, -6, 3, -3, -2, 0, 0, 0], [-9, 0, -5, 0, -2, -2, 0, 2, 1, 1, -2, 0, -13, 13, 2, 0], [0, -14, 0, -3, -1, 12, 0, 0, 1, 3, 0, -9, -1, 0, 0, 0], [-15, -4, -8, 1, -1, -4, 4, 7, 0, 0, -4, -10, -1, 1, 4, -10], [21, 0, -6, 4, -4, -21, -4, -2, -4, 12, 0, 0, 0, -8, 0, -7], [6, 0, -11, 17, -17, -6, -14, 9, -17, -18, 0, 0, 0, 15, 3, 4], [1, -14, -2, -7, 3, 4, 14, -5, 10, 10, 4, -3, 10, -10, -4, -3], [2, 14, -8, 4, -13, -8, -14, 3, -8, -8, -8, 2, -5, 5, 8, 2], [0, -20, 0, 1, 1, 28, 0, 0, -1, -1, 4, -2, 6, 0, 0, 0], [17, 0, -1, -1, 1, -17, 10, -7, 1, -4, 0, 0, 0, -1, -5, -1], [-2, 12, 0, -8, -1, -6, -12, 11, -12, -12, -6, 5, -7, 7, 6, 5], [13, 0, -2, -9, 9, -13, 4, -11, 9, 13, 0, 0, 0, 2, 0, 3], [0, 0, -4, 0, -1, -17, 0, 4, -3, 0, 0, 6, 0, 0, 0, 0], [10, 0, 6, -5, 5, -10, 12, 8, 5, 6, 0, 0, 0, 4, 7, -5], [-15, 0, -5, 3, -3, 15, -12, 2, -3, 1, 0, 0, 0, -11, 4, 2], [10, 0, 2, -8, 3, 1, 0, 1, 0, 0, 1, -3, -12, 12, -1, -3], [0, -2, -4, 4, 6, -7, 0, 4, -10, -4, -2, -3, -8, 0, 0, 0], [-11, 0, 5, 3, -3, 11, -20, 6, -3, -15, 0, 0, 0, 9, -2, 2], [1, 6, 3, 14, -2, -3, -6, 4, -9, -9, -3, -4, 6, -6, 3, -4], [-26, 0, 3, 4, -4, 26, 0, 3, -4, -10, 0, 0, 0, 0, -4, 4], [5, 8, -9, -4, -5, -7, -8, 9, -5, -5, -7, -1, -11, 11, 7, -1], [-12, 0, -6, 0, 0, 12, 10, -7, 0, 5, 0, 0, 0, -5, -1, 2], [0, 10, 7, -20, 6, -20, 0, -7, 1, 20, 3, 10, -12, 0, 0, 0], [13, -2, -1, 2, -3, -1, 2, -1, -1, -1, -1, 11, -3, 3, 1, 11], [-11, -8, -10, 1, -1, -7, 8, 13, -4, -4, -7, -5, 3, -3, 7, -5], [2, 6, 6, 20, 2, -3, -6, 8, -12, -12, -3, -10, -3, 3, 3, -10], [-31, 0, 14, -12, 12, 31, -4, -3, 12, 11, 0, 0, 0, -7, -5, 7], [0, 12, 7, -10, 0, -6, 0, -7, 7, 10, 11, 8, 2, 0, 0, 0], [31, 0, 0, 6, -6, -31, -8, 12, -6, -6, 0, 0, 0, 10, 6, -1], [3, 0, -2, 1, -1, -3, 8, -4, -1, 7, 0, 0, 0, 2, -3, 6], [0, 4, 6, 13, 0, 21, 0, -6, 6, -13, 4, -6, 3, 0, 0, 0], [-4, 6, -15, 2, -15, -6, -6, -3, 3, 3, -6, 12, -4, 4, 6, 12], [0, 2, 7, -6, 5, 19, 0, -7, 2, 6, 3, 5, -4, 0, 0, 0], [0, -2, 7, -16, 1, 16, 0, -7, 6, 16, 6, 12, 6, 0, 0, 0], [-21, 0, 3, 1, -1, 21, 0, 6, -1, -9, 0, 0, 0, -7, 2, -8], [0, 6, 14, -3, 7, -5, 0, -14, 7, 3, 1, 6, -5, 0, 0, 0], [0, 8, 3, 2, 0, 6, 0, -3, 3, -2, 1, 11, -7, 0, 0, 0], [1, 0, -11, 6, -6, -1, -4, 3, -6, -11, 0, 0, 0, 4, 8, 5], [9, 0, -5, 6, -6, -9, 0, 9, -6, 1, 0, 0, 0, -16, 8, -11], [25, 14, -20, -1, -16, -10, -14, 4, 0, 0, -10, 0, 1, -1, 10, 0], [-4, 2, 9, 8, 7, -2, -2, 11, -13, -13, -2, -4, -6, 6, 2, -4], [0, -6, 2, -7, -2, 22, 0, -2, 4, 7, 2, 4, 4, 0, 0, 0], [0, 4, 6, -3, 4, 2, 0, -6, 2, 3, 1, 0, -4, 0, 0, 0], [7, 0, 10, -5, 5, -7, 2, 1, 5, -3, 0, 0, 0, 3, -4, -10], [-2, 8, 7, 0, -2, 9, -8, -20, 11, 11, 9, -1, -2, 2, -9, -1], [12, 0, 2, -4, 4, -12, 4, -5, 4, -9, 0, 0, 0, -1, -3, 6], [-9, 0, 4, 4, -8, -3, 0, -2, -10, -10, -3, -1, -5, 5, 3, -1], [-8, 0, -2, 0, 0, 8, -16, 2, 0, -4, 0, 0, 0, -8, 4, 5], [-10, 0, 1, -3, 3, 10, 6, -3, 3, 10, 0, 0, 0, -14, -1, 1], [0, -8, 5, 3, 6, 23, 0, -5, -1, -3, 2, -6, -3, 0, 0, 0], [14, 4, -1, 24, 0, -5, -4, 10, -9, -9, -5, -5, 6, -6, 5, -5], [12, -20, 5, -6, 4, 3, 20, -2, 1, 1, 3, -3, -4, 4, -3, -3], [-9, 0, -6, 2, -2, 9, -14, -3, -2, -1, 0, 0, 0, -4, 1, 2], [0, -12, 1, 7, 11, -13, 0, -1, -10, -7, 2, 0, -3, 0, 0, 0], [11, 12, -2, 1, -1, -2, -12, 3, -2, -2, -2, 4, 9, -9, 2, 4], [0, -14, 12, 4, 12, 15, 0, -12, 0, -4, 12, -1, 0, 0, 0, 0], [-2, 2, 8, 15, 5, -4, -2, 13, -16, -16, -4, -2, -6, 6, 4, -2], [0, -4, -6, 6, -16, -4, 0, 6, 10, -6, -6, 7, 7, 0, 0, 0], [0, 10, 0, 7, 4, 3, 0, 0, -4, -7, 3, -10, -7, 0, 0, 0], [25, 0, 6, -5, 5, -25, 4, -6, 5, 3, 0, 0, 0, -14, -7, 2]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_1197_j_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_1197_2_j_m();".
// 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_1197_2_j_m(:prec:=16)
    chi := MakeCharacter_1197_j();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 2));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(1999) - 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_1197_2_j_m();".
// 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_1197_2_j_m( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_1197_j();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<2,R![256, 96, 1076, -294, 3427, -401, 2902, -101, 1743, -21, 534, -16, 118, -2, 13, 0, 1]>,<5,R![133956, 121878, 240453, 161742, 238614, 147252, 136390, 60865, 42754, 16773, 8632, 2292, 773, 129, 40, 5, 1]>],Snew);
    return Vf;
end function;