def __call__(self, g): """ Evaluate ``self`` on a group element ``g``. OUTPUT: An element in :meth:`~sage.groups.abelian_gps.dual_abelian_group.DualAbelianGroup_class.base_ring`. EXAMPLES:: sage: F = AbelianGroup(5, [2,3,5,7,8], names="abcde") sage: a,b,c,d,e = F.gens() sage: Fd = F.dual_group(names="ABCDE") sage: A,B,C,D,E = Fd.gens() sage: A*B^2*D^7 A*B^2 sage: A(a) -1 sage: B(b) zeta840^140 - 1 sage: CC(B(b)) # abs tol 1e-8 -0.499999999999995 + 0.866025403784447*I sage: A(a*b) -1 """ F = self.parent().base_ring() expsX = self.exponents() expsg = g.exponents() order = self.parent().gens_orders() N = LCM(order) if is_ComplexField(F): from sage.symbolic.constants import pi I = F.gen() PI = F(pi) ans = prod([ exp(2 * PI * I * expsX[i] * expsg[i] / order[i]) for i in range(len(expsX)) ]) return ans ans = F(1) ## assumes F is the cyclotomic field zeta = F.gen() for i in range(len(expsX)): order_noti = N / order[i] ans = ans * zeta**(expsX[i] * expsg[i] * order_noti) return ans
def __call__(self, g): """ Evaluate ``self`` on a group element ``g``. OUTPUT: An element in :meth:`~sage.groups.abelian_gps.dual_abelian_group.DualAbelianGroup_class.base_ring`. EXAMPLES:: sage: F = AbelianGroup(5, [2,3,5,7,8], names="abcde") sage: a,b,c,d,e = F.gens() sage: Fd = F.dual_group(names="ABCDE") sage: A,B,C,D,E = Fd.gens() sage: A*B^2*D^7 A*B^2 sage: A(a) -1 sage: B(b) zeta840^140 - 1 sage: CC(B(b)) # abs tol 1e-8 -0.499999999999995 + 0.866025403784447*I sage: A(a*b) -1 """ F = self.parent().base_ring() expsX = self.exponents() expsg = g.exponents() order = self.parent().gens_orders() N = LCM(order) if is_ComplexField(F): from sage.symbolic.constants import pi I = F.gen() PI = F(pi) ans = prod([exp(2*PI*I*expsX[i]*expsg[i]/order[i]) for i in range(len(expsX))]) return ans ans = F(1) ## assumes F is the cyclotomic field zeta = F.gen() for i in range(len(expsX)): order_noti = N/order[i] ans = ans*zeta**(expsX[i]*expsg[i]*order_noti) return ans
def __call__(self, g): """ Computes the value of a character self on a group element g (g must be an element of self.group()) EXAMPLES: sage: F = AbelianGroup(5, [2,3,5,7,8], names="abcde") sage: a,b,c,d,e = F.gens() sage: Fd = DualAbelianGroup(F, names="ABCDE") sage: A,B,C,D,E = Fd.gens() sage: A*B^2*D^7 A*B^2 sage: A(a) ## random last few digits -1.0000000000000000 + 0.00000000000000013834419720915037*I sage: B(b) ## random last few digits -0.49999999999999983 + 0.86602540378443871*I sage: A(a*b) ## random last few digits -1.0000000000000000 + 0.00000000000000013834419720915037*I """ F = self.parent().base_ring() expsX = list(self.list()) expsg = list(g.list()) invs = self.parent().invariants() N = LCM(invs) if is_ComplexField(F): from sage.symbolic.constants import pi I = F.gen() PI = F(pi) ans = prod([ exp(2 * PI * I * expsX[i] * expsg[i] / invs[i]) for i in range(len(expsX)) ]) return ans ans = F(1) ## assumes F is the cyclotomic field zeta = F.gen() #print F,zeta for i in range(len(expsX)): inv_noti = N / invs[i] ans = ans * zeta**(expsX[i] * expsg[i] * inv_noti) return ans
def __call__(self,g): """ Computes the value of a character self on a group element g (g must be an element of self.group()) EXAMPLES: sage: F = AbelianGroup(5, [2,3,5,7,8], names="abcde") sage: a,b,c,d,e = F.gens() sage: Fd = DualAbelianGroup(F, names="ABCDE") sage: A,B,C,D,E = Fd.gens() sage: A*B^2*D^7 A*B^2 sage: A(a) ## random last few digits -1.0000000000000000 + 0.00000000000000013834419720915037*I sage: B(b) ## random last few digits -0.49999999999999983 + 0.86602540378443871*I sage: A(a*b) ## random last few digits -1.0000000000000000 + 0.00000000000000013834419720915037*I """ F = self.parent().base_ring() expsX = list(self.list()) expsg = list(g.list()) invs = self.parent().invariants() N = LCM(invs) if is_ComplexField(F): from sage.symbolic.constants import pi I = F.gen() PI = F(pi) ans = prod([exp(2*PI*I*expsX[i]*expsg[i]/invs[i]) for i in range(len(expsX))]) return ans ans = F(1) ## assumes F is the cyclotomic field zeta = F.gen() #print F,zeta for i in range(len(expsX)): inv_noti = N/invs[i] ans = ans*zeta**(expsX[i]*expsg[i]*inv_noti) return ans