
// Make newform 370.2.o.b in Magma, downloaded from the LMFDB on 19 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_370_o();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_370_o_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_370_2_o_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_370_2_o_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 := [9, 0, 117, -192, 1332, -1329, 3325, -63, 3810, -382, 1845, -297, 666, -135, 132, -25, 18, -3, 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, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1086225957699273, -828245540915145, 12364918060114449, -12308248046456505, 28577726301336609, -214003037263167, 34848378812526090, -2363608345702478, 16849968308636067, -2144939147208948, 6093996383348280, -1003199343912756, 1176501229728729, -180198535062678, 158233129097535, -20288175144489, 7985628307079, 467011630737], [734083447796847, 1298656915658397, 5948453104470423, -1461697716769071, 38464552842327453, 12565644693953733, 39643831895724317, -787898339306631, 19291752438371271, -2584072669612421, 6902922464553826, -1693474035059939, 1466126504711854, -351354719981117, 207475771916758, -49682295365806, 14299357227244, -1286483210027], [-1530279201448305, -4115805002670663, -9546047555721093, -12784748682299277, -65459963102298117, -30120769249294290, -58120735114955745, -1648646059467, -27875816530580689, 4432213352185154, -10011579132233233, 3243674232670454, -2293194019700023, 708857919905234, -338955758102881, 106486954036400, -27243735217429, 4104600398475], [-4203104676633, 138552500110104, -882885901711374, 12454584293215953, -12930307538598189, 29198384758586082, -1766816709463692, 34877800545262521, -4142922658810448, 17028366751577601, -3006575605918713, 6232698837677169, -1314229089983598, 1239547799878224, -241844070319962, 169908419865960, -28694384497755, 9386663199290], [-36941403586275, -1530279201448305, -4596043249292238, -8757964279213893, -18252076413067977, -60004949172724842, -43768565574223665, -57862145289851820, -15640176164249217, -26307859178363239, -3140774383001221, -8792512813886158, 510010367286104, -1739072965905898, 167050667306534, -236340748141006, 32604146863850, -14929934022004], [-5741236777511763, -16248709438677036, -53458401099252276, -37141584626266959, -275132314454322585, -219067215001880949, -319175285405624424, -117336074417295878, -142124563458383873, -37956330109318568, -46444554101576459, -6531955559730773, -7841873831279933, -1090615262838797, -958004874913547, -118353124680056, -31292997456654, -18337730018439], [345236246921304, 1091488115192319, 5641722247626054, 13142287530355716, 4910375220472239, 85426159566591603, 50595698500465794, 93780870549494967, 16223020221568818, 43675230745520513, 2031082540412975, 15334609027455074, -1560445387916167, 3063723006584738, -381333125877343, 423969596505896, -63238568869762, 26105354366996], [-522277892930232, 1026744091475571, -4266379383670638, 23532588363210324, -35555126719393029, 92650095300789093, 11946136116344506, 113671935032633766, -4448183141004396, 55522394222138021, -6471368802252214, 20303037641375396, -3713312318060329, 4060815680685065, -717818795015503, 560235379575988, -91923387999016, 31986364509206], [1091488115192319, 1153651037649102, 20507327464676868, -46184589323880753, 136406045361970827, -76949914945460406, 96197524277944095, -129926990975116542, 58328591448180305, -68742348078454345, 26727405175858106, -27107927660092663, 8242266710404298, -5444798080723135, 1382959171287296, -753711062712370, 141184103340764, -38359582991256], [-207168800466078, 4748282754537690, 6308578295113203, 23995208107725150, 15440744876682687, 154609304705983752, 91846838482672797, 161543249487177417, 29754900000193220, 74841836255345464, 4196125433622094, 25748120972162161, -2417630286567290, 5114283381713863, -606479221671473, 700156475654080, -102223896048158, 43205244541727], [-1026744091475571, -2523233224422378, -12390659980698708, -41742001434281307, -15527059778091501, -204898802115569106, -110015989782122142, -216649458199460484, -33354599211099285, -100595599248445346, -3067867174677740, -34935251758776839, 3773352713268415, -6942256967961233, 890536545230212, -952632397861448, 142106266467538, -58030876992248], [-54728443433070, 12520519668190170, -12730041007282206, 106546815974665644, -12418421825717859, 266993801956578345, 62324159954199482, 255527698711368809, 6255636797747057, 118122926298266579, -8286392505447271, 40111892119961741, -6204271734960604, 7831896426734648, -1239117699341179, 1046593157200005, -162040208301516, 59935273415844], [7416666919458, 47754510619860, 195918028216722, -842254955235942, 2754867338283537, -2306955299614101, 1378105011657021, -3630767110174270, 1007632244640773, -1878167341158724, 521010684894404, -725759892762523, 186265436063468, -146051003273701, 32616183042599, -20271176257636, 3619950724209, -1086451530723], [627260144849775, -7086379227931701, -3798337484608731, 38454064317268581, -126851113956033651, 219849080693715819, 13281434748853485, 304661895761477523, -20967078031398935, 151807188139139543, -20600500303944889, 56886368391164660, -10982542015727782, 11456653991062028, -2096293527119680, 1595034014270366, -266358564289231, 90945361447588], [-4360253579320527, 1641102954087024, -8429153801682627, 42761379534961740, -130113913119154452, 323338808238491463, 83086841103048088, 419149801440595713, 3975338912085122, 204866941050703278, -15509008597603083, 75279305856451767, -12348838612287261, 15134450162561409, -2480047842347340, 2103997077941108, -339448293361062, 123305861608837], [4564935534281661, -2144815543427040, 12225009009679767, -110672281044251580, 183780060259854618, -435991069423046835, -47790022541484575, -544171307488865919, 26352445182246558, -266197581002689578, 32191540454597769, -97486410097108869, 18021853966873653, -19496773708261137, 3461283024183768, -2690072800467970, 442400867850384, -153621363022881]];
    Rf_basisdens := [1, 1, 947673457589169, 947673457589169, 947673457589169, 947673457589169, 947673457589169, 947673457589169, 947673457589169, 947673457589169, 947673457589169, 947673457589169, 947673457589169, 947673457589169, 12981828186153, 947673457589169, 947673457589169, 947673457589169];
    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_370_o();"
function MakeCharacter_370_o()
    N := 370;
    order := 9;
    char_gens := [297, 261];
    v := [9, 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_370_o_Hecke();"
function MakeCharacter_370_o_Hecke(Kf)
    N := 370;
    order := 9;
    char_gens := [297, 261];
    char_values := [[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, -1, 1, 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, 0, 0, 0, 1, 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, 0], [-1, 0, 0, 0, 1, 0, 0, 0, 0, 0, -1, 0, -1, 0, -1, -1, 0, 1], [0, -1, 2, 0, 1, 0, 0, 0, 0, 0, 0, -1, -1, 1, 0, -1, 1, 1], [0, -1, 0, -1, 0, -1, 0, 0, 1, -1, 0, 0, 0, 1, 0, 0, 0, 0], [0, -2, 0, 0, 1, -2, -1, -1, 1, 0, 0, 0, 0, -1, 1, 1, 0, 0], [1, -1, -1, 0, 1, 1, 1, 1, 0, -1, 0, -1, 0, 1, 0, 0, 1, 1], [2, 1, -2, -1, 0, 1, 0, 0, 0, -1, 0, 0, 0, 2, 0, 1, 1, 1], [0, 0, -2, 0, 0, 0, 0, -2, -1, 1, -1, 1, 1, -3, 0, 1, -1, -1], [4, -1, 0, 0, 1, 3, -2, 0, -1, -1, -2, 1, -1, -1, 1, -1, 1, 2], [-1, 0, -2, -2, 0, -2, -1, 0, 2, 0, 1, 0, -2, 1, 0, -1, 0, 2], [0, -2, 2, 1, 2, -2, 0, -1, -1, -2, 0, 0, 0, 0, 0, 1, 0, -2], [-3, 2, 0, 0, 1, 4, 0, 0, -2, -2, 0, 1, -2, 2, -2, 2, -1, 0], [1, -2, -1, 1, -1, -2, -3, -1, 1, 1, -1, 2, 1, -5, 2, 0, -2, -3], [0, 4, 1, -1, 0, 3, 3, 0, 0, 0, -1, 0, -3, 0, -3, 0, 0, 0], [0, 0, -2, -2, 0, -2, -3, -3, 0, 0, 2, 0, 5, 0, 2, 2, 1, -3], [1, -1, -2, 3, -2, 1, -2, 1, -3, -1, -6, 6, 1, -2, 0, -1, 0, 2], [0, 3, -4, 2, 4, 3, 3, 1, 0, 0, -1, 0, -4, -1, 0, -1, 0, -1], [4, 3, -5, 0, 4, 0, -3, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0], [0, 0, 0, -1, -5, -1, 3, 0, 4, 4, 1, -5, 1, 0, 0, 0, 0, -2], [3, -2, -3, -1, 0, 0, 0, -2, 0, 2, -1, 0, 0, -4, 3, -1, 0, -1], [-1, 2, 3, -1, -1, 3, 2, 2, 0, -1, 2, -3, -1, 3, -2, 0, 1, -1], [4, 1, 0, 1, 0, 0, 1, 1, -2, 0, 0, -4, 1, 0, -2, -1, 0, 1], [0, -1, 0, 1, -1, -1, 3, -3, -4, 1, -1, 2, 0, -1, 1, 2, 1, -2], [-2, 1, 2, 4, 0, 1, -1, 1, 1, 4, 0, -3, 3, -3, 0, -2, -2, -1], [0, 1, -1, -1, -1, 1, 2, 4, 2, -1, 2, -1, -2, 4, -1, -1, 1, 1], [1, -2, 1, 3, 1, 2, -3, 0, -3, -3, 2, -2, 0, -1, -1, 0, 1, 0], [-2, -3, 1, -3, -3, -5, -4, -1, 2, -2, 2, -1, 2, -2, 2, 0, -2, -2], [0, -2, 0, 1, -4, -4, -4, -3, 2, 1, 0, 0, 5, -6, 5, 0, -4, -5], [3, -4, -2, 0, 0, -6, -2, -3, -2, 0, 2, -3, 5, 0, 4, 4, -1, -3], [1, -2, -1, 0, -5, -2, -1, -1, 1, 6, 0, 1, 6, -2, 1, 3, -1, -3], [0, 2, 7, -2, -3, -3, -1, -1, 0, 2, 4, -1, 2, -2, 3, 4, -4, -4], [1, -2, -3, -2, 0, 0, 1, 1, 3, -2, -2, 3, -1, 4, -1, -1, 3, 3], [3, 3, 0, 2, 1, -1, 2, 0, -3, -3, -4, 1, -7, 3, -3, 3, 1, -1], [3, -3, 1, 0, 3, 2, 3, 4, 1, -2, 0, -2, -4, 2, 0, -4, 0, 2], [-7, -4, 5, -2, -3, -2, -1, -1, 3, 5, -2, -5, 4, -4, 1, -2, -3, 0], [1, 2, 3, -4, 0, 0, 1, 3, 2, 0, -3, -1, -4, 0, 2, -1, -2, 3], [1, 1, -1, 0, 1, -3, -1, 3, 0, 3, 0, 1, 0, 0, 0, -2, -3, 0], [-2, 0, -4, -2, 6, -4, 3, 0, 4, 5, 2, -6, 2, -1, 2, 0, -3, -2], [4, 1, 0, -1, -1, -5, 0, 0, 0, 0, 2, -1, 1, 1, -1, 1, -2, -3], [2, 1, 0, -3, 0, 1, -1, 1, 3, 2, 2, -2, 3, -2, 1, -1, -1, 2], [2, 1, 0, 2, 4, 3, 4, 0, 1, 1, -6, 4, -7, 1, -1, 1, 1, 0], [0, -3, -2, -3, -3, -5, -2, -1, -2, 5, -2, 5, 10, 0, 5, 4, -4, -4], [-4, -2, 4, 1, 4, 2, -1, -2, -4, -2, 4, 0, -1, 1, -1, 0, 1, 1], [0, 1, 0, 3, 7, 1, 0, -1, 0, 3, 7, -3, -4, -3, 0, -1, -1, -2], [0, 3, 6, 1, -4, 5, 4, 5, 1, -2, 6, -2, -7, 3, -5, -3, 3, 3], [0, -1, 0, 2, 7, 0, -3, 0, -4, -4, -8, 7, -7, -1, 1, -1, 4, 3], [7, 1, -2, -3, -5, 3, 3, 0, 0, 2, -4, 0, 0, 3, 2, 5, 0, -2], [-1, 7, 6, 2, -5, 7, 7, 6, 0, 0, 5, 0, 0, 9, -6, 3, 0, 0], [0, -1, 7, 4, 4, 3, -1, -1, -3, -1, -6, 2, -1, 0, -3, -4, 4, 4], [3, 2, -4, 6, 1, -4, -1, -1, -3, 3, -1, 4, 0, -1, 1, 4, 0, -3], [2, -1, 2, 0, 2, -1, 1, 1, -7, 1, 0, -3, -4, -1, 0, -3, -3, -1], [0, -4, 3, -4, -2, 2, 6, 6, 5, -1, -4, 6, 4, 7, -2, -3, 3, 3], [-3, 2, 2, 2, 4, 4, 4, 3, -2, 2, 3, -1, -2, 2, -2, 0, 2, 2], [3, 3, -2, 7, -2, 4, 2, 0, -7, 0, -4, 4, 0, -5, -3, 0, 3, 0], [2, -3, -2, 0, 1, -3, -5, -5, 2, 0, 1, 2, 0, -7, 3, 2, -1, -6], [-5, -3, 5, -2, 4, -1, -5, -3, -2, -6, 5, 0, -1, 0, -1, 0, 2, 1], [-2, 3, -7, 0, -2, -3, -3, -3, 0, 3, 0, -10, 9, -4, 0, 7, -5, -4], [-10, -2, 6, -1, 0, -3, -3, -2, 0, 0, -6, 10, 5, 0, 3, 0, 2, -2], [3, 3, -7, 1, -7, 3, 0, -3, -1, 3, 10, -10, 3, 0, 0, 3, 0, -6], [11, -2, -14, 0, 11, -3, 2, -6, 1, 3, 0, 5, 3, -4, 0, 1, -2, -4], [0, -5, -5, -6, -2, -7, -1, -10, 1, 5, 3, -1, 6, -9, 7, 6, -6, -6], [8, 4, -4, 1, 0, 5, 5, 1, 0, 0, 4, -8, 5, 0, -5, -5, 4, 1], [0, 4, 0, 8, 0, -4, 1, 1, -3, 7, 0, 0, -1, -4, -1, -3, -5, -3], [-3, -4, -3, 2, 0, -1, -6, 0, 1, 0, 3, 3, -4, 0, 2, -2, 2, 0], [-9, 1, -7, -2, -3, 1, 2, -1, 0, -1, 9, -16, -3, 5, -3, 0, 1, 3], [-10, -3, -2, -5, -2, -6, 3, -1, 5, -3, 4, -4, -10, 1, 0, 1, 0, -2], [7, 7, -7, -2, 4, 7, 0, -1, 1, -2, 4, 1, -6, 1, -1, 0, 1, 0], [1, 6, -6, -7, 0, 1, -1, 2, 2, 0, 6, -1, -3, 0, 1, -1, -1, 2], [2, 3, -4, -1, -8, 4, -2, -2, -5, 0, -2, 4, 10, 0, 2, -1, 2, 5], [0, -6, 8, 5, 0, 0, -5, -1, 2, -7, 2, -2, -2, 1, 0, -2, 2, 2], [12, 4, -4, 0, 12, 5, -4, -2, -4, -5, 0, -8, -8, 2, 0, 1, 6, 2], [3, 6, 0, 0, 3, 7, -6, -5, -7, -7, 0, 11, -3, -1, 0, 5, 3, -1], [-6, 9, 1, 2, 1, 7, 4, 4, -5, -8, -5, -1, -5, 8, -4, -2, 4, 2], [-5, -7, 10, -1, 10, -5, -10, -1, 1, 1, 5, -5, 3, -5, 8, 1, -8, -2], [-4, 1, 1, 0, -4, -2, -1, 5, -9, 2, 0, 2, 3, 1, 0, 0, -3, 1], [1, 0, -1, -8, -3, 0, -5, 3, 6, -8, -3, -9, 11, 3, -1, -1, 0, 3], [14, 6, 0, 4, -8, 9, 3, 0, -7, -7, 3, -8, -3, 6, -6, 6, 8, 0], [3, 2, 0, 3, -18, 2, -3, 9, 0, -2, -3, 3, 1, -3, 1, 0, 1, -1], [-5, 7, -3, -4, 15, 2, 12, -6, 5, 6, 5, -8, -6, 5, -6, 0, 7, 6], [6, 0, -6, 1, 4, 0, -4, -5, -2, 1, 4, 8, -6, -11, 6, 3, -3, -8], [-5, 0, -3, -4, -3, -4, 6, 0, 4, -2, 8, -8, -7, 3, -2, 0, 2, 0], [0, -10, 6, 4, 1, 0, -4, -6, 0, -4, 4, -5, -5, -7, 0, 1, -1, -1], [-7, -9, 9, 6, -2, -1, -1, -2, 0, 8, -3, 0, 9, -4, 0, -4, 0, 2], [-18, -5, 0, -3, -5, -4, -8, 0, 0, 0, -3, -5, 2, -5, 5, -5, -4, 7], [8, 3, -3, -2, -5, 2, 2, 0, 0, -1, 4, 0, -4, 4, -1, 3, 0, 1], [9, -5, -1, 3, -1, -5, -5, -1, -3, 0, -11, 11, 14, -5, 5, 1, -5, -2], [4, 3, 3, -3, -11, 6, 5, 5, 2, 3, 7, -3, 6, 7, -5, -12, 2, 9], [4, -1, -9, 0, 4, 4, 1, -7, -6, -4, 0, 3, 5, -2, 0, 7, 3, -2], [-1, -3, 1, -3, -2, -3, 0, 11, 7, -3, -2, 8, -13, 13, -7, -6, 1, 12], [-3, -3, -3, 0, 8, -5, -4, 0, 2, 1, 3, -6, 5, -7, 5, 0, -3, -5], [1, -1, 0, -5, -4, -12, 2, 0, 8, 8, -2, -4, -1, -1, 1, -1, -2, -5], [3, 9, -3, -3, 3, 9, 4, 4, 0, -3, 3, -7, 0, 6, -4, -3, 1, 5], [-5, -1, 4, 0, -5, 1, 1, -3, 0, -1, 0, -12, 1, -3, 0, -1, -3, -3], [-3, -1, 7, 3, 0, 1, 6, -2, -1, 0, -7, 3, 0, 0, -2, 2, 0, -2], [-4, 2, -7, 1, -1, 1, -3, -3, -5, -5, -11, 7, 4, -5, 3, 0, -2, 1], [-6, 1, -2, 0, -6, 0, -1, -5, 2, 0, 0, -8, 8, -1, 0, 4, 3, -1], [-1, 7, 2, 7, -1, 4, 4, 6, 0, -3, -9, 0, -11, 6, -13, -7, 0, 7], [-7, -1, 7, 3, -4, -1, 7, 5, 2, 3, -4, 4, -9, 7, -9, -8, 1, 6], [0, 2, -7, -8, 2, -5, 3, -8, 8, 0, -2, 0, 5, -7, 5, 4, -4, -4], [3, 4, -2, 6, 1, 10, 3, 2, -6, -1, -3, 1, -4, 6, -4, 0, 2, 4], [0, 7, 14, -2, -4, 4, 6, -1, -6, 8, 2, 2, -2, -3, -4, -2, 2, 2], [1, 8, -1, -8, 8, 8, 1, 2, 4, -8, 8, 3, -16, 18, -5, 3, 8, 10], [7, 13, 1, -10, 0, 9, 3, 0, 6, 0, -1, -7, 3, 0, -3, 3, -3, 0], [-11, 0, 2, 2, 0, -4, 7, -2, -6, 0, -2, 11, 9, 0, -2, 3, -1, -2], [-2, 5, 2, 0, 0, -1, -1, 1, 0, -6, -14, 0, 5, -3, 3, 0, 0, -4], [-5, -4, 0, 0, 5, -6, -1, 0, 3, 3, -6, 5, -2, -4, 4, -4, 4, 5], [-10, -10, 7, -2, 3, -11, -11, -7, 0, -1, -16, 0, 15, -12, 8, -4, 0, -1], [-5, -8, -6, 0, 6, -8, -2, -2, 6, 7, -11, 6, -4, -7, 2, -3, -5, 0], [-5, 0, 21, 2, 0, 4, 2, 5, 2, 0, -21, 5, -3, 0, -2, -4, -1, 5], [-2, -6, 14, 8, 0, 2, 1, 6, 0, 0, -14, 2, -8, 0, -2, -15, 9, 6], [-6, -6, 4, 3, -5, -3, -6, -1, -3, 0, 6, -2, 6, -7, 6, 0, -5, -6], [4, -13, -4, 5, 4, -13, -5, -1, 1, 5, 4, -6, 6, -3, 4, 3, -1, -2], [-3, -10, 1, -4, -14, -5, -6, -7, -5, -5, 3, -2, 1, -3, 1, 0, 1, -1], [-9, -3, 4, -1, -6, -11, 2, -7, 8, 12, 9, -5, 10, -14, 10, 0, -6, -10], [8, 5, -8, -10, -1, 5, -6, 6, 10, -10, -1, 1, -4, 8, -4, -3, 1, 7], [3, -2, -1, 0, 3, -8, 2, 4, 0, 8, 0, 3, -2, 2, 0, -7, 0, 2], [-8, 8, -10, 0, -10, -4, 13, 0, 0, 7, 7, -7, -9, 7, -1, 0, 1, 0], [13, 6, -10, 2, -3, 3, 3, 5, 0, -3, -4, 0, -15, 0, -5, -5, 0, 0], [-8, -4, 5, 4, 3, 0, 0, 4, 0, 4, 7, 0, 8, 2, 3, 5, 0, -7], [2, 3, -2, -1, 0, 6, 6, 6, 0, 3, -8, 0, -6, 1, -4, -3, 0, -2], [0, 5, 6, -10, 3, 6, 16, 13, 4, 6, -2, -1, -7, 16, -6, -9, 9, 9], [-6, -1, 4, -6, -7, 5, -4, -4, -3, 3, -2, -4, 11, -2, 4, 8, 2, -2], [-13, -1, 9, -4, 4, -6, 1, -6, 5, 3, 13, -4, 2, -6, 2, 0, 2, -2], [-1, -9, -10, 2, 1, -1, -6, -7, -8, -3, 1, -11, 3, -7, 3, 0, 1, -3], [4, 6, 0, 4, 9, 8, -1, 0, -11, -11, 7, 9, 1, 6, -6, 6, 3, -6], [-4, 3, -1, -5, 0, 4, -4, -5, 6, 0, 1, 4, 3, 0, 2, 10, -5, -5], [10, -13, -5, 10, -5, -7, -13, -4, -10, -6, 14, -14, 17, -10, 7, 4, -7, -8], [11, 6, 0, -1, -11, 6, 6, 3, 0, 0, -7, 0, 2, 7, 2, 9, 0, -5], [14, 1, 0, 6, 6, 16, 4, 0, -3, -3, 1, 6, 0, 1, -1, 1, 3, -3], [-11, 2, -3, 0, -11, 1, -2, 2, -8, -1, 0, 10, 14, 2, 0, 1, 2, 2], [0, 5, -5, 4, -22, 6, 2, 5, 0, -4, 17, 5, -1, 7, -6, -8, 8, 8], [-1, -6, 2, 1, -5, -7, -7, -7, -1, 7, 1, -2, 12, -9, 7, 9, -2, -4], [3, 6, 2, 5, 0, 6, 4, 4, -5, 0, -2, -3, -17, 0, -11, -9, 5, 4], [0, -5, -17, 8, 10, 0, -8, 3, -8, 0, -10, 0, 0, 3, 0, 0, 0, 0], [-5, 0, -4, -6, -4, -14, 4, -9, 6, 10, 3, -3, 5, -12, 10, 9, -10, -18], [-10, -7, 10, 0, -9, -7, 4, 12, 6, 0, -9, 11, -12, 4, -10, -14, -4, 8], [13, 0, -7, -13, -7, 13, -4, -4, -4, -3, 6, 7, 11, 1, 4, 2, 5, 7], [1, -6, -4, 2, 3, -1, -1, 5, 0, 5, -11, 0, -11, 4, -7, -3, 0, 2], [-2, 5, 0, 0, -2, -1, -5, 4, -14, 1, 0, 5, 2, 1, 0, -1, -2, 1], [-14, 3, 13, -7, 1, 5, 5, 0, 0, 2, 12, 0, 14, 0, 1, 1, 0, -1], [0, -7, 10, -1, -4, -6, 5, 5, 12, -2, 10, -10, -1, 3, -5, -4, -2, -3], [10, 11, -13, -2, -13, 8, 10, 3, 2, 4, 5, -5, 3, 10, -7, -3, 7, 6], [-12, 10, 6, -9, 0, -1, -3, -3, -2, 0, -6, 12, -4, 0, -1, 3, 0, -3], [-3, -2, 1, -1, 5, 2, 8, -3, -4, 5, 3, -2, -3, 1, -3, 0, 5, 3], [5, 8, 4, 8, -1, 12, -5, 6, -4, -9, -5, 9, -4, 6, -4, 0, 2, 4], [-2, -1, 0, -2, 22, 1, -4, 0, -1, -1, 7, 22, 8, -1, 1, -1, -1, 5], [0, -8, 0, -6, 7, -5, 1, 0, 9, -3, -6, -1, 4, 4, 5, 1, -1, -1], [-12, 5, 1, 1, 1, -6, 0, 8, 11, 7, 12, -11, 7, -3, 7, 0, -11, -7], [0, 3, 2, -12, 2, -2, 10, -6, 6, 6, 13, -15, -13, 1, 2, -5, 5, 5], [-4, 0, -3, -4, 7, 2, 2, -6, 0, 2, 9, 0, -1, -10, 2, -8, 0, 4], [-3, 1, -7, -5, 10, 4, 4, -7, 0, 3, -3, 0, -4, 4, 3, 7, 0, 4], [-10, 5, 0, 2, 0, 1, 6, 0, -1, -1, -1, 0, -6, 5, -5, 5, 1, -3], [12, -4, -5, 0, 12, 2, 4, -8, 13, -2, 0, -2, -7, 1, 0, -1, 10, 1], [-5, -9, 5, 5, 1, -9, 2, 2, -5, 5, 1, -6, 8, 6, 3, 5, 2, 4], [16, -2, 0, 10, 2, 11, 0, 0, -8, -8, 9, 2, 11, -2, 2, -2, 7, 2], [3, -2, -5, -14, -5, -12, 3, -5, 14, 5, 30, -30, 10, -8, 7, 5, -7, -10], [3, -7, 0, -16, 5, -16, 2, 6, 9, 2, -3, 3, 0, 6, 0, 0, -6, 0], [-12, 10, 3, -7, 0, 5, 3, 0, 2, 0, -3, 12, -21, 0, -3, 0, 0, 0], [1, -6, -18, 4, 0, -5, 2, 0, -3, 0, 18, -1, 1, 0, 2, 0, 0, 0], [-9, 5, -4, -2, 0, 7, 5, 5, 0, -10, -13, 4, -5, 13, -5, -6, 8, 9], [-16, 1, -6, 2, 22, -1, -1, 3, 0, -2, -7, 0, -13, 7, -7, 0, 0, 4], [6, 13, -14, 11, 2, 2, 0, 0, -13, -3, -8, 14, -2, -2, 0, 8, -2, -10], [3, -3, -8, 1, 0, 1, -8, 2, 3, 0, 8, -3, 22, 0, 2, 5, -7, 2], [4, 11, -6, -2, 0, 3, 14, -1, -6, 0, 6, -4, 0, 0, -9, 3, -2, -1], [0, -7, 6, 6, -12, 3, -3, -6, -7, 1, -7, 19, 16, -6, -3, -3, 3, 3], [-4, -6, 10, -4, 29, -6, 8, 1, 0, 10, 4, 6, 2, 1, 2, 0, -5, -2]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_370_o_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_370_2_o_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_370_2_o_b(:prec:=18)
    chi := MakeCharacter_370_o();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 2));
    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_370_2_o_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_370_2_o_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_370_o();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,2,sign)));
    Vf := Kernel([<3,R![9, -81, 360, -957, 2142, -3759, 3028, 1047, -1971, 362, 675, -306, 168, -63, 6, -10, 6, 0, 1]>],Snew);
    return Vf;
end function;