def as_permutation(self): r""" Return the element of the permutation group G (isomorphic to the abelian group A) associated to a in A. EXAMPLES:: sage: G = AbelianGroup(3,[2,3,4],names="abc"); G Multiplicative Abelian group isomorphic to C2 x C3 x C4 sage: a,b,c=G.gens() sage: Gp = G.permutation_group(); Gp Permutation Group with generators [(6,7,8,9), (3,4,5), (1,2)] sage: a.as_permutation() (1,2) sage: ap = a.as_permutation(); ap (1,2) sage: ap in Gp True """ from sage.libs.gap.libgap import libgap G = self.parent() A = libgap.AbelianGroup(G.gens_orders()) phi = libgap.IsomorphismPermGroup(A) gens = libgap.GeneratorsOfGroup(A) L2 = libgap.Product([geni**Li for geni, Li in zip(gens, self.list())]) pg = libgap.Image(phi, L2) return G.permutation_group()(pg)
def norm_of_galois_extension(self): r""" Return the norm as a Galois extension of `\QQ`, which is given by the product of all galois_conjugates. EXAMPLES:: sage: E(3).norm_of_galois_extension() 1 sage: E(6).norm_of_galois_extension() 1 sage: (E(2) + E(3)).norm_of_galois_extension() 3 sage: parent(_) Integer Ring """ obj = self._obj k = obj.Conductor().sage() return libgap.Product(libgap([obj.GaloisCyc(i) for i in range(k) if k.gcd(i) == 1])).sage()