def _mul_(self, other): r""" Return the product of self and other. EXAMPLES:: sage: eta1, eta2 = EtaGroup(4).basis() # indirect doctest sage: eta1 * eta2 Eta product of level 4 : (eta_1)^8 (eta_4)^-8 """ newdict = {} for d in union(self._keys, other._keys): newdict[d] = self.r(d) + other.r(d) return EtaProduct(self.level(), newdict)
def _div_(self, other): r""" Return `self * other^{-1}`. EXAMPLES:: sage: eta1, eta2 = EtaGroup(4).basis() sage: eta1 / eta2 # indirect doctest Eta product of level 4 : (eta_1)^-24 (eta_2)^48 (eta_4)^-24 sage: (eta1 / eta2) * eta2 == eta1 True """ newdict = {} for d in union(self._keys, other._keys): newdict[d] = self.r(d) - other.r(d) return EtaProduct(self.level(), newdict)
def _mul_(self, other): r""" Return the product of ``self`` and ``other``. EXAMPLES:: sage: eta1, eta2 = EtaGroup(4).basis() # indirect doctest sage: eta1 * eta2 Eta product of level 4 : (eta_1)^8 (eta_4)^-8 """ newdict = { d: self._rdict.get(d, 0) + other._rdict.get(d, 0) for d in union(self._rdict, other._rdict) } P = self.parent() return P.element_class(P, newdict)
def _div_(self, other): r""" Return `self * other^{-1}`. EXAMPLES:: sage: eta1, eta2 = EtaGroup(4).basis() sage: eta1 / eta2 # indirect doctest Eta product of level 4 : (eta_1)^-24 (eta_2)^48 (eta_4)^-24 sage: (eta1 / eta2) * eta2 == eta1 True """ newdict = { d: self._rdict.get(d, 0) - other._rdict.get(d, 0) for d in union(self._rdict, other._rdict) } P = self.parent() return P.element_class(P, newdict)