def AbelianVariety(X): """ Create the abelian variety corresponding to the given defining data. INPUT: - ``X`` - an integer, string, newform, modsym space, congruence subgroup or tuple of congruence subgroups OUTPUT: a modular abelian variety EXAMPLES:: sage: AbelianVariety(Gamma0(37)) Abelian variety J0(37) of dimension 2 sage: AbelianVariety('37a') Newform abelian subvariety 37a of dimension 1 of J0(37) sage: AbelianVariety(Newform('37a')) Newform abelian subvariety 37a of dimension 1 of J0(37) sage: AbelianVariety(ModularSymbols(37).cuspidal_submodule()) Abelian variety J0(37) of dimension 2 sage: AbelianVariety((Gamma0(37), Gamma0(11))) Abelian variety J0(37) x J0(11) of dimension 3 sage: AbelianVariety(37) Abelian variety J0(37) of dimension 2 sage: AbelianVariety([1,2,3]) Traceback (most recent call last): ... TypeError: X must be an integer, string, newform, modsym space, congruence subgroup or tuple of congruence subgroups """ if isinstance(X, (int, long, Integer)): X = Gamma0(X) if is_CongruenceSubgroup(X): X = X.modular_symbols().cuspidal_submodule() elif isinstance(X, str): from sage.modular.modform.constructor import Newform f = Newform(X, names='a') return ModularAbelianVariety_newform(f, internal_name=True) elif isinstance(X, sage.modular.modform.element.Newform): return ModularAbelianVariety_newform(X) if is_ModularSymbolsSpace(X): return abvar.ModularAbelianVariety_modsym(X) if isinstance(X, (tuple, list)) and all([is_CongruenceSubgroup(G) for G in X]): return abvar.ModularAbelianVariety(X) raise TypeError( "X must be an integer, string, newform, modsym space, congruence subgroup or tuple of congruence subgroups" )
def AbelianVariety(X): """ Create the abelian variety corresponding to the given defining data. INPUT: - ``X`` - an integer, string, newform, modsym space, congruence subgroup or tuple of congruence subgroups OUTPUT: a modular abelian variety EXAMPLES:: sage: AbelianVariety(Gamma0(37)) Abelian variety J0(37) of dimension 2 sage: AbelianVariety('37a') Newform abelian subvariety 37a of dimension 1 of J0(37) sage: AbelianVariety(Newform('37a')) Newform abelian subvariety 37a of dimension 1 of J0(37) sage: AbelianVariety(ModularSymbols(37).cuspidal_submodule()) Abelian variety J0(37) of dimension 2 sage: AbelianVariety((Gamma0(37), Gamma0(11))) Abelian variety J0(37) x J0(11) of dimension 3 sage: AbelianVariety(37) Abelian variety J0(37) of dimension 2 sage: AbelianVariety([1,2,3]) Traceback (most recent call last): ... TypeError: X must be an integer, string, newform, modsym space, congruence subgroup or tuple of congruence subgroups """ if isinstance(X, (int, long, Integer)): X = Gamma0(X) if is_CongruenceSubgroup(X): X = X.modular_symbols().cuspidal_submodule() elif isinstance(X, str): from sage.modular.modform.constructor import Newform f = Newform(X, names='a') return ModularAbelianVariety_newform(f, internal_name=True) elif isinstance(X, sage.modular.modform.element.Newform): return ModularAbelianVariety_newform(X) if is_ModularSymbolsSpace(X): return abvar.ModularAbelianVariety_modsym(X) if isinstance(X, (tuple,list)) and all([is_CongruenceSubgroup(G) for G in X]): return abvar.ModularAbelianVariety(X) raise TypeError("X must be an integer, string, newform, modsym space, congruence subgroup or tuple of congruence subgroups")