Path: blob/master/src/sage/modular/abvar/abvar_newform.py
8820 views
"""1Abelian varieties attached to newforms23TESTS::45sage: A = AbelianVariety('23a')6sage: loads(dumps(A)) == A7True8"""91011###########################################################################12# Copyright (C) 2008 William Stein <[email protected]> #13# Distributed under the terms of the GNU General Public License (GPL) #14# http://www.gnu.org/licenses/ #15###########################################################################1617from sage.databases.cremona import cremona_letter_code1819from sage.rings.all import QQ, ZZ2021from sage.modular.modform.element import Newform22from sage.modular.arithgroup.all import is_Gamma0, is_Gamma1, is_GammaH232425from abvar import ModularAbelianVariety_modsym_abstract26import homspace2728class ModularAbelianVariety_newform(ModularAbelianVariety_modsym_abstract):29"""30A modular abelian variety attached to a specific newform.31"""32def __init__(self, f, internal_name=False):33"""34Create the modular abelian variety `A_f` attached to the35newform `f`.3637INPUT:38f -- a newform3940EXAMPLES::4142sage: f = CuspForms(37).newforms('a')[0]43sage: f.abelian_variety()44Newform abelian subvariety 37a of dimension 1 of J0(37)45"""46if not isinstance(f, Newform):47raise TypeError, "f must be a newform"48self.__f = f49self._is_hecke_stable = True50K = f.qexp().base_ring()51if K == QQ:52variable_name = None53else:54variable_name = K.variable_name()55self.__named_newforms = { variable_name: self.__f }56if not internal_name:57self.__named_newforms[None] = self.__f58ModularAbelianVariety_modsym_abstract.__init__(self, (f.group(),), QQ,59is_simple=True, newform_level = (f.level(), f.group()),60isogeny_number=f.number(), number=0)6162def _modular_symbols(self,sign=0):63"""64EXAMPLES::6566sage: f = CuspForms(52).newforms('a')[0]67sage: A = f.abelian_variety()68sage: A._modular_symbols()69Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 15 for Gamma_0(52) of weight 2 with sign 0 over Rational Field70sage: A._modular_symbols(1)71Modular Symbols subspace of dimension 1 of Modular Symbols space of dimension 10 for Gamma_0(52) of weight 2 with sign 1 over Rational Field72sage: A._modular_symbols(-1)73Modular Symbols subspace of dimension 1 of Modular Symbols space of dimension 5 for Gamma_0(52) of weight 2 with sign -1 over Rational Field74"""75return self.__f.modular_symbols(sign=sign)7677def newform(self, names=None):78r"""79Return the newform that this modular abelian variety is attached to.8081EXAMPLES::8283sage: f = Newform('37a')84sage: A = f.abelian_variety()85sage: A.newform()86q - 2*q^2 - 3*q^3 + 2*q^4 - 2*q^5 + O(q^6)87sage: A.newform() is f88True8990If the a variable name has not been specified, we must specify one::9192sage: A = AbelianVariety('67b')93sage: A.newform()94Traceback (most recent call last):95...96TypeError: You must specify the name of the generator.97sage: A.newform('alpha')98q + alpha*q^2 + (-alpha - 3)*q^3 + (-3*alpha - 3)*q^4 - 3*q^5 + O(q^6)99100If the eigenform is actually over `\QQ` then we don't have to specify101the name::102103sage: A = AbelianVariety('67a')104sage: A.newform()105q + 2*q^2 - 2*q^3 + 2*q^4 + 2*q^5 + O(q^6)106"""107try:108return self.__named_newforms[names]109except KeyError:110self.__named_newforms[names] = Newform(self.__f.parent().change_ring(QQ), self.__f.modular_symbols(1), names=names, check=False)111return self.__named_newforms[names]112113def label(self):114"""115Return canonical label that defines this newform modular116abelian variety.117118OUTPUT:119string120121EXAMPLES::122123sage: A = AbelianVariety('43b')124sage: A.label()125'43b'126"""127G = self.__f.group()128if is_Gamma0(G):129group = ''130elif is_Gamma1(G):131group = 'G1'132elif is_GammaH(G):133group = 'GH[' + ','.join([str(z) for z in G._generators_for_H()]) + ']'134return '%s%s%s'%(self.level(), cremona_letter_code(self.factor_number()), group)135136def factor_number(self):137"""138Return factor number.139140OUTPUT:141int142143EXAMPLES::144145sage: A = AbelianVariety('43b')146sage: A.factor_number()1471148"""149try:150return self.__factor_number151except AttributeError:152self.__factor_number = self.__f.number()153return self.__factor_number154155def _repr_(self):156"""157String representation of this modular abelian variety.158159EXAMPLES::160161sage: AbelianVariety('37a')._repr_()162'Newform abelian subvariety 37a of dimension 1 of J0(37)'163"""164return "Newform abelian subvariety %s of dimension %s of %s" % (165self.newform_label(), self.dimension(), self._ambient_repr())166167def endomorphism_ring(self):168"""169Return the endomorphism ring of this newform abelian variety.170171EXAMPLES::172173sage: A = AbelianVariety('23a')174sage: E = A.endomorphism_ring(); E175Endomorphism ring of Newform abelian subvariety 23a of dimension 2 of J0(23)176177We display the matrices of these two basis matrices::178179sage: E.0.matrix()180[1 0 0 0]181[0 1 0 0]182[0 0 1 0]183[0 0 0 1]184sage: E.1.matrix()185[ 0 1 -1 0]186[ 0 1 -1 1]187[-1 2 -2 1]188[-1 1 0 -1]189190The result is cached::191192sage: E is A.endomorphism_ring()193True194"""195try:196return self.__endomorphism_ring197except AttributeError:198pass199200E = homspace.EndomorphismSubring(self)201self.__endomorphism_ring = E202return self.__endomorphism_ring203204def _calculate_endomorphism_generators(self):205"""206EXAMPLES::207208sage: A = AbelianVariety('43b')209sage: B = A.endomorphism_ring(); B # indirect doctest210Endomorphism ring of Newform abelian subvariety 43b of dimension 2 of J0(43)211sage: [b.matrix() for b in B.gens()]212[213[1 0 0 0] [ 0 1 0 0]214[0 1 0 0] [ 1 -2 0 0]215[0 0 1 0] [ 1 0 -2 -1]216[0 0 0 1], [ 0 1 -1 0]217]218"""219M = self.modular_symbols()220bound = M.sturm_bound()221222d = self.dimension()223T1list = self.hecke_operator(1).matrix().list()224EndVecZ = ZZ**(len(T1list))225V = EndVecZ.submodule([T1list])226n = 2227228while V.dimension() < d:229W = EndVecZ.submodule([((self.hecke_operator(n).matrix())**i).list()230for i in range(1,d+1)])231V = V+W232n += 1233234return V.saturation().basis()235236237238