@@ -603,6 +603,62 @@ def to_symmetric_function(self):
603
603
m = self .parent ().realization_of ().monomial ()
604
604
return m (self ).to_symmetric_function ()
605
605
606
+ def to_wqsym (self ):
607
+ r"""
608
+ Return the image of ``self`` under the canonical
609
+ inclusion map `NCSym \to WQSym`.
610
+
611
+ The canonical inclusion map `NCSym \to WQSym` is
612
+ an injective homomorphism of algebras. It sends a
613
+ basis element `\mathbf{m}_A` of `NCSym` to the sum of
614
+ basis elements `\mathbf{M}_P` of `WQSym`, where `P`
615
+ ranges over all ordered set partitions that become
616
+ `A` when the ordering is forgotten.
617
+ This map is denoted by `\theta` in [BZ05]_ (17).
618
+
619
+ .. SEEALSO::
620
+
621
+ :class:`WordQuasisymmetricFunctions` for a
622
+ definition of `WQSym`.
623
+
624
+ EXAMPLES::
625
+
626
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
627
+ sage: e = NCSym.e()
628
+ sage: h = NCSym.h()
629
+ sage: p = NCSym.p()
630
+ sage: cp = NCSym.cp()
631
+ sage: x = NCSym.x()
632
+ sage: m = NCSym.m()
633
+ sage: m[[1,3],[2]].to_wqsym()
634
+ M[{2}, {1, 3}] + M[{1, 3}, {2}]
635
+ sage: x[[1,3],[2]].to_wqsym()
636
+ -M[{1}, {3}, {2}] - M[{2}, {1}, {3}] - M[{1, 2}, {3}]
637
+ - M[{2, 3}, {1}] - M[{1}, {2}, {3}] - M[{3}, {2}, {1}]
638
+ - M[{3}, {1}, {2}] - M[{3}, {1, 2}] - M[{2}, {3}, {1}]
639
+ - M[{1}, {2, 3}]
640
+ sage: (4*p[[1,3],[2]]-p[[1]]).to_wqsym()
641
+ 4*M[{1, 2, 3}] + 4*M[{2}, {1, 3}] + 4*M[{1, 3}, {2}] - M[{1}]
642
+ """
643
+ parent = self .parent ()
644
+ NCSym = parent .realization_of ()
645
+ R = parent .base_ring ()
646
+ one = R .one ()
647
+ m = NCSym .monomial ()
648
+ from sage .combinat .chas .wqsym import WordQuasisymmetricFunctions
649
+ from sage .combinat .set_partition_ordered import OrderedSetPartition
650
+ M = WordQuasisymmetricFunctions (R ).M ()
651
+ from itertools import permutations
652
+ def to_wqsym_on_m_basis (A ):
653
+ # Return the image of `\mathbf{m}_A` under the inclusion
654
+ # map `NCSym \to WQSym`.
655
+ l = len (A )
656
+ return M .sum_of_terms ([(OrderedSetPartition ([A [u [i ]] for i in range (l )]), 1 )
657
+ for u in permutations (range (l ))],
658
+ distinct = True )
659
+ return M .sum (coeff * to_wqsym_on_m_basis (A )
660
+ for A , coeff in m (self ))
661
+
606
662
def internal_coproduct (self ):
607
663
"""
608
664
Return the internal coproduct of ``self``.
0 commit comments