
# q-expansion of newform 176.4.a.h, downloaded from the LMFDB on 21 September 2026.

# We generate the q-expansion using the Hecke eigenvalues a_p at the primes.
# Each a_p is given as a linear combination
# of the following basis for the coefficient ring.

def make_data():

    from sage.all import prod, floor, prime_powers, gcd, QQ, primes_first_n, next_prime, RR

    def discrete_log(elts, gens, mod):
        # algorithm 2.2, page 16 of https://arxiv.org/abs/0903.2785
        def table_gens(gens, mod):
            T = [1]
            n = len(gens)
            r = [None]*n
            s = [None]*n
            for i in range(n):
                beta = gens[i]
                r[i] = 1
                N = len(T)
                while beta not in T:
                    for Tj in T[:N]:
                        T.append((beta*Tj) % mod)
                    beta = (beta*gens[i]) % mod
                    r[i] += 1
                s[i] = T.index(beta)
            return T, r, s
        T, r, s = table_gens(gens, mod)
        n = len(gens)
        N = [ prod(r[:j]) for j in range(n) ]
        Z = lambda s: [ (floor(s/N[j]) % r[j]) for j in range(n)]
        return [Z(T.index(elt % mod)) for elt in elts]
    def extend_multiplicatively(an):
        for pp in prime_powers(len(an)-1):
            for k in range(1, (len(an) - 1)//pp + 1):
                if gcd(k, pp) == 1:
                    an[pp*k] = an[pp]*an[k]
    from sage.all import PolynomialRing, NumberField, ZZ
    R = PolynomialRing(QQ, "x")
    f = R(poly_data)
    K = NumberField(f, "a")
    betas = [K([c/ZZ(den) for c in num]) for num, den in basis_data]
    convert_elt_to_field = lambda elt: sum(c*beta for c, beta in zip(elt, betas))
    # convert aps to K elements
    primes = primes_first_n(len(aps_data))
    good_primes = [p for p in primes if not p.divides(level)]
    aps = map(convert_elt_to_field, aps_data)
    if not hecke_ring_character_values:
        # trivial character
        char_values = dict(zip(good_primes, [1]*len(good_primes)))
    else:
        gens = [elt[0] for elt in hecke_ring_character_values]
        gens_values = [convert_elt_to_field(elt[1]) for elt in hecke_ring_character_values]
        char_values = dict([(
            p,prod(g**k for g, k in zip(gens_values, elt)))
            for p, elt in zip(good_primes, discrete_log(good_primes, gens, level))
            ])
    an_list_bound = next_prime(primes[-1])
    an = [0]*an_list_bound
    an[1] = 1
    
    from sage.all import PowerSeriesRing
    PS = PowerSeriesRing(K, "q")
    for p, ap in zip(primes, aps):
        if p.divides(level):
            euler_factor = [1, -ap]
        else:
            euler_factor = [1, -ap, p**(weight - 1) * char_values[p]]
        k = RR(an_list_bound).log(p).floor() + 1
        foo = (1/PS(euler_factor)).padded_list(k)
        for i in range(1, k):
            an[p**i] = foo[i]
    extend_multiplicatively(an)
    return PS(an)
level = 176
weight = 4
poly_data = [-1, -1, 1]

# The entries in the following list give a basis for the
# coefficient ring in terms of a root of the defining polynomial above.
# Each line consists of the coefficients of the numerator, and a denominator.
basis_data  = [[[1, 0], 1], [[-2, 4], 1]]

hecke_ring_character_values = None
aps_data = [[0, 0], [1, 1], [-3, 4], [28, 1], [-11, 0], [-22, -11], [-4, -15], [94, 9], [33, -29], [-28, 46], [-103, 7], [71, -52], [126, 13], [186, -28], [100, 18], [-530, -14], [391, -47], [-120, -70], [-141, 65], [-377, 15], [34, 161], [-26, -88], [-2, -166], [139, -186], [153, -104], [-800, 213], [516, -18], [184, -135], [154, -188], [1493, -38], [626, 323], [1400, -57], [-99, -206], [2080, -95], [1184, -41], [78, 594], [-1355, -536], [-620, -336], [1810, -519], [-2606, -176], [319, 215], [3063, 318], [575, -319], [892, 436], [-2122, -368], [1184, 368], [-724, 520], [4305, 89], [-2176, -467], [-1049, -822], [2228, 306], [-4386, 322], [3916, 374], [-7237, -79], [-2902, -382], [-2772, 769], [274, -1008], [-726, -187], [-2622, 858], [2402, 334], [5704, -90], [42, -201], [526, 437], [-2112, 934], [-4165, 526], [-1511, 1976], [5429, 335], [-2344, 969], [8390, -549], [-2052, -379], [431, 150], [-6486, 457], [785, 71], [10908, 17], [4245, 353], [8325, -1347], [6201, 814], [-750, 866], [4286, 698], [-5310, -568], [5008, -1222], [-2870, -1654], [-5912, 91], [7389, 1716], [-1116, -1982], [-6337, 669], [6783, 850], [-6080, 1418], [-2736, -2938], [-4337, -597], [879, 161], [8974, -69], [-1187, -4255], [9872, -812], [7388, 2788], [11126, 160], [10999, 614], [-8235, 1536], [-4158, -33], [-16510, 1195], [-5324, 3322], [-15936, 739], [-1088, -3062], [4700, 98], [-6228, -2588], [7077, -1394], [4376, 4034], [8604, 3864], [7360, 2724], [8580, 2951], [3386, 1784], [5128, -2428], [-3742, -1928], [-6951, -43], [-13343, 1695], [423, -1324], [8019, -2797], [12239, 2537], [4847, -3514], [1074, -1688], [-9123, 1574], [382, 3032], [-1424, 447], [11580, 3210], [-5169, -4065], [12208, -667], [11327, 730], [7893, 2373], [-3095, -5535], [1752, 1418], [6558, 4134], [-7108, -5052], [19003, -1009], [30114, 944], [3718, -5005], [-22294, 3013], [2554, -3660], [-292, -5278], [-11651, 5714], [10310, -6403], [20130, 2336], [-10018, 920], [9261, -559], [-314, -2253], [-15419, 1232], [-10903, 1949], [-1962, 1576], [-28720, -3876], [-15625, 3423], [-11752, -2272], [-30026, 2151], [-36111, 370], [-18328, -146], [-38534, -2320], [-31596, -248], [12152, 954], [-2350, -5100], [-5082, -9130], [8782, 3933], [-28050, -790], [-30901, -5397], [8176, 1921], [11524, 9630], [-2771, 1223], [465, -11230], [-18339, -3007], [-28344, 4520], [-19552, -5873]]
