def newform(self, names=None): r""" Return the newform that this modular abelian variety is attached to. EXAMPLES:: sage: f = Newform('37a') sage: A = f.abelian_variety() sage: A.newform() q - 2*q^2 - 3*q^3 + 2*q^4 - 2*q^5 + O(q^6) sage: A.newform() is f True If the a variable name has not been specified, we must specify one:: sage: A = AbelianVariety('67b') sage: A.newform() Traceback (most recent call last): ... TypeError: You must specify the name of the generator. sage: A.newform('alpha') q + alpha*q^2 + (-alpha - 3)*q^3 + (-3*alpha - 3)*q^4 - 3*q^5 + O(q^6) If the eigenform is actually over `\QQ` then we don't have to specify the name:: sage: A = AbelianVariety('67a') sage: A.newform() q + 2*q^2 - 2*q^3 + 2*q^4 + 2*q^5 + O(q^6) """ try: return self.__named_newforms[names] except KeyError: self.__named_newforms[names] = Newform(self.__f.parent().change_ring(QQ), self.__f.modular_symbols(1), names=names, check=False) return self.__named_newforms[names]
def minimal_twist(self): r""" Return a newform (not necessarily unique) which is a twist of the original form `f` by a Dirichlet character of `p`-power conductor, and which has minimal level among such twists of `f`. An error will be raised if `f` is already minimal. EXAMPLES:: sage: from sage.modular.local_comp.type_space import TypeSpace, example_type_space sage: T = example_type_space(1) sage: T.form().q_expansion(12) q - q^2 + 2*q^3 + q^4 - 2*q^6 - q^8 + q^9 + O(q^12) sage: g = T.minimal_twist() sage: g.q_expansion(12) q - q^2 - 2*q^3 + q^4 + 2*q^6 + q^7 - q^8 + q^9 + O(q^12) sage: g.level() 14 sage: TypeSpace(g, 7).is_minimal() True Test that :trac:`13158` is fixed:: sage: f = Newforms(256,names='a')[0] sage: T = TypeSpace(f,2) sage: g = T.minimal_twist() sage: g[0:3] [0, 1, 0] sage: str(g[3]) in ('a', '-a', '-1/2*a', '1/2*a') True sage: g[4:] [] sage: g.level() 64 """ if self.is_minimal(): raise ValueError("Form is already minimal") NN = self.form().level() V = self.t_space A = V.ambient() while not V.is_submodule(A.new_submodule()): NN = NN / self.prime() D1 = A.degeneracy_map(NN, 1) Dp = A.degeneracy_map(NN, self.prime()) A = D1.codomain() vecs = [D1(v).element() for v in V.basis()] + [Dp(v).element() for v in V.basis()] VV = A.free_module().submodule(vecs) V = A.submodule(VV, check=False) D = V.decomposition()[0] #if len(D.star_eigenvalues()) == 2: # D = D.sign_submodule(1) D1 = D.modular_symbols_of_sign(1) M = ModularForms(D1.group(), D1.weight(), D1.base_ring()) ff = Newform(M, D1, names='a') return ff