def to_B_basis(self, S): r""" Return `D_S` as a linear combination of `B_p`-basis elements. EXAMPLES:: sage: DA = DescentAlgebra(QQ, 4) sage: D = DA.D() sage: B = DA.B() sage: map(B, D.basis()) # indirect doctest [B[4], B[1, 3] - B[4], B[2, 2] - B[4], B[3, 1] - B[4], B[1, 1, 2] - B[1, 3] - B[2, 2] + B[4], B[1, 2, 1] - B[1, 3] - B[3, 1] + B[4], B[2, 1, 1] - B[2, 2] - B[3, 1] + B[4], B[1, 1, 1, 1] - B[1, 1, 2] - B[1, 2, 1] + B[1, 3] - B[2, 1, 1] + B[2, 2] + B[3, 1] - B[4]] """ B = self.realization_of().B() if not S: return B.one() n = self.realization_of()._n C = Compositions(n) return B.sum_of_terms([(C.from_subset(T, n), (-1)**(len(S) - len(T))) for T in SubsetsSorted(S)])
def __init__(self, alg, prefix="D"): r""" Initialize ``self``. EXAMPLES:: sage: TestSuite(DescentAlgebra(QQ, 4).D()).run() """ self._prefix = prefix self._basis_name = "standard" CombinatorialFreeModule.__init__(self, alg.base_ring(), SubsetsSorted(range(1, alg._n)), category=DescentAlgebraBases(alg), bracket="", prefix=prefix) # Change of basis: B = alg.B() self.module_morphism( self.to_B_basis, codomain=B, category=self.category()).register_as_coercion() B.module_morphism(B.to_D_basis, codomain=self, category=self.category()).register_as_coercion()