
// Make newform 170.3.e.b in Magma, downloaded from the LMFDB on 19 May 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_170_e();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_170_e_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_170_3_e_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_170_3_e_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 := [148996, 0, 1253728, 0, 2895224, 0, 1518752, 0, 346464, 0, 40532, 0, 2532, 0, 80, 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], [16798844292, 0, -4559497372, 0, -18020266514, 0, -7577426036, 0, -1262016176, 0, -99736812, 0, -3721365, 0, -52488, 0], [-1449931028, 0, -6384374904, 0, -18020266514, 0, -7577426036, 0, -1262016176, 0, -99736812, 0, -3721365, 0, -52488, 0], [-16735205365204, 0, -71550931446068, 0, -47620350630178, 0, -12363509229350, 0, -1538231293646, 0, -98395469092, 0, -3120350251, 0, -38771169, 0], [0, -1122503633000, 0, -1959750623174, 0, -1389999325100, 0, -407141893168, 0, -56875930552, 0, -4037249823, 0, -140121736, 0, -1878149], [-3056084171162372, 321138673073624, -13470479071061324, -1580363444169332, -8234302026393804, -1791376760827292, -1983985394403850, -574693366141520, -229897131132478, -81555051553164, -13696794237856, -5752504019348, -404716151068, -197010242144, -4697035017, -2602409126], [0, 10592998277920, 0, 18365321875268, 0, 10422081813798, 0, 2608975706732, 0, 325190183552, 0, 21123293514, 0, 682993915, 0, 8651306], [-8805936385452704, -5832550670078336, -38001931352113888, -21820777183879772, -23391944424668768, -12246365361395512, -5851486471431290, -2843893911659740, -729580856635516, -332886381908224, -47822920203602, -20655360660648, -1568872684316, -646446829364, -20198230299, -8001013426], [-198748215235204, 6023921016960888, -3098067338903048, 25619892098284776, -4567940532533628, 14424442803458256, -1678005633784890, 3346149492060840, -262414244313666, 391664790569552, -19967870986762, 24339322948254, -725960269196, 763694289102, -10047017019, 9480497978], [11065359636136584, 11860790251056476, 42028307686233268, 37101439584602792, 23317181448495548, 18554776231196572, 5379039996703650, 3946661075665810, 624598966982976, 435544781727734, 38366027386152, 26060759771148, 1187307739396, 798726604504, 14531097959, 9775375811], [-3971331453836896, -3440128755082696, -15898819821340312, -18397164948500172, -7923461175190952, -11621636141197792, -1627836709248150, -2946751984857290, -171163194920004, -369340174775804, -9722613483538, -24205121442578, -283641137214, -791615026164, -3324084741, -10148364291], [-1941514915730944, 8397649253158504, -10383454038123268, 33760600931059908, -6385560183915048, 19134047670898268, -1548784239486590, 4489768908732010, -185434718900076, 530611334665936, -11639209544372, 33203528393622, -366099747226, 1046737198846, -4536951939, 13034502089], [0, -6429464891046788, 0, -26158823519657626, 0, -14806692617860756, 0, -3458113512682040, 0, -407305671471352, 0, -25449566649579, 0, -802227766502, 0, -9996988953], [2893090015884864, -17670328678319536, 11719657492650308, -73978543063439852, 9082923065562768, -43002049173491572, 2674865522696550, -10280414805249040, 372982942815436, -1232837891349964, 26461097175692, -78064010496848, 919131799876, -2484799054374, 12337193619, -31183879806], [5152513266568744, -23698568259297676, 15746033826769688, -89259205464162872, 9008160089389548, -49310460043292632, 2202419047968910, -11383181969255110, 268001053162896, -1335496291169474, 17004204358242, -83469409607348, 537566854956, -2637078829514, 6670061279, -32958242191]];
    Rf_basisdens := [1, 1, 1824877532, 1824877532, 501841321300, 352201363676, 193710750021800, 352201363676, 193710750021800, 193710750021800, 193710750021800, 193710750021800, 193710750021800, 96855375010900, 193710750021800, 193710750021800];
    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_170_e();"
function MakeCharacter_170_e()
    N := 170;
    order := 4;
    char_gens := [137, 71];
    v := [3, 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_170_e_Hecke();"
function MakeCharacter_170_e_Hecke(Kf)
    N := 170;
    order := 4;
    char_gens := [137, 71];
    char_values := [[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]];
    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 := [[1, 0, 0, 0, 0, -1, 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, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0], [0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, -1, -1, 1, 0, 2, 1, 1, -1, 0, 0, 0, -1, 0, 0, 1], [1, -1, 0, 0, 1, 0, -1, 0, 0, -1, 1, 0, 1, 0, 0, 0], [2, -1, -1, 1, 1, 0, 0, 1, -2, 1, -1, 1, -1, 0, 0, 0], [-2, 1, 2, -3, -3, 0, -1, 0, 2, -1, -1, 2, 0, -1, 0, -1], [2, 0, 0, -1, 2, 0, 0, 0, 0, 0, 1, -1, 1, 0, 0, 1], [0, 3, 1, 1, 1, -2, -2, -1, 0, 2, 0, 0, 0, 1, 0, 0], [5, 1, -1, 2, -1, -7, 1, -1, 0, 2, 1, 1, 2, 0, 1, 0], [2, 2, -2, 8, 2, -2, 0, 0, -1, 4, -1, 0, 0, 2, 1, -1], [0, 5, 0, 2, 5, -5, -5, 0, -2, 7, 0, 2, -2, 2, 0, 0], [6, 0, -1, 1, 6, 5, -1, 1, -2, 3, 0, -1, -2, -3, 0, 3], [7, 1, 2, -4, 3, 4, -3, -2, 2, 1, 0, -1, 2, -2, 4, -5], [2, 2, -3, 2, -4, 4, 2, 3, 2, -4, 0, 2, 2, 0, -4, 0], [2, -1, -2, 5, 5, 2, -1, 0, 0, -5, 4, -5, 7, -3, 2, 4], [4, -2, 1, -3, -3, 7, 3, -1, 4, -7, 0, 2, 4, -4, -6, 0], [4, -1, -3, 10, 4, 11, 7, 3, -4, -3, 0, -1, -4, -7, 4, 1], [-20, 15, 8, -5, -2, 17, -4, 8, 4, 3, -5, 7, -2, -6, 7, 0], [0, -6, 0, 1, 1, 9, -1, -2, -4, 1, 3, 8, 6, 2, -2, -3], [-10, 5, 6, 10, 4, 6, -7, 6, -2, 4, -5, 11, 8, -3, 11, 0], [-12, -2, -3, 1, -7, -11, 1, 3, -2, 1, 0, 5, -2, 8, -2, -1], [7, -12, 0, -17, -3, -1, -4, -1, 9, -10, 2, -17, 3, -5, -11, -2], [-17, -1, -10, 15, -11, -3, 4, 0, -3, 10, -1, 2, -10, 7, -5, -1], [8, -8, -5, -1, -12, 8, 0, 0, -1, -16, 4, -5, 5, -8, 1, 4], [19, 7, -2, -8, 2, -16, -5, -2, 6, -3, 5, 2, 1, -3, 2, 0], [8, -9, 0, 2, -3, 2, 7, 0, -13, 3, -1, -5, -9, 5, -1, -1], [-24, 2, 4, 3, 5, 21, 1, 4, -8, 3, -4, 2, 6, 6, 2, 0], [-21, 6, 0, -21, 9, -4, -2, 0, -1, 6, 0, -3, 7, 2, 5, 0], [-23, 16, 6, -1, 11, 20, -9, 6, 6, 3, -5, 12, 1, 2, 12, 0], [25, 13, 6, -14, -1, -29, 9, 6, -4, 4, 1, -5, 0, 8, -5, 0], [-28, -20, -2, -15, -8, -21, 7, 2, 2, -9, 0, -9, 2, -1, 2, 5], [27, -10, -2, -12, 2, 24, -3, 2, -1, 4, 0, -6, -1, 2, 0, 7], [-3, 33, 0, 15, 9, -27, -6, 4, -9, 12, -3, 18, -6, 9, 15, 3], [-4, -1, 0, 3, -5, 4, 9, -16, -2, -1, -1, 0, 2, 11, -4, 1], [14, -2, 1, -14, -10, 16, 2, -1, 14, -16, 0, 6, 14, -6, -18, -2], [-58, -16, -6, 26, -9, 7, 9, 0, -3, -5, -1, 7, -25, 2, -15, -1], [11, 3, 8, 43, 6, -2, -1, 0, -13, 3, -5, -9, 11, 1, 15, -5], [8, 23, 0, -11, 5, -16, -13, -14, 10, -3, 4, -9, -3, -7, 4, -4], [39, 6, 2, -62, -2, -1, -5, 0, 11, -3, 6, 0, 10, -4, -1, 6], [60, 40, 7, 2, 5, 38, -22, -7, 16, 6, 0, -24, 16, 1, 16, -8], [-25, -17, -8, -21, -11, 9, 8, 0, 11, -10, 1, 18, -34, -1, -27, 1], [39, 16, -10, -17, 21, -8, -8, 0, 3, 8, -3, -2, 18, 0, 13, -3], [2, -6, 0, -16, -12, 46, 10, -12, 1, -14, 6, -9, 19, 36, -27, -6], [3, 7, 8, 8, 2, 3, 0, -8, -1, 1, 0, 22, -1, -1, -20, -1], [18, 1, -1, 8, -17, 26, 8, 1, 1, -9, 0, 18, 1, 8, -6, -13], [25, 66, 10, 35, 22, 4, -21, -10, 10, 11, 0, -21, 10, -11, 16, -5], [-1, 3, 0, 3, 1, 34, 0, -2, -6, 2, -12, -4, -8, 8, -2, 12], [-37, 27, 3, 24, -11, -9, -18, 0, 23, 0, -5, 10, 26, -9, 13, -5], [5, -80, 0, -14, -4, 29, -1, -12, 4, -9, 5, -8, 10, 22, -14, -5], [-8, -26, 0, 16, 0, 146, 8, 10, -8, 8, 0, 16, 0, -4, 8, 0], [-54, -21, -17, 18, -3, 49, 13, -17, -8, 5, 6, -8, 6, 10, -8, 0], [7, 5, -10, -23, 13, -9, 4, 0, -15, 22, 6, -17, 9, 13, 7, 6], [85, 66, 9, -39, 7, -84, -29, 9, 10, -1, -17, 28, 1, -22, 28, 0], [-58, -36, 19, -45, -20, -45, 13, -19, 22, -35, 0, -29, 22, -15, 2, 5], [-13, -25, -6, 16, 6, 0, 13, 6, -28, 15, 0, 22, -28, 9, 14, -8], [-85, -11, -6, 33, 3, -5, 16, 0, -16, 26, -4, 4, -36, 21, -16, -4], [161, 3, 6, -48, -24, 0, -3, 0, 8, -3, 3, 2, 4, -3, -2, 3], [-10, 4, 0, 4, -16, -144, 26, 12, 17, -6, 1, -22, -10, -2, 5, -1], [-37, 30, 22, -80, 7, -4, -26, 0, 26, -18, -7, 7, 45, -22, 26, -7], [120, -75, -12, 9, -3, -88, 2, -12, -12, -32, 4, -34, -18, -1, -34, 0], [-195, -15, 6, -10, 4, -196, -1, -6, -6, 7, 0, -9, -6, 3, 16, -1], [-93, -14, -14, 32, -23, 72, 24, -14, 12, 21, 11, -3, -4, 1, -3, 0], [50, -8, -6, 7, -33, 1, 7, 0, 0, 5, -11, 18, -32, 6, -14, -11], [6, -21, 0, -6, 6, -63, -12, 12, 9, 0, -13, -22, -22, -11, 9, 13], [4, 63, 0, -5, 3, -148, -7, -18, 26, -1, 15, -12, -10, -19, 24, -15], [21, -28, 2, 82, 28, 11, 17, 0, -36, -5, 14, -33, -1, 6, 2, 14], [2, -9, 0, -33, -29, -129, 27, -20, 27, -31, 8, -50, 12, -6, -35, -8], [27, -1, -2, -51, -53, 5, -4, 0, 11, -14, -4, 11, -3, -9, -3, -4], [-29, -1, 11, 39, 44, 23, -26, 11, -24, 6, 8, 32, 64, 18, 32, 0], [-162, 49, 4, -33, 29, -26, -23, 0, 15, 29, -15, 7, 39, 3, 31, -15], [-4, 34, 0, 14, 6, 241, -2, 12, -10, 10, -16, 4, -16, -57, 10, 16], [50, -51, -19, 12, -20, -55, 49, -19, 4, 5, 21, -44, -27, 29, -44, 0], [-151, -17, -25, 42, -8, -109, 42, 25, -17, -25, 0, -16, -17, -17, -14, 47], [44, 65, 12, -8, -1, 15, -29, -12, 44, -15, 0, -21, 44, -14, -22, -1], [58, -20, -7, -33, -18, 14, 6, 0, -12, -22, -13, 7, -19, -8, 0, -13], [25, -35, 0, -26, 24, 26, -49, -26, 12, -1, 34, 21, 23, 23, 10, -34], [12, -1, 33, -71, -21, -24, -36, -33, 34, 2, 0, 12, 34, 23, -18, -28], [2, -54, 0, -4, 0, 194, -2, -32, 12, -2, 10, -4, 0, 18, 8, -10], [-50, -21, -35, 4, -38, 62, -7, -35, 26, -12, -3, -5, -34, -45, -5, 0], [0, 38, 35, -31, 8, -20, -18, 0, 0, 22, -26, 8, 28, 2, 36, -26], [129, 48, -26, 71, 24, 119, -10, 26, -33, 43, 0, 38, -33, 19, -2, -3], [5, -24, -45, 45, 37, 30, 25, 45, -44, 19, 0, -13, -44, -18, 24, 33], [-101, 38, 21, 32, 10, -112, -11, -21, -5, 16, 0, 0, -5, 6, 14, -9], [68, 13, 7, 30, -1, -101, 23, 7, -60, 33, -15, 10, 55, 22, 10, 0], [-98, 0, -29, -75, -17, 125, 21, -29, 26, -27, 6, -48, -68, 4, -48, 0], [116, -26, -16, 5, 36, -93, -25, -16, 18, -23, 27, 2, 11, 11, 2, 0], [-21, -85, 0, 39, -3, -113, 24, 48, -17, 18, -36, -1, -37, -35, 19, 36], [73, -31, 14, 66, -26, -102, 23, 14, 0, 29, -19, 6, -13, -3, 6, 0], [-52, -73, -32, 42, 2, 55, 25, -32, -34, -3, 33, -28, 39, 27, -28, 0], [74, 72, 21, 25, 3, 44, -30, -21, 17, 13, 0, 20, 17, 10, 14, -51], [-11, -49, 0, 21, -1, 110, 12, 40, 18, 10, -4, -12, -32, -10, 38, 4], [17, 16, 0, -24, 10, 181, -27, 26, 1, -7, 17, 9, 23, -26, -13, -17], [250, 57, 19, -14, -22, -264, -15, 19, 4, 14, -15, 29, 10, -37, 29, 0], [-333, 12, -8, 108, 1, 8, -20, 0, 12, -36, 17, -25, 65, -28, 28, 17], [-10, 60, 0, -4, -24, 228, 34, -36, 20, -14, 3, -31, -3, 16, -8, -3], [15, 34, -5, 56, -22, 35, 20, 5, -2, -18, 0, -26, -2, 4, -16, 44], [-93, 35, 18, -36, -9, 102, -17, 18, 42, -9, 5, 8, -29, -26, 8, 0], [123, 39, 12, -13, 20, -153, 34, 12, -18, 30, 4, -4, 18, 54, -4, 0], [-3, -31, -56, -30, -7, 13, 18, 0, -32, -8, 13, -27, -9, 5, -4, 13], [60, 39, -27, 82, 16, 61, 1, 27, -42, 41, 0, 9, -42, 25, 40, -7], [147, 153, 21, 108, 26, 110, -37, -21, 8, 29, 0, -37, 8, 3, 10, 19], [-15, -33, 2, -21, 25, 5, 28, 0, -60, 18, -30, -2, -54, 23, 4, -30], [-38, -87, -26, -16, -1, 2, 40, 26, -31, -9, 0, -18, -31, -8, 22, 27], [-99, -57, -20, 20, -7, -54, 45, 20, -32, -13, 0, 51, -32, -6, -42, 23], [-170, 70, 9, -121, 39, 215, -39, 9, 28, -45, -9, -6, -43, 0, -6, 0], [-54, -43, 32, -83, 16, -64, -10, -32, 30, -20, 0, -32, 30, -36, 6, -4], [-23, -51, 0, 9, -37, 47, 60, -64, -11, -14, 9, 6, 34, 37, -39, -9], [188, -7, 15, -36, -87, 205, 17, -15, 46, -63, 0, -24, 46, 24, -16, -6], [-113, -35, -22, -6, 19, 3, 32, 0, 4, 26, -3, 39, -103, 29, -68, -3], [126, 102, 15, -112, -25, -112, -18, 15, 52, -14, 10, 4, -38, -43, 4, 0], [336, 21, 16, 8, 92, 5, -26, 0, 15, -36, -2, -9, 61, -31, 37, -2], [-288, 94, 26, -14, -8, 233, 30, 26, -12, 55, -43, 25, -6, 22, 25, 0], [6, -81, 0, -1, 11, -196, -17, 12, 10, 5, 37, 32, 22, 39, 20, -37], [155, 51, 5, -12, -4, -166, -17, 5, 34, 11, 10, 28, 4, -21, 28, 0], [24, -59, 0, -56, -8, 22, -16, -20, 46, -32, 20, -58, 6, 58, -18, -20], [-185, 36, -21, 87, -7, -166, 19, 21, -32, 13, 0, 59, -32, 20, -14, -13], [300, 63, 24, -23, -29, -28, -35, 0, 60, 21, 2, 23, 47, -7, 10, 2], [19, -45, 0, -33, 5, -271, -24, -8, 28, -14, 10, -32, -4, -11, 0, -10], [-6, 124, 0, 30, 18, 314, -12, 22, -3, 24, -37, -10, -58, -114, 45, 37], [-196, 47, 14, 14, -62, -27, -20, 0, 41, 34, -6, 27, 13, 7, -1, -6], [332, 28, 8, -133, -57, -15, -13, 0, 46, 17, -3, 36, -10, 2, -20, -3], [-26, -22, 0, 53, 1, 152, 25, 58, -45, 27, -44, 28, -26, -25, 9, 44], [40, 86, 9, -24, 35, -9, -49, -9, 61, -12, 0, -42, 61, -47, 40, -59], [86, -34, 31, -57, 56, 16, 18, 0, -46, -14, 9, -37, 1, 2, 10, 9], [-25, 36, -30, 0, -28, -31, -6, 30, 30, -24, 0, 22, 30, 4, -56, 4], [-23, 54, 39, -12, -28, -24, -1, -39, 65, -64, 0, -58, 65, -36, 42, -49], [-77, -78, 37, -101, -72, -58, 19, -37, 42, -61, 0, 21, 42, 11, -72, 9], [-43, 93, 11, 179, -32, -11, 32, -11, -54, 22, 0, 100, -54, 54, -24, -22], [-113, -88, -48, 50, -22, 59, 29, 0, -40, -89, 39, -50, -8, -30, -18, 39], [-30, -14, 0, 65, 5, 80, 25, 12, -83, 35, -70, 48, -22, -31, -13, 70], [-398, 43, -6, 53, 30, 347, 6, -6, -8, 51, -15, 45, 38, 36, 45, 0], [53, 27, -48, -36, -25, -50, 3, -48, -34, -3, 35, -6, 63, -22, -6, 0], [320, 6, 27, 29, 58, 4, -10, 0, -9, -18, -12, -7, 27, -14, 29, -12], [33, 92, 0, -17, 49, 137, -82, 21, 27, 16, 24, 13, -19, -37, 59, -24], [-86, -10, 62, 7, -50, -73, 13, -62, -4, -9, 0, 115, -4, 41, -50, -61], [299, 8, 26, 34, -121, 2, -10, 0, 24, -14, -23, 37, -17, -12, -4, -23], [88, -6, -41, -6, 31, -50, -64, -41, 54, -38, 6, 26, -22, -33, 26, 0], [375, 43, 14, 19, -20, -419, 26, 14, 16, 44, -36, 18, -34, 6, 18, 0], [192, -167, -16, -15, 2, -115, 28, -16, -52, -77, 35, -105, -18, 30, -105, 0], [165, -94, -55, -15, 64, -94, -33, -55, 20, -71, 96, -38, 38, 31, -38, 0], [28, 33, 44, 70, 39, -38, 5, 0, -47, 81, 11, -53, 43, 43, 37, 11], [15, -134, 0, -45, -15, -283, 0, -106, 18, -30, 4, -44, 16, 31, -42, -4], [46, -56, 0, -34, 58, -160, -104, 24, -16, 12, 22, 50, 26, -60, 8, -22], [447, 23, -2, -103, 21, -436, 58, -2, 0, -11, 35, -69, -34, 79, -69, 0], [0, 72, 0, 32, 32, 12, -32, 12, 1, 32, 13, 44, -20, -64, 65, -13], [-22, -6, 0, 37, -7, -413, 29, 68, 14, 15, -23, -22, -52, 40, 44, 23], [-252, 31, 64, -15, 9, -22, -9, 0, 29, 35, 16, 4, 14, 13, -11, 16], [-113, 18, 21, -43, 11, 136, -21, 21, 22, -23, -49, -2, -73, -10, -2, 0], [30, 55, 0, -38, 22, 603, -52, -8, -5, -8, -12, -15, 1, 17, -21, 12], [141, -34, -35, -97, 6, -48, -55, -35, 70, -93, 34, -38, -74, -49, -38, 0], [436, 32, 6, -101, 11, -421, 39, 6, -4, -15, -1, -54, -51, 50, -54, 0], [-249, 4, 28, -61, 18, 17, -21, 0, 17, -55, 1, -5, 47, -38, 25, 1], [-16, -82, 0, 6, -26, 85, 42, 20, -30, -10, -4, 16, 36, 81, -50, 4], [4, 108, 7, 38, 45, -69, -73, -7, -3, 76, 0, -96, -3, 31, 124, -25], [15, -93, 0, -47, -17, 539, 2, -46, 63, -32, 35, -60, 4, -9, -1, -35], [-14, 113, 92, -28, -13, -9, -39, 92, 22, 23, -76, 62, -36, -52, 62, 0], [290, -56, 77, 36, -12, -274, -12, 77, -78, -16, -38, -4, 36, -24, -4, 0], [344, -101, 44, -63, 9, 358, 14, -44, -24, 10, 0, 78, -24, 1, -36, -18], [137, -67, -38, 45, 96, 20, 47, 0, -113, 7, 11, -77, -17, 27, 19, 11], [235, -32, 43, -37, 53, -208, 15, 43, 14, -27, 11, -42, -45, 68, -42, 0], [129, -79, 63, 124, 29, -150, -3, 63, -36, 21, -15, 24, 45, 26, 24, 0], [-54, -235, 0, 109, 1, -60, 53, 52, -103, 55, -43, 115, 5, 123, 7, 43], [-19, -267, -47, 165, -45, 53, 34, -47, -78, -34, 26, -68, 36, -11, -68, 0], [59, -136, 0, -88, 30, 130, -89, -42, 57, -29, -32, -118, -60, -91, -1, 32], [163, -80, -15, 46, -61, -214, 136, -15, -2, 51, -11, -85, -94, 75, -85, 0], [-13, 170, 0, 56, 30, 503, -17, 76, -50, 43, -76, 17, -69, -128, 36, 76]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_170_e_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_170_3_e_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_170_3_e_b(:prec:=16)
    chi := MakeCharacter_170_e();
    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_170_3_e_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_170_3_e_b( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_170_e();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,3,sign)));
    Vf := Kernel([<3,R![148996, 0, 1253728, 0, 2895224, 0, 1518752, 0, 346464, 0, 40532, 0, 2532, 0, 80, 0, 1]>],Snew);
    return Vf;
end function;