def return_dimension(level=None, weight=None, chi=None, **kwds): if request.method == 'GET': info = to_dict(request.args) else: info = to_dict(request.form) level = my_get(info, 'level', level, int) weight = my_get(info, 'weight', weight, int) chi = my_get(info, 'chi', chi, int) if level is None or weight is None: return emf_error("Please supply level weight (and optional character)!"), 500 ttype = my_get(kwds, 'ttype', info.get('ttype', 'new'), str) emf_logger.debug("level,weight,chi: {0},{1},{2}, type={3}".format(level, weight, chi, ttype)) if chi == 0 or chi is None: x = level else: x = DirichletGroup(level).list()[chi] if ttype == 'new': return str(dimension_new_cusp_forms(x, weight)) if ttype == 'cusp': return str(dimension_cusp_forms(x, weight)) if ttype == 'modular': return str(dimension_modular_forms(x, weight)) if ttype == 'eisenstein': return str(dimension_eis(x, weight)) s = "Please use one of the available table types: 'new', 'cusp','modular', 'eisenstein' Got:{0}".format( ttype) return emf_error(s), 500
def as_polynomial_in_E4_and_E6(self,insert_in_db=True): r""" If self is on the full modular group writes self as a polynomial in E_4 and E_6. OUTPUT: -''X'' -- vector (x_1,...,x_n) with f = Sum_{i=0}^{k/6} x_(n-i) E_6^i * E_4^{k/4-i} i.e. x_i is the coefficient of E_6^(k/6-i)* """ if(self.level() != 1): raise NotImplementedError("Only implemented for SL(2,Z). Need more generators in general.") if(self._as_polynomial_in_E4_and_E6 is not None and self._as_polynomial_in_E4_and_E6 != ''): return self._as_polynomial_in_E4_and_E6 d = self._parent.dimension_modular_forms() # dimension of space of modular forms k = self.weight() K = self.base_ring() l = list() # for n in range(d+1): # l.append(self._f.q_expansion(d+2)[n]) # v=vector(l) # (self._f.coefficients(d+1)) v = vector(self.coefficients(range(d),insert_in_db=insert_in_db)) d = dimension_modular_forms(1, k) lv = len(v) if(lv < d): raise ArithmeticError("not enough Fourier coeffs") e4 = EisensteinForms(1, 4).basis()[0].q_expansion(lv + 2) e6 = EisensteinForms(1, 6).basis()[0].q_expansion(lv + 2) m = Matrix(K, lv, d) lima = floor(k / 6) # lima=k\6; if((lima - (k / 2)) % 2 == 1): lima = lima - 1 poldeg = lima col = 0 monomials = dict() while(lima >= 0): deg6 = ZZ(lima) deg4 = (ZZ((ZZ(k / 2) - 3 * lima) / 2)) e6p = (e6 ** deg6) e4p = (e4 ** deg4) monomials[col] = [deg4, deg6] eis = e6p * e4p for i in range(1, lv + 1): m[i - 1, col] = eis.coefficients()[i - 1] lima = lima - 2 col = col + 1 if (col != d): raise ArithmeticError("bug dimension") # return [m,v] if self._verbose > 0: wmf_logger.debug("m={0}".format(m, type(m))) wmf_logger.debug("v={0}".format(v, type(v))) try: X = m.solve_right(v) except: return "" self._as_polynomial_in_E4_and_E6 = [poldeg, monomials, X] return [poldeg, monomials, X]
def set_dimensions(self): r""" The dimension of the subspace of newforms in self. """ if self._chi != 1: x = self.character().sage_character() else: x = self.level() k = self.weight() # Ambient modular formsspace if self._dimension_modular_forms is None: self._dimension_modular_forms = int(dimension_modular_forms(x,k)) # Cuspidal subspace if self._dimension_cusp_forms is None: self._dimension_cusp_forms = int(dimension_cusp_forms(x,k)) # New cuspidal subspace if self._dimension_new_cusp_forms is None: self._dimension_new_cusp_forms = int(dimension_new_cusp_forms(x,k)) # New subspace of ambient space if self._dimension_newspace is None: if self._cuspidal == 1: self._dimension_newspace = self.dimension_new_cusp_forms() else: self._dimension_newspace = self._newspace.dimension() # Old subspace of self. if self._dimension_oldspace is None: if self._cuspidal == 1: self._dimension_oldspace = self.dimension_cusp_forms() - self.dimension_new_cusp_forms() else: self._dimension_oldspace = self.dimension_modular_forms() - self.dimension_newforms() if self._dimension is None: if self._cuspidal == 1: self._dimension = self.dimension_cusp_forms() elif self._cuspidal == 0: self._dimension = self.dimension_modular_forms()