def create_key(self, k, p=None, prec_cap=None, base=None, base_coeffs=None, \ character=None, adjuster=None, act_on_left=False, \ dettwist=None, variable_name = 'w'): if base is None: if base_coeffs is None: if p is None: raise ValueError("Must specify a prime, a base ring, or coefficients.") if prec_cap is None: raise ValueError("Must specify a precision cap or a base ring.") prec_cap = _prec_cap_parser(prec_cap) base_coeffs = Zp(p, prec = prec_cap[0]) elif not isinstance(base_coeffs, ring.Ring): raise TypeError("base_coeffs must be a ring if base is None") elif prec_cap is None: raise ValueError("Must specify a precision cap or a base ring.") else: prec_cap = _prec_cap_parser(prec_cap) if base_coeffs.precision_cap() < prec_cap[0]: raise ValueError("Precision cap on coefficients of base ring must be at least the p-adic precision cap of this space.") base = PowerSeriesRing(base_coeffs, name=variable_name, default_prec=prec_cap[1]) elif prec_cap is None: prec_cap = [ZZ(base.base_ring().precision_cap()), ZZ(base.default_prec())] else: if base.base_ring().precision_cap() < prec_cap[0]: raise ValueError("Precision cap on coefficients of base ring must be at least the p-adic precision cap of this space.") if base.default_prec() < prec_cap[1]: raise ValueError("Default precision on the variable of base ring must be at least the w-adic precision cap of this space.") base_coeffs = None p = base.base_ring().prime() k_shift = 0 #if character is not None: # #Should we ensure character is primitive? # cond_val = character.conductor().valuation(p) # if cond_val > 1: # raise ValueError("Level must not be divisible by p^2.") # elif cond_val == 1: # pass # else: # pass k = ZZ((k + k_shift) % (p-1)) #if prec_cap is None: # prec_cap = [base.base_ring().precision_cap, base.default_prec()] #else: # prec_cap = list(prec_cap) #prec_cap = [base.base_ring().precision_cap(), base.default_prec()] if adjuster is None: adjuster = _default_adjuster() if dettwist is not None: dettwist = ZZ(dettwist) if dettwist == 0: dettwist = None return (k, p, tuple(prec_cap), base, character, adjuster, act_on_left, dettwist)
def eis_H(a, b, N, k, Q=None, t=1, prec=10): if Q == None: Q = PowerSeriesRing(CyclotomicField(N), 'q') R = Q.base_ring() zetaN = R.zeta(N) q = Q.gen() a = ZZ(a % N) b = ZZ(b % N) s = 0 if k == 1: if a == 0 and not b == 0: s = -QQ(1) / QQ(2) * (1 + zetaN**b) / (1 - zetaN**b) elif b == 0 and not a == 0: s = -QQ(1) / QQ(2) * (1 + zetaN**a) / (1 - zetaN**a) elif a != 0 and b != 0: s = -QQ(1) / QQ(2) * ((1 + zetaN**a) / (1 - zetaN**a) + (1 + zetaN**b) / (1 - zetaN**b)) elif k > 1: s = hurwitz_hat(-b, N, 1 - k, zetaN) for m in srange(1, prec / t): for n in srange(1, prec / t / m + 1): s += (zetaN**(-a * m - b * n) + (-1)**k * zetaN**(a * m + b * n)) * n**(k - 1) * q**(m * n) return s + O(q**floor(prec))
def eis_G(a, b, N, k, Q=None, t=1, prec=20): if Q == None: Q = PowerSeriesRing(QQ, 'q') R = Q.base_ring() q = Q.gen() a = ZZ(a % N) b = ZZ(b % N) s = 0 if k == 1: if a == 0 and not b == 0: s = QQ(1) / QQ(2) - QQ(b % N) / QQ(N) elif b == 0 and not a == 0: s = QQ(1) / QQ(2) - QQ(a % N) / QQ(N) elif k > 1: if b == 0: s = -N**(k - 1) * ber_pol(QQ(a % N) / QQ(N), k) / QQ(k) #If a == 0 or b ==0 the loop has to start at 1 starta, startb = 0, 0 if a == 0: starta = 1 if b == 0: startb = 1 for v in srange(starta, (prec / t + a) / N): for w in srange(startb, (prec / t / abs((-a + v * N)) + b) / N + 1): s += q**(t * (a + v * N) * (b + w * N)) * (a + v * N)**(k - 1) if (-a + v * N) > 0 and (-b + w * N) > 0: s += (-1)**k * q**(t * (-a + v * N) * (-b + w * N)) * (-a + v * N)**(k - 1) return s + O(q**floor(prec))
def eis_E(cv, dv, N, k, Q=None, param_level=1, prec=10): r""" Computes the coefficient of the Eisenstein series for $\Gamma(N)$. Not intended to be called by user. INPUT: - cv - int, the first coordinate of the vector determining the \Gamma(N) Eisenstein series - dv - int, the second coordinate of the vector determining the \Gamma(N) Eisenstein series - N - int, the level of the Eisenstein series to be computed - k - int, the weight of the Eisenstein seriess to be computed - Q - power series ring, the ring containing the q-expansion to be computed - param_level - int, the parameter of the returned series will be q_{param_level} - prec - int, the precision. The series in q_{param_level} will be truncated after prec coefficients OUTPUT: - an element of the ring Q, which is the Fourier expansion of the Eisenstein series """ if Q == None: Q = PowerSeriesRing(CyclotomicField(N), 'q') R = Q.base_ring() zetaN = R.zeta(N) q = Q.gen() cv = cv % N dv = dv % N #if dv == 0 and cv == 0 and k == 2: # raise ValueError("E_2 is not a modular form") if k == 1: if cv == 0 and dv == 0: raise ValueError("that shouldn't have happened...") elif cv == 0 and dv != 0: s = QQ(1) / QQ(2) * (1 + zetaN**dv) / (1 - zetaN**dv) elif cv != 0: s = QQ(1) / QQ(2) - QQ(cv) / QQ(N) + floor(QQ(cv) / QQ(N)) elif k > 1: if cv == 0: s = hurwitz_hat(QQ(dv), QQ(N), 1 - k, zetaN) else: s = 0 for n1 in xrange(1, prec): # this is n/m in DS for n2 in xrange(1, prec / n1 + 1): # this is m in DS if Mod(n1, N) == Mod(cv, N): s += n2**(k - 1) * zetaN**(dv * n2) * q**(n1 * n2) if Mod(n1, N) == Mod(-cv, N): s += (-1)**k * n2**(k - 1) * zetaN**(-dv * n2) * q**(n1 * n2) return s + O(q**floor(prec))
def eis_F(cv, dv, N, k, Q=None, prec=10, t=1): """ Computes the coefficient of the Eisenstein series for $\Gamma(N)$. Not indented to be called by user. INPUT: - cv - int, the first coordinate of the vector determining the \Gamma(N) Eisenstein series - dv - int, the second coordinate of the vector determining the \Gamma(N) Eisenstein series - N - int, the level of the Eisenstein series to be computed - k - int, the weight of the Eisenstein seriess to be computed - Q - power series ring, the ring containing the q-expansion to be computed - param_level - int, the parameter of the returned series will be q_{param_level} - prec - int, the precision. The series in q_{param_level} will be truncated after prec coefficients OUTPUT: - an element of the ring Q, which is the Fourier expansion of the Eisenstein series """ if Q == None: Q = PowerSeriesRing(CyclotomicField(N), 'q{}'.format(N)) R = Q.base_ring() zetaN = R.zeta(N) q = Q.gen() s = 0 if k == 1: if cv % N == 0 and dv % N != 0: s = QQ(1) / QQ(2) * (1 + zetaN**dv) / (1 - zetaN**dv) elif cv % N != 0: s = QQ(1) / QQ(2) - QQ(cv) / QQ(N) + floor(QQ(cv) / QQ(N)) elif k > 1: s = -ber_pol(QQ(cv) / QQ(N) - floor(QQ(cv) / QQ(N)), k) / QQ(k) for n1 in xrange(1, ceil(prec / QQ(t))): # this is n/m in DS for n2 in xrange(1, ceil(prec / QQ(t) / QQ(n1)) + 1): # this is m in DS if Mod(n1, N) == Mod(cv, N): s += N**(1 - k) * n1**(k - 1) * zetaN**(dv * n2) * q**(t * n1 * n2) if Mod(n1, N) == Mod(-cv, N): s += (-1)**k * N**(1 - k) * n1**(k - 1) * zetaN**( -dv * n2) * q**(t * n1 * n2) return s + O(q**floor(prec))
def __init__(self, k, p=None, prec_cap=[20, 10], base=None, base_coeffs=None, \ character=None, adjuster=None, act_on_left=False, \ dettwist=None, action_class = WeightKAction_OMS_fam, \ variable_name = 'w'): #self._prec_cap = prec_cap if base is None: if base_coeffs is None: base_coeffs = Zp(p, prec = prec_cap[0]) elif not isinstance(base_coeffs, ring.Ring): raise TypeError("base_coeffs must be a ring if base is None") base = PowerSeriesRing(base_coeffs, name=variable_name) #elif not isinstance(base, ring.Ring): # raise TypeError("base must be a ring") self._p = base.base_ring().prime() #self._prec_cap = [base.base_ring().precision_cap(), base.default_prec()] self._prec_cap = tuple(prec_cap) k = k % (self._p - 1) #self._cp = (self._p-2) / (self._p-1) CoefficientModule_generic.__init__(self, k, base=base, \ character=character, adjuster=adjuster, act_on_left=act_on_left, \ dettwist=dettwist, action_class=action_class, \ element_class=CoeffMod_OMS_Families_element, padic=True)