
// Make newform 33.3.h.b in Magma, downloaded from the LMFDB on 24 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_33_h();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_33_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_33_3_h_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_33_3_h_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 := [1771561, 0, -536393, 0, 239275, 0, -96398, 0, 25179, 0, -2562, 0, 180, 0, -12, 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], [374807322561273688856, 0, -744861315136512930500, 0, 44698619213114763312, 0, -4303642725224589076, 0, 344558428769805180, 0, -40525263758459540, 0, -322126035973969, 0, -127407047787804, 0], [-77838063410538248499, 0, -208024183527244179835, 0, 247688922335353991145, 0, -23265517903780782960, 0, 1520211191539599580, 0, -85177596039692545, 0, 11921441073701127, 0, 234959048766210, 0], [0, -374807322561273688856, 0, 744861315136512930500, 0, -44698619213114763312, 0, 4303642725224589076, 0, -344558428769805180, 0, 40525263758459540, 0, 322126035973969, 0, 127407047787804], [0, -77838063410538248499, 0, -208024183527244179835, 0, 247688922335353991145, 0, -23265517903780782960, 0, 1520211191539599580, 0, -85177596039692545, 0, 11921441073701127, 0, 234959048766210], [207581537941818757970, 0, -82997600383267449850, 0, -74027125217335407442, 0, 76663977785573994959, 0, -8766582639358512750, 0, 631568334130072500, 0, -38143852521781896, 0, 4438276679147244, 0], [38060055284176600406699, 21898844749963893603650, 17059214158261006460234, -21420285449145050092157, -3066965541789538832905, 2596346362793508526818, -1221194376663844125048, -247225326229442937739, 184172957827569504013, 18173418136790321913, -11853231551733086559, -1694622520719673097, 742877598465063798, 31035928814102023, -107478072222941431, -2949643553271501], [-38060055284176600406699, 21898844749963893603650, -17059214158261006460234, -21420285449145050092157, 3066965541789538832905, 2596346362793508526818, 1221194376663844125048, -247225326229442937739, -184172957827569504013, 18173418136790321913, 11853231551733086559, -1694622520719673097, -742877598465063798, 31035928814102023, 107478072222941431, -2949643553271501], [-91659310975868063351165, -20574790310578950257680, 48992445765202921573548, 17382546759243455724562, -18835563517351609927800, -2448733533544500813279, 4437259853751563534641, 234870744257407535442, -453165291912414021743, -18276913998033521354, 31045509051468975822, 2005487528427821201, -2117280218216450276, -33630130225371761, 166012584300402708, 5530938613687128], [-91659310975868063351165, 20574790310578950257680, 48992445765202921573548, -17382546759243455724562, -18835563517351609927800, 2448733533544500813279, 4437259853751563534641, -234870744257407535442, -453165291912414021743, 18276913998033521354, 31045509051468975822, -2005487528427821201, -2117280218216450276, 33630130225371761, 166012584300402708, -5530938613687128], [0, -55056646013161149255646, 0, 15876462984469736097197, 0, -1439208800755732819107, 0, 517159654487638123533, 0, -60964388315221160139, 0, 4502519471732524742, 0, -201987708092060081, 0, 30054413983928844], [2527463022467253365682, 38836150383671216498131, 22215491198933656595906, -19622760602151650003666, -15244472422698155686654, 7651271435780790370144, 2581424220326366958345, -1861216681368690697007, -221948869246166066510, 193257387972027534305, 14689100732554831748, -13142255289684674994, -1271613859106383353, 904789569200787956, 49907241408562835, -72618660380064154], [-2527463022467253365682, 38836150383671216498131, -22215491198933656595906, -19622760602151650003666, 15244472422698155686654, 7651271435780790370144, -2581424220326366958345, -1861216681368690697007, 221948869246166066510, 193257387972027534305, -14689100732554831748, -13142255289684674994, 1271613859106383353, 904789569200787956, -49907241408562835, -72618660380064154], [-84217831418990427698342, 18115509591203040974177, 20270682318663355761963, -5780946714034994365846, -9875787159646622730582, -1429591891788951514170, 920555929379994081361, 1663164806667153890606, -55882176278914975803, -195384258337122023097, 1701287476880316347, 14023945388217859866, -476043899992241295, -862706736638173675, -20810066889315561, 99135684000027241], [-7441479556877635652823, -51394738255679059357083, 28721763446539565811585, 24253609462611022050276, -8959776357704987197218, -9622707375209255559717, 3516703924371569453280, 2434586108751809455762, -397283115633499045940, -246898826826540336329, 29344221574588659475, 17281610014102620849, -1641236318224208981, -1153420167662430754, 186822651189718269, 94334933420026495]];
    Rf_basisdens := [1, 1, 2181808456934777493119, 2181808456934777493119, 2181808456934777493119, 2181808456934777493119, 2181808456934777493119, 47999786052565104848618, 47999786052565104848618, 47999786052565104848618, 47999786052565104848618, 23999893026282552424309, 47999786052565104848618, 47999786052565104848618, 47999786052565104848618, 47999786052565104848618];
    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_33_h();"
function MakeCharacter_33_h()
    N := 33;
    order := 10;
    char_gens := [23, 13];
    v := [5, 4];
    // 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_33_h_Hecke();"
function MakeCharacter_33_h_Hecke(Kf)
    N := 33;
    order := 10;
    char_gens := [23, 13];
    char_values := [[-1, 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]];
    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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, -1, 0, 0, 1, -1, 0, -1, -1, 0, 0, -1, 1, 1, 0, 0], [2, -1, 5, 2, 0, -1, 0, -1, -1, 0, 1, 0, 0, 0, 1, -1], [0, 5, 0, 0, -2, 8, 0, 4, 4, 4, -2, 1, -2, -2, -2, -2], [-2, 0, -2, 0, 0, 0, -3, 0, 0, 3, 3, 0, -3, 3, 0, 0], [0, -3, 0, 0, 5, -4, 0, -3, -3, 1, 0, -4, 0, 0, -1, -1], [-14, 0, -5, -5, 0, 0, 14, -1, 1, -2, -2, 0, 0, 0, 0, 0], [0, -2, 0, 0, 5, -2, 0, -4, -4, -5, -1, -3, 1, 1, 6, 6], [0, -2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [15, -5, 15, 0, 0, -5, -9, 0, -10, -5, 0, 0, 0, 0, 5, -5], [16, 9, 21, 16, 0, 9, 0, 9, 9, 0, -9, 0, 0, 0, -9, 9], [0, -31, 0, 0, 10, -31, 0, -19, -19, -18, 18, 0, 0, 0, 0, 0], [-9, -5, 0, 6, 0, -5, -6, -12, 2, 0, 5, 0, 2, -2, 5, -5], [0, 35, 0, 0, -23, 35, 0, 14, 14, 17, -17, 0, 0, 0, 0, 0], [0, 16, 0, 0, 0, -3, 0, 0, 0, 3, -9, -3, 6, 6, 6, 6], [0, -27, 0, 0, 6, 23, 0, 1, 1, 22, -1, -39, -22, -22, -21, -21], [0, 2, 17, 15, 0, 2, -17, 2, 2, 2, 0, 0, 11, -11, -2, 2], [38, -12, 0, 21, 0, -12, -21, -9, -15, 0, 12, 0, -15, 15, 12, -12], [0, -5, 0, 0, 3, -13, 0, -5, -5, -10, 0, 5, 1, 1, 10, 10], [-18, -2, -56, -18, 0, -2, 0, -5, 1, -3, -1, 0, 3, -3, 2, -2], [-48, 8, -48, 0, 0, 8, 49, 0, 16, -9, -17, 0, 17, -17, -8, 8], [0, 13, 0, 0, -12, 20, 0, 13, 13, 8, 0, 5, -5, -5, -8, -8], [0, 1, 0, 0, -9, 29, 0, 3, 3, 9, -4, -3, -6, -6, -5, -5], [-5, -8, -5, 0, 0, -8, 46, 0, -16, 2, 10, 0, -10, 10, 8, -8], [0, -1, 0, 0, 0, -7, 0, 0, 0, 14, -6, 15, 21, 21, -8, -8], [32, -22, 44, 32, 0, -22, 0, -34, -10, -12, 10, 0, 12, -12, 22, -22], [0, -25, 0, 0, 34, -25, 0, 5, 5, -8, 8, 0, 0, 0, 0, 0], [-116, -2, 0, -40, 0, -2, 40, -8, 4, 0, 2, 0, 4, -4, 2, -2], [0, -9, 0, 0, -18, -9, 0, -26, -26, 12, -12, 0, 0, 0, 0, 0], [0, 14, 8, -90, 0, 14, -8, 14, 14, 14, 0, 0, 8, -8, -14, 14], [0, -39, 0, 0, 51, -90, 0, -15, -15, -51, 60, 21, 36, 36, -9, -9], [0, 39, 0, 0, -64, 98, 0, 39, 39, 34, 0, 5, -35, -35, -34, -34], [45, 5, 74, 45, 0, 5, 0, 34, -24, 29, 24, 0, -29, 29, -5, 5], [0, 1, 0, 0, -24, 2, 0, 1, 1, -22, 0, 23, 40, 40, 22, 22], [-70, 0, -80, -80, 0, 0, 70, -16, 16, -34, -34, 0, 0, 0, 0, 0], [66, 0, 40, 40, 0, 0, -66, 8, -8, -12, -12, 0, 0, 0, 0, 0], [43, 20, 43, 0, 0, 20, -157, 0, 40, 4, -16, 0, 16, -16, -20, 20], [0, 25, 0, 0, 0, -48, 0, 0, 0, -47, 17, 18, 1, 1, 30, 30], [0, 82, 0, 0, 11, 82, 0, 15, 15, 42, -42, 0, 0, 0, 0, 0], [0, -1, 0, 0, 4, -1, 0, 20, 20, 6, -6, 0, 0, 0, 0, 0], [0, -23, -118, -65, 0, -23, 118, -23, -23, -23, 0, 0, 16, -16, 23, -23], [0, 7, 0, 0, -41, -10, 0, -22, -22, 12, 22, -27, -12, -12, -34, -34], [0, -25, 7, 144, 0, -25, -7, -25, -25, -25, 0, 0, 15, -15, 25, -25], [0, 42, 0, 0, -49, 113, 0, 17, 17, 49, -57, -15, -32, -32, 8, 8], [-163, 18, 0, 78, 0, 18, -78, 9, 27, 0, -18, 0, 27, -27, -18, 18], [-43, -12, -43, 0, 0, -12, -125, 0, -24, -23, -11, 0, 11, -11, 12, -12], [-105, 0, -83, -83, 0, 0, 105, 23, -23, 6, 6, 0, 0, 0, 0, 0], [0, -142, 0, 0, 45, -15, 0, -56, -56, 41, 56, -45, -41, -41, -97, -97], [108, -14, 108, 0, 0, -14, -18, 0, -28, 58, 72, 0, -72, 72, 14, -14], [0, 64, 0, 0, 0, -93, 0, 0, 0, -23, -64, 6, 70, 70, 87, 87], [0, 15, 0, 0, 51, 15, 0, 22, 22, 33, -33, 0, 0, 0, 0, 0], [220, 37, 0, 176, 0, 37, -176, 22, 52, 0, -37, 0, 52, -52, -37, 37], [0, 16, 0, 0, 0, 117, 0, 0, 0, 97, -61, -81, -20, -20, -36, -36], [0, -44, 0, 0, -10, 18, 0, -18, -18, 36, 18, 27, -36, -36, -54, -54], [0, -14, 0, 0, 108, -133, 0, -57, -57, -108, 8, -6, 51, 51, 100, 100], [0, 8, 0, 0, 40, -100, 0, 8, 8, -60, 0, 68, 60, 60, 60, 60], [119, 56, 83, 119, 0, 56, 0, 29, 83, -27, -83, 0, 27, -27, -56, 56], [-111, 7, -111, 0, 0, 7, -117, 0, 14, 31, 24, 0, -24, 24, -7, 7], [0, -70, 0, 0, 4, 110, 0, -70, -70, 114, 0, -184, -131, -131, -114, -114], [-32, 0, 86, 86, 0, 0, 32, -62, 62, 38, 38, 0, 0, 0, 0, 0], [0, 49, 0, 0, 29, -90, 0, -6, -6, -84, 6, 27, 84, 84, 78, 78], [-9, -16, 0, -71, 0, -16, 71, 65, -97, 0, 16, 0, -97, 97, 16, -16], [0, 61, 0, 0, -64, 61, 0, 57, 57, -11, 11, 0, 0, 0, 0, 0], [0, 56, 70, -99, 0, 56, -70, 56, 56, 56, 0, 0, -39, 39, -56, 56], [0, 31, 0, 0, 0, -249, 0, 0, 0, -170, 68, 147, 79, 79, 102, 102], [-67, -47, 0, -218, 0, -47, 218, -136, 42, 0, 47, 0, 42, -42, 47, -47], [-284, -1, 170, -284, 0, -1, 0, -12, 10, -11, -10, 0, 11, -11, 1, -1], [0, -93, 0, 0, 14, -7, 0, -93, -93, 7, 0, -100, 13, 13, -7, -7], [7, 0, 85, 85, 0, 0, -7, 83, -83, 10, 10, 0, 0, 0, 0, 0], [0, -189, 0, 0, 50, -151, 0, -82, -82, -50, 75, -114, -32, -32, -25, -25], [0, 154, 0, 0, -116, 122, 0, 80, 80, 42, -80, 36, -42, -42, 38, 38], [137, -58, 191, 137, 0, -58, 0, -13, -103, 45, 103, 0, -45, 45, 58, -58], [199, 82, 0, 80, 0, 82, -80, 49, 115, 0, -82, 0, 115, -115, -82, 82], [0, -49, -16, -63, 0, -49, 16, -49, -49, -49, 0, 0, -49, 49, 49, -49], [0, 25, 0, 0, 0, 129, 0, 0, 0, 118, 8, -3, -11, -11, -126, -126], [0, -41, 0, 0, -39, 94, 0, 7, 7, 87, -7, -180, -87, -87, -80, -80], [39, 26, 0, 100, 0, 26, -100, -13, 65, 0, -26, 0, 65, -65, -26, 26], [0, -60, 0, 0, 17, -115, 0, -60, -60, -98, 0, 38, -78, -78, 98, 98], [98, -70, 98, 0, 0, -70, -216, 0, -140, -46, 24, 0, -24, 24, 70, -70], [0, 181, 0, 0, 96, -52, 0, 72, 72, -96, 59, 240, 168, 168, 37, 37], [-124, 0, -119, -119, 0, 0, 124, -136, 136, -31, -31, 0, 0, 0, 0, 0], [0, -178, 0, 0, 0, -49, 0, 0, 0, -89, 79, 39, -40, -40, 10, 10], [-4, -37, 86, -4, 0, -37, 0, -28, -46, 9, 46, 0, -9, 9, 37, -37], [51, -88, 0, 142, 0, -88, -142, -97, -79, 0, 88, 0, -79, 79, 88, -88], [0, 24, 0, 0, 6, 24, 0, -86, -86, -45, 45, 0, 0, 0, 0, 0], [0, -115, 0, 0, 0, 71, 0, 0, 0, -75, 74, -72, -146, -146, 1, 1], [0, 63, -169, 254, 0, 63, 169, 63, 63, 63, 0, 0, -18, 18, -63, 63], [0, 410, 0, 0, -108, 133, 0, 189, 189, 108, -140, 270, 81, 81, 32, 32], [-69, 105, 0, 95, 0, 105, -95, 184, 26, 0, -105, 0, 26, -26, -105, 105], [0, -127, 0, 0, 160, -244, 0, -127, -127, -84, 0, -43, 124, 124, 84, 84], [0, 102, 0, 0, -121, 335, 0, 102, 102, 214, 0, -112, -149, -149, -214, -214], [115, 0, 63, 63, 0, 0, -115, -27, 27, 126, 126, 0, 0, 0, 0, 0], [0, 75, 0, 0, -31, -44, 0, 0, 0, -44, 0, 66, 44, 44, 44, 44], [35, 38, 239, 35, 0, 38, 0, 26, 50, -12, -50, 0, 12, -12, -38, 38], [0, 52, 0, 0, -76, 52, 0, -72, -72, 80, -80, 0, 0, 0, 0, 0], [0, -55, 0, 0, 7, -55, 0, 32, 32, 93, -93, 0, 0, 0, 0, 0], [0, -71, 0, 0, 162, -143, 0, -26, -26, -117, 26, -18, 117, 117, 91, 91], [0, -106, 219, 102, 0, -106, -219, -106, -106, -106, 0, 0, 82, -82, 106, -106], [-25, -117, -25, 0, 0, -117, -164, 0, -234, -80, 37, 0, -37, 37, 117, -117], [-35, 0, 290, 290, 0, 0, 35, 58, -58, -58, -58, 0, 0, 0, 0, 0], [0, 48, 0, 0, 66, -184, 0, -35, -35, -149, 35, 9, 149, 149, 114, 114], [0, 114, 0, 0, 0, 148, 0, 0, 0, 78, -35, -105, -70, -70, -43, -43], [0, 80, 0, 0, -140, 80, 0, 29, 29, -163, 163, 0, 0, 0, 0, 0], [130, 79, 0, -193, 0, 79, 193, 199, -41, 0, -79, 0, -41, 41, -79, 79], [0, 3, 536, 32, 0, 3, -536, 3, 3, 3, 0, 0, 21, -21, -3, 3], [0, 182, 0, 0, -33, 15, 0, 82, 82, -67, -82, 195, 67, 67, 149, 149], [0, -253, 0, 0, -110, 44, 0, -11, -11, 110, 121, -132, -121, -121, -231, -231], [0, -26, 0, 0, 132, 20, 0, -26, -26, 152, 0, -178, -56, -56, -152, -152], [-30, -73, 299, -30, 0, -73, 0, -212, 66, -139, -66, 0, 139, -139, 73, -73], [-329, 87, -329, 0, 0, 87, -213, 0, 174, 153, 66, 0, -66, 66, -87, 87], [64, 0, -150, -150, 0, 0, -64, -96, 96, -36, -36, 0, 0, 0, 0, 0], [0, -105, 0, 0, -117, 159, 0, -78, -78, 117, -168, -273, -195, -195, 51, 51], [-71, 0, -85, -85, 0, 0, 71, 16, -16, 137, 137, 0, 0, 0, 0, 0], [327, 35, 188, 327, 0, 35, 0, 124, -54, 89, 54, 0, -89, 89, -35, 35], [0, -46, 0, 0, 163, -46, 0, -1, -1, 43, -43, 0, 0, 0, 0, 0], [0, 47, -319, -606, 0, 47, 319, 47, 47, 47, 0, 0, -40, 40, -47, 47], [0, -338, 0, 0, 0, 189, 0, 0, 0, 99, 81, -9, -90, -90, -180, -180], [0, 71, 0, 0, 43, 28, 0, 71, 71, -43, -71, 240, 43, 43, 114, 114], [0, 325, 0, 0, 26, 13, 0, 26, 26, -26, -247, 78, 52, 52, 273, 273], [375, -5, 0, 207, 0, -5, -207, -18, 8, 0, 5, 0, 8, -8, 5, -5], [-190, -117, -190, 0, 0, -117, 331, 0, -234, 52, 169, 0, -169, 169, 117, -117], [0, 2, 0, 0, -122, 152, 0, 2, 2, 30, 0, -28, -38, -38, -30, -30], [0, -168, 0, 0, 133, -404, 0, -38, -38, -133, 225, 57, 95, 95, -92, -92], [370, 65, 370, 0, 0, 65, -772, 0, 130, -47, -112, 0, 112, -112, -65, 65], [0, 120, 0, 0, 9, 120, 0, 145, 145, 120, -120, 0, 0, 0, 0, 0], [0, -69, 117, -64, 0, -69, -117, -69, -69, -69, 0, 0, 83, -83, 69, -69], [0, -287, 0, 0, 297, -530, 0, -260, -260, -270, 260, 105, 270, 270, 10, 10], [267, -91, 0, 367, 0, -91, -367, -52, -130, 0, 91, 0, -130, 130, 91, -91], [-194, -112, 494, -194, 0, -112, 0, 6, -230, 118, 230, 0, -118, 118, 112, -112], [-280, 45, -280, 0, 0, 45, 955, 0, 90, -26, -71, 0, 71, -71, -45, 45], [0, 9, 0, 0, 248, -250, 0, 9, 9, -2, 0, 11, 274, 274, 2, 2], [656, 0, 477, 477, 0, 0, -656, 36, -36, -107, -107, 0, 0, 0, 0, 0], [232, -26, 232, 0, 0, -26, 619, 0, -52, -1, 25, 0, -25, 25, 26, -26], [0, -176, 0, 0, 0, 288, 0, 0, 0, 183, -102, -207, -105, -105, -81, -81], [-364, 135, 0, -201, 0, 135, 201, -27, 297, 0, -135, 0, 297, -297, -135, 135], [0, 213, 0, 0, 72, 213, 0, 151, 151, 3, -3, 0, 0, 0, 0, 0], [0, 47, -168, -288, 0, 47, 168, 47, 47, 47, 0, 0, 151, -151, -47, 47], [0, -72, 0, 0, -118, 56, 0, -72, -72, -62, 0, -10, -94, -94, 62, 62], [0, 62, 0, 0, -227, 440, 0, 62, 62, 213, 0, -151, -208, -208, -213, -213], [-235, 0, -102, -102, 0, 0, 235, -93, 93, -122, -122, 0, 0, 0, 0, 0], [0, -113, 0, 0, 105, -248, 0, -128, -128, -120, 128, -51, 120, 120, -8, -8], [-164, -32, -164, 0, 0, -32, -11, 0, -64, 71, 103, 0, -103, 103, 32, -32], [0, -67, 0, 0, 0, -205, 0, 0, 0, -85, 192, 312, 120, 120, -107, -107], [-747, 131, -424, -747, 0, 131, 0, 94, 168, -37, -168, 0, 37, -37, -131, 131], [0, -105, 0, 0, 18, -105, 0, 223, 223, 81, -81, 0, 0, 0, 0, 0], [0, -171, -54, -619, 0, -171, 54, -171, -171, -171, 0, 0, 68, -68, 171, -171], [0, -405, 0, 0, 181, -245, 0, -215, -215, -181, 156, -249, -34, -34, 25, 25], [-297, -35, 0, 456, 0, -35, -456, -153, 83, 0, 35, 0, 83, -83, 35, -35], [0, 156, 0, 0, -322, 302, 0, 156, 156, -20, 0, 176, -122, -122, 20, 20], [257, 0, -569, -569, 0, 0, -257, 137, -137, -64, -64, 0, 0, 0, 0, 0], [0, 219, 0, 0, 151, -320, 0, 64, 64, -151, 60, 279, 215, 215, 91, 91], [-66, 0, -92, -92, 0, 0, 66, 8, -8, -45, -45, 0, 0, 0, 0, 0], [0, 403, 0, 0, -375, 736, 0, 382, 382, 354, -382, -135, -354, -354, 28, 28], [0, -25, -133, 387, 0, -25, 133, -25, -25, -25, 0, 0, -22, 22, 25, -25], [0, -29, 0, 0, 0, -603, 0, 0, 0, -470, 254, 387, 133, 133, 216, 216], [0, 23, -304, -177, 0, 23, 304, 23, 23, 23, 0, 0, 146, -146, -23, 23], [0, -190, 0, 0, 424, -649, 0, -190, -190, -225, 0, 35, 145, 145, 225, 225], [106, 217, 106, 0, 0, 217, -479, 0, 434, 68, -149, 0, 149, -149, -217, 217], [0, -288, 0, 0, 413, -547, 0, -288, -288, -134, 0, -154, 219, 219, 134, 134], [0, 339, 0, 0, -320, 562, 0, 145, 145, 320, -369, -30, -175, -175, 49, 49], [0, -240, 0, 0, -58, -152, 0, -225, -225, 73, 225, -324, -73, -73, -298, -298], [-536, -59, 0, -1135, 0, -59, 1135, -161, 43, 0, 59, 0, 43, -43, 59, -59], [0, -56, 0, 0, -10, -56, 0, -66, -66, -244, 244, 0, 0, 0, 0, 0], [0, -57, 0, 0, 0, -743, 0, 0, 0, -396, 208, 555, 347, 347, 188, 188], [0, -126, 0, 0, -40, 178, 0, 6, 6, 172, -6, -60, -172, -172, -166, -166], [-926, -41, 0, -847, 0, -41, 847, -11, -71, 0, 41, 0, -71, 71, 41, -41], [191, 86, -67, 191, 0, 86, 0, 281, -109, 195, 109, 0, -195, 195, -86, 86]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_33_h_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_33_3_h_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_33_3_h_b(:prec:=16)
    chi := MakeCharacter_33_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_33_3_h_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_33_3_h_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_33_h();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,3,sign)));
    Vf := Kernel([<2,R![1771561, 0, -536393, 0, 239275, 0, -96398, 0, 25179, 0, -2562, 0, 180, 0, -12, 0, 1]>],Snew);
    return Vf;
end function;