@@ -519,11 +519,20 @@ def duality_pairing(self, x, y):
519
519
0
520
520
sage: S.duality_pairing(S[1,1,1,1], F[4])
521
521
1
522
+
523
+ TESTS:
524
+
525
+ The result has the right parent even if the sum is empty::
526
+
527
+ sage: x = S.duality_pairing(S.zero(), F.zero()); x
528
+ 0
529
+ sage: parent(x)
530
+ Rational Field
522
531
"""
523
532
if hasattr (self , 'dual' ):
524
533
x = self (x )
525
534
y = self .dual ()(y )
526
- return sum (coeff * y [I ] for (I , coeff ) in x )
535
+ return self . base_ring (). sum (coeff * y [I ] for (I , coeff ) in x )
527
536
else :
528
537
return self .duality_pairing_by_coercion (x , y )
529
538
@@ -541,8 +550,8 @@ def duality_pairing_by_coercion(self, x, y):
541
550
542
551
OUTPUT:
543
552
544
- - The result of pairing the function ``x`` from ``self`` with the function
545
- ``y`` from the dual basis of ``self``
553
+ - The result of pairing the function ``x`` from ``self`` with
554
+ the function ``y`` from the dual basis of ``self``
546
555
547
556
EXAMPLES::
548
557
@@ -556,11 +565,20 @@ def duality_pairing_by_coercion(self, x, y):
556
565
1
557
566
sage: F.duality_pairing_by_coercion(F[1,2], L[1,1,1])
558
567
1
568
+
569
+ TESTS:
570
+
571
+ The result has the right parent even if the sum is empty::
572
+
573
+ sage: x = F.duality_pairing_by_coercion(F.zero(), L.zero()); x
574
+ 0
575
+ sage: parent(x)
576
+ Rational Field
559
577
"""
560
578
a_realization = self .realization_of ().a_realization ()
561
579
x = a_realization (x )
562
580
y = a_realization .dual ()(y )
563
- return sum (coeff * y [I ] for (I , coeff ) in x )
581
+ return self . base_ring (). sum (coeff * y [I ] for (I , coeff ) in x )
564
582
565
583
def duality_pairing_matrix (self , basis , degree ):
566
584
r"""
@@ -574,8 +592,9 @@ def duality_pairing_matrix(self, basis, degree):
574
592
575
593
OUTPUT:
576
594
577
- - The matrix of scalar products between the basis ``self`` and the basis
578
- ``basis`` in the dual Hopf algebra of degree ``degree``.
595
+ - The matrix of scalar products between the basis ``self``
596
+ and the basis ``basis`` in the dual Hopf algebra in
597
+ degree ``degree``.
579
598
580
599
EXAMPLES:
581
600
@@ -733,10 +752,53 @@ def degree_negation(self, element):
733
752
Generalize this to all graded vector spaces?
734
753
"""
735
754
return self .sum_of_terms ([ (lam , (- 1 )** (sum (lam )% 2 ) * a )
736
- for lam , a in self (element ) ])
755
+ for lam , a in self (element ) ],
756
+ distinct = True )
737
757
738
758
class ElementMethods :
739
759
760
+ def degree_negation (self ):
761
+ r"""
762
+ Return the image of ``self`` under the degree negation
763
+ automorphism of the parent of ``self``.
764
+
765
+ The degree negation is the automorphism which scales every
766
+ homogeneous element of degree `k` by `(-1)^k` (for all `k`).
767
+
768
+ Calling ``degree_negation(self)`` is equivalent to calling
769
+ ``self.parent().degree_negation(self)``.
770
+
771
+ EXAMPLES::
772
+
773
+ sage: NSym = NonCommutativeSymmetricFunctions(ZZ)
774
+ sage: S = NSym.S()
775
+ sage: f = 2*S[2,1] + 4*S[1,1] - 5*S[1,2] - 3*S[[]]
776
+ sage: f.degree_negation()
777
+ -3*S[] + 4*S[1, 1] + 5*S[1, 2] - 2*S[2, 1]
778
+
779
+ sage: QSym = QuasiSymmetricFunctions(QQ)
780
+ sage: dI = QSym.dualImmaculate()
781
+ sage: f = -3*dI[2,1] + 4*dI[2] + 2*dI[1]
782
+ sage: f.degree_negation()
783
+ -2*dI[1] + 4*dI[2] + 3*dI[2, 1]
784
+
785
+ TESTS:
786
+
787
+ The zero element behaves well::
788
+
789
+ sage: a = S.zero().degree_negation(); a
790
+ 0
791
+ sage: parent(a)
792
+ Non-Commutative Symmetric Functions over the Integer Ring in the Complete basis
793
+
794
+ .. TODO::
795
+
796
+ Generalize this to all graded vector spaces?
797
+ """
798
+ return self .parent ().sum_of_terms ([ (lam , (- 1 )** (sum (lam )% 2 ) * a )
799
+ for lam , a in self ],
800
+ distinct = True )
801
+
740
802
def duality_pairing (self , y ):
741
803
r"""
742
804
The duality pairing between elements of `NSym` and elements
@@ -1131,7 +1193,68 @@ def internal_product(self, other):
1131
1193
\rangle \langle g, h^{\prime\prime}_i \rangle,
1132
1194
1133
1195
where we write `\Delta^{\times}(h)` as `\sum_i h^{\prime}_i
1134
- \otimes h^{\prime\prime}_i`.
1196
+ \otimes h^{\prime\prime}_i`. Here, `f * g` denotes the internal
1197
+ product of the non-commutative symmetric functions `f` and `g`.
1198
+
1199
+ If `f` and `g` are two homogeneous elements of `NSym` having
1200
+ distinct degrees, then the internal product `f * g` is zero.
1201
+
1202
+ Explicit formulas can be given for internal products of
1203
+ elements of the complete and the Psi bases. First, the formula
1204
+ for the complete basis ([NCSF1]_ Proposition 5.1): If `I` and
1205
+ `J` are two compositions of lengths `p` and `q`, respectively,
1206
+ then the corresponding complete homogeneous non-commutative
1207
+ symmetric functions `S^I` and `S^J` have internal product
1208
+
1209
+ .. MATH::
1210
+
1211
+ S^I * S^J = \sum S^{\operatorname*{comp}M},
1212
+
1213
+ where the sum ranges over all `p \times q`-matrices
1214
+ `M \in \NN^{p \times q}` (with nonnegative integers as
1215
+ entries) whose row sum vector is `I` (that is, the sum of the
1216
+ entries of the `r`-th row is the `r`-th part of `I` for all
1217
+ `r`) and whose column sum vector is `J` (that is, the sum of
1218
+ all entries of the `s`-th row is the `s`-th part of `J` for
1219
+ all `s`). Here, for any `M \in \NN^{p \times q}`, we denote
1220
+ by `\operatorname*{comp}M` the composition obtained by
1221
+ reading the entries of the matrix `M` in the usual order
1222
+ (row by row, proceeding left to right in each row,
1223
+ traversing the rows from top to bottom).
1224
+
1225
+ The formula on the Psi basis ([NCSF2]_ Lemma 3.10) is more
1226
+ complicated. Let `I` and `J` be two compositions of lengths
1227
+ `p` and `q`, respectively, having the same size `|I| = |J|`.
1228
+ We denote by `\Psi^K` the element of the Psi-basis
1229
+ corresponding to any composition `K`.
1230
+
1231
+ - If `p > q`, then `\Psi^I * \Psi^J` is plainly `0`.
1232
+
1233
+ - Assume that `p = q`. Let `\widetilde{\delta}_{I, J}` denote
1234
+ the integer `1` if the compositions `I` and `J` are
1235
+ permutations of each other, and the integer `0` otherwise.
1236
+ For every positive integer `i`, let `m_i` denote the number
1237
+ of parts of `I` equal to `i`. Then, `\Psi^I * \Psi^J` equals
1238
+ `\widetilde{\delta}_{I, J} \prod_{i>0} i^{m_i} m_i! \Psi^I`.
1239
+
1240
+ - Now assume that `p < q`. Write the composition `I` as
1241
+ `I = (i_1, i_2, \ldots, i_p)`. For every nonempty
1242
+ composition `K = (k_1, k_2, \ldots, k_s)`, denote by
1243
+ `\Gamma_K` the non-commutative symmetric function
1244
+ `k_1 [\ldots [[\Psi_{k_1}, \Psi_{k_2}], \Psi_{k_3}],
1245
+ \ldots \Psi_{k_s}]`. For any subset `S` of
1246
+ `\{ 1, 2, \ldots, q \}`, let `J_S` be the composition
1247
+ obtained from `J` by removing the `r`-th parts for all
1248
+ `r \notin S` (while keeping the `r`-th parts for all
1249
+ `r \in S` in order). Then, `\Psi^I * \Psi^J` equals the
1250
+ sum of `\Gamma_{J_{K_1}} \Gamma_{J_{K_2}} \cdots
1251
+ \Gamma_{J_{K_p}}` over all ordered set partitions
1252
+ `(K_1, K_2, \ldots, K_p)` of `\{ 1, 2, \ldots, q \}`
1253
+ into `p` parts such that each `1 \leq k \leq p` satisfies
1254
+ `|J_{K_k}| = i_k`.
1255
+ (See
1256
+ :meth:`~sage.combinat.set_partition_ordered.OrderedSetPartition`
1257
+ for the meaning of "ordered set partition".)
1135
1258
1136
1259
Aliases for :meth:`internal_product()` are :meth:`itensor()` and
1137
1260
:meth:`kronecker_product()`.
0 commit comments