-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtutorial-symmetric-functions-purgatory.py
1287 lines (975 loc) · 45.6 KB
/
tutorial-symmetric-functions-purgatory.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""
Symmetric functions, with their multiple realizations
"""
# ****************************************************************************
# Copyright (C) 2007 Mike Hansen <[email protected]>
# 2009-2012 Jason Bandlow <[email protected]>
# 2012 Anne Schilling <anne at math.ucdavis.edu>
# 2009-2012 Nicolas M. Thiery <nthiery at users.sf.net>
# 2012 Mike Zabrocki <[email protected]>
#
# Distributed under the terms of the GNU General Public License (GPL)
#
# This code is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# The full text of the GPL is available at:
#
# http://www.gnu.org/licenses/
# ****************************************************************************
from sage.categories.fields import Fields
from sage.categories.graded_hopf_algebras import GradedHopfAlgebras
from sage.categories.rings import Rings
from sage.combinat.free_module import CombinatorialFreeModule
from sage.combinat.partition import Partitions
from sage.rings.rational_field import QQ
from sage.structure.parent import Parent
from sage.structure.unique_representation import UniqueRepresentation
from . import (
elementary,
hall_littlewood,
homogeneous,
jack,
llt,
macdonald,
monomial,
powersum,
schur,
)
class SymmetricFunctions(UniqueRepresentation, Parent):
r"""
The abstract algebra of commutative symmetric functions
.. rubric:: Symmetric Functions in Sage
.. MODULEAUTHOR:: Jason Bandlow, Anne Schilling, Nicolas M. Thiery, Mike Zabrocki
This document is an introduction to working with symmetric function
theory in Sage.
It is not intended to be an introduction to the theory
of symmetric functions ([MAC]_ and [STA]_, Chapter 7, are two excellent
references.) The reader is also expected to be familiar with Sage.
.. rubric:: The algebra of symmetric functions
The algebra of symmetric functions is the unique free commutative graded
connected algebra over the given ring, with one generator in each degree. It
can also be thought of as the inverse limit (in the category of graded
algebras) of the algebra of symmetric polynomials in `n` variables as `n \rightarrow \infty`.
Sage allows us to construct the algebra of symmetric functions over
any ring. We will use a base ring of rational numbers in these first
examples::
sage: Sym = SymmetricFunctions(QQ)
sage: Sym
Symmetric Functions over Rational Field
Notice that ``Sym`` is an *abstract* algebra. This reflects the fact that
there are multiple natural bases. To work with specific
elements, we need a *realization* of this algebra. In practice, this
means we need to specify a basis.
.. rubric:: An example basis - power sums
Here is an example of how one might use the power sum realization::
sage: p = Sym.powersum()
sage: p
Symmetric Functions over Rational Field in the powersum basis
``p`` now represents the realization of the symmetric function algebra on
the power sum basis. The basis itself is accessible through::
sage: p.basis()
Lazy family (Term map from Partitions to Symmetric Functions over Rational Field in the powersum basis(i))_{i in Partitions}
sage: p.basis().keys()
Partitions
This last line means that ``p.basis()`` is an association between the set
of Partitions and the basis elements of the algebra ``p``. To construct a
specific element one can therefore do::
sage: p.basis()[Partition([2,1,1])]
p[2, 1, 1]
As this is rather cumbersome, realizations of the symmetric function
algebra allow for the following abuses of notation::
sage: p[Partition([2, 1, 1])]
p[2, 1, 1]
sage: p[[2, 1, 1]]
p[2, 1, 1]
sage: p[2, 1, 1]
p[2, 1, 1]
or even::
sage: p[(i for i in [2, 1, 1])]
p[2, 1, 1]
In the special case of the empty partition, due to a limitation in
Python syntax, one cannot use::
sage: p[] # todo: not implemented
Please use instead::
sage: p[[]]
p[]
.. note:: When elements are constructed using the ``p[something ]`` syntax ,
an error will be raised if the input cannot be interpreted as a partition.
This is *not* the case when ``p.basis()`` is used::
sage: p['something']
Traceback (most recent call last):
...
ValueError: ['s', 'o', 'm', 'e', 't', 'h', 'i', 'n', 'g'] is not an element of Partitions
sage: p.basis()['something']
p'something'
Elements of ``p`` are linear combinations of such compositions::
sage: p.an_element()
2*p[] + 2*p[1] + 3*p[2]
.. rubric:: Algebra structure
Algebraic combinations of basis elements can be entered in a natural way::
sage: p[2,1,1] + 2 * p[1] * (p[4] + p[2,1])
3*p[2, 1, 1] + 2*p[4, 1]
The ``p`` basis is multiplicative; that is, multiplication is induced by
linearity from the (nonincreasingly sorted) concatenation of partitions::
sage: p[3,1] * p[2,1]
p[3, 2, 1, 1]
sage: (p.one() + 2 * p[3,1]) * p[4, 2]
p[4, 2] + 2*p[4, 3, 2, 1]
.. rubric:: The classical bases
In addition to the power sum basis, the other classical bases of the
symmetric function algebra are the elementary, complete homogeneous,
monomial, and Schur bases. These can be defined as follows::
sage: e = Sym.elementary()
sage: h = Sym.homogeneous()
sage: m = Sym.monomial()
sage: s = Sym.schur()
These can be defined all at once with the single command
::
sage: Sym.inject_shorthands()
doctest:...: RuntimeWarning: redefining global value `h`
doctest:...: RuntimeWarning: redefining global value `s`
doctest:...: RuntimeWarning: redefining global value `e`
doctest:...: RuntimeWarning: redefining global value `m`
doctest:...: RuntimeWarning: redefining global value `p`
We can then do conversions from one basis to another::
sage: s(p[2,1])
-s[1, 1, 1] + s[3]
sage: m(p[3])
m[3]
sage: m(p[3,2])
m[3, 2] + m[5]
For computations which mix bases, Sage will return a result with respect
to a single (not necessarily predictable) basis::
sage: p[2] * s[2] - m[4]
1/2*p[2, 1, 1] + 1/2*p[2, 2] - p[4]
sage: p( m[1] * ( e[3]*s[2] + 1 ))
p[1] + 1/12*p[1, 1, 1, 1, 1, 1] - 1/6*p[2, 1, 1, 1, 1] - 1/4*p[2, 2, 1, 1] + 1/6*p[3, 1, 1, 1] + 1/6*p[3, 2, 1]
The one for different bases such as the power sum and Schur function is the same::
sage: s.one() == p.one()
True
.. rubric:: Basic computations
In this section, we explore some of the many methods that can be applied
to an arbitrary symmetric function::
sage: f = s[2]^2; f
s[2, 2] + s[3, 1] + s[4]
For more methods than discussed here, create a symmetric function as
above, and use ``f.<tab>``.
.. _`Representation theory of the symmetric group`:
__ ../../../../../thematic_tutorials/lie/lie_basics.html#partitions-and-schur-polynomials
.. rubric:: The Hall scalar product
The Hall scalar product on the algebra of symmetric functions makes the
Schur functions into an orthonormal basis::
sage: f.scalar(f)
3
.. rubric:: Skewing
*Skewing* is the adjoint operation to multiplication with respect to
this scalar product::
sage: f.skew_by(s[1])
2*s[2, 1] + 2*s[3]
In general, ``s[la].skew_by(s[mu])`` is the symmetric function typically
denoted `s_{\lambda \setminus \mu}` or `s_{\lambda / \mu}`.
.. rubric:: Expanding into variables
We can expand a symmetric function into a symmetric polynomial in a
specified number of variables::
sage: f.expand(2)
x0^4 + 2*x0^3*x1 + 3*x0^2*x1^2 + 2*x0*x1^3 + x1^4
See the documentation for ``expand`` for more examples.
.. rubric:: Plethysm
The *plethysm* of symmetric functions is the operation corresponding to
composition of representations of the general linear group. See [STA]_
Chapter 7, Appendix 2 for details.
::
sage: s[2].plethysm(s[2])
s[2, 2] + s[4]
Plethysm can also be written as a composition of functions::
sage: s[2]( s[2] )
s[2, 2] + s[4]
If the coefficient ring contains degree 1 elements, these are handled
properly by plethysm::
sage: R.<t> = QQ[]; s = SymmetricFunctions(R).schur()
sage: s[2]( (1-t)*s[1] )
(t^2-t)*s[1, 1] + (-t+1)*s[2]
See the documentation for ``plethysm`` for more information.
.. rubric:: Hopf algebra structure
The ring of symmetric functions is further endowed with a coalgebra
structure. The coproduct is an algebra morphism, and therefore
determined by its values on the generators; the power sum generators
are primitive::
sage: p[1].coproduct()
p[] # p[1] + p[1] # p[]
sage: p[2].coproduct()
p[] # p[2] + p[2] # p[]
.. rubric:: Transformations of symmetric functions
There are many methods in Sage which make it easy to manipulate symmetric
functions. For example, if we have some function which acts on partitions
(say, conjugation), it is a simple matter to apply it to the support of a
symmetric function. Here is an example::
sage: conj = lambda mu: mu.conjugate()
sage: f = h[4] + 2*h[3,1]
sage: f.map_support(conj)
h[1, 1, 1, 1] + 2*h[2, 1, 1]
We can also easily modify the coefficients::
sage: def foo(mu, coeff): return mu.conjugate(), -coeff
sage: f.map_item(foo)
-h[1, 1, 1, 1] - 2*h[2, 1, 1]
See also ``map_coefficients``.
There are also methods for building functions directly::
sage: s.sum_of_monomials(mu for mu in Partitions(3))
s[1, 1, 1] + s[2, 1] + s[3]
sage: s.sum_of_monomials(Partitions(3))
s[1, 1, 1] + s[2, 1] + s[3]
sage: s.sum_of_terms( (mu, mu[0]) for mu in Partitions(3))
s[1, 1, 1] + 2*s[2, 1] + 3*s[3]
These are the preferred way to build elements within a program;
the result will usually be faster than using :func:`sum`. It also
guarantees that empty sums yields the zero of ``s`` (see also
``s.sum``).
.. rubric:: Different base rings
Depending on the base ring, the different realizations of the symmetric
function algebra may not span the same space::
sage: SZ = SymmetricFunctions(ZZ)
sage: p = SZ.power(); s = SZ.schur()
sage: p(s[1,1,1])
Traceback (most recent call last):
...
TypeError: no conversion of this rational to integer
Because of this, some functions may not behave as expected when working over
the integers, even though they make mathematical sense::
sage: s[1,1,1].plethysm(s[1,1,1])
Traceback (most recent call last):
...
TypeError: no conversion of this rational to integer
It is possible to work over different base rings simultaneously::
sage: s = SymmetricFunctions(QQ).schur()
sage: p = SymmetricFunctions(QQ).power()
sage: sz = SymmetricFunctions(ZZ).schur(); sz._prefix = 'sz'
sage: pz = SymmetricFunctions(ZZ).power(); pz._prefix = 'pz'
sage: p(sz[1,1,1])
1/6*p[1, 1, 1] - 1/2*p[2, 1] + 1/3*p[3]
sage: sz( 1/6*p[1, 1, 1] - 1/2*p[2, 1] + 1/3*p[3] )
sz[1, 1, 1]
As shown in this example, if you are working over multiple base rings
simultaneously, it is a good idea to change the prefix in some cases, so that
you can tell from the output which realization your result is in.
Let us change the notation back for the remainder of this tutorial::
sage: sz._prefix = 's'
sage: pz._prefix = 'p'
One can also use the Sage standard renaming idiom to get shorter outputs::
sage: Sym = SymmetricFunctions(QQ)
sage: Sym.rename("Sym")
sage: Sym
Sym
sage: Sym.rename()
And we name it back::
sage: Sym.rename("Symmetric Functions over Rational Field"); Sym
Symmetric Functions over Rational Field
.. rubric:: Other bases
There are two additional basis of the symmetric functions which are not
considered as classical bases:
* forgotten basis
* Witt basis
The forgotten basis is the dual basis of the elementary symmetric
functions basis with respect to the Hall scalar product. The Witt basis
can be constructed by
.. MATH::
\prod_{d=1}^{\infty} (1 - w_d t^d)^{-1} = \sum_{n=0}^{\infty} h_n t^n
where `t` is a formal variable.
There are further bases of the ring of symmetric functions, in general over
fields with parameters such as `q` and `t`:
* Hall-Littlewood bases
* Jack bases
* Macdonald bases
* `k`-Schur functions
We briefly demonstrate how to access these bases. For more information, see
the documentation of the individual bases.
The *Jack polynomials* can be obtained as::
sage: Sym = SymmetricFunctions(FractionField(QQ['t']))
sage: Jack = Sym.jack()
sage: P = Jack.P(); J = Jack.J(); Q = Jack.Q()
sage: J(P[2,1])
(1/(t+2))*JackJ[2, 1]
The parameter `t` can be specialized as follows::
sage: Sym = SymmetricFunctions(QQ)
sage: Jack = Sym.jack(t = 1)
sage: P = Jack.P(); J = Jack.J(); Q = Jack.Q()
sage: J(P[2,1])
1/3*JackJ[2, 1]
Similarly one can access the Hall-Littlewood and Macdonald polynomials, etc::
sage: Sym = SymmetricFunctions(FractionField(QQ['q','t']))
sage: Mcd = Sym.macdonald()
sage: P = Mcd.P(); J = Mcd.J(); Q = Mcd.Q()
sage: J(P[2,1])
(1/(-q*t^4+2*q*t^3-q*t^2+t^2-2*t+1))*McdJ[2, 1]
.. rubric:: Acknowledgements
The design is heavily inspired from the implementation of
symmetric functions in MuPAD-Combinat (see [HT04]_ and [FD06]_).
REFERENCES:
.. [FD06] Francois Descouens, Making research on symmetric functions using MuPAD-Combinat.
In Andres Iglesias and Nobuki Takayama, editors, 2nd International Congress on Mathematical Software (ICMS'06),
volume 4151 of LNCS, pages 407-418, Castro Urdiales, Spain, September 2006. Springer-Verlag.
:arXiv:`0806.1873`
.. [HT04] Florent Hivert and Nicolas M. Thiery,
MuPAD-Combinat, an open-source package for research in algebraic combinatorics.
Sem. Lothar. Combin., 51 :Art. B51z, 70 pp. (electronic), 2004.
http://mupad-combinat.sf.net/.
.. [MAC] Ian Macdonald, Symmetric Functions and Orthogonal Polynomials,
Second edition. With contributions by A. Zelevinsky. Oxford Mathematical Monographs.
Oxford Science Publications. The Clarendon Press, Oxford University Press, New York, 1995. x+475 pp.
ISBN: 0-19-853489-2
.. [STA] Richard Stanley, Enumerative combinatorics. Vol. 2.
With a foreword by Gian-Carlo Rota and appendix 1 by Sergey Fomin.
Cambridge Studies in Advanced Mathematics, 62. Cambridge University Press, Cambridge, 1999. xii+581 pp.
ISBN: 0-521-56069-1; 0-521-78987-7
.. [ST94] Scharf, Thomas, Thibon, Jean-Yves,
A Hopf-algebra approach to inner plethysm.
Adv. Math. 104 (1994), no. 1, 30-58.
:doi:`10.1006/aima.1994.1019`
.. rubric:: Further tests
TESTS::
sage: Sym = SymmetricFunctions(QQ)
sage: Sym
Symmetric Functions over Rational Field
sage: h = Sym.h(); e = Sym.e(); s = Sym.s(); m = Sym.m(); p = Sym.p()
sage: ( ( h[2,1] * ( 1 + 3 * h[2,1]) ) + s[2]. antipode()) . coproduct()
h[] # h[1, 1] - h[] # h[2] + h[] # h[2, 1] + 3*h[] # h[2, 2, 1, 1] + h[1] # h[1] + h[1] # h[1, 1]
+ h[1] # h[2] + 6*h[1] # h[2, 1, 1, 1] + 6*h[1] # h[2, 2, 1] + h[1, 1] # h[] + h[1, 1] # h[1]
+ 3*h[1, 1] # h[1, 1, 1, 1] + 12*h[1, 1] # h[2, 1, 1] + 3*h[1, 1] # h[2, 2] + 6*h[1, 1, 1] # h[1, 1, 1]
+ 6*h[1, 1, 1] # h[2, 1] + 3*h[1, 1, 1, 1] # h[1, 1] - h[2] # h[] + h[2] # h[1] + 6*h[2] # h[2, 1, 1]
+ h[2, 1] # h[] + 6*h[2, 1] # h[1, 1, 1] + 12*h[2, 1] # h[2, 1] + 12*h[2, 1, 1] # h[1, 1]
+ 6*h[2, 1, 1] # h[2] + 6*h[2, 1, 1, 1] # h[1] + 3*h[2, 2] # h[1, 1] + 6*h[2, 2, 1] # h[1] + 3*h[2, 2, 1, 1] # h[]
.. TODO::
- Introduce fields with degree 1 elements as in
MuPAD-Combinat, to get proper plethysm.
- Use UniqueRepresentation to get rid of all the manual cache
handling for the bases
- Devise a mechanism so that pickling bases of symmetric
functions pickles the coercions which have a cache.
"""
def __init__(self, R):
r"""
Initialization of ``self``.
INPUT:
- ``R`` -- a ring
EXAMPLES::
sage: Sym = SymmetricFunctions(QQ)
TESTS::
sage: Sym1 = SymmetricFunctions(FiniteField(23))
sage: Sym2 = SymmetricFunctions(Integers(23))
sage: TestSuite(Sym).run()
"""
# change the line below to assert(R in Rings()) once MRO issues from #15536, #15475 are resolved
assert(R in Fields() or R in Rings()) # side effect of this statement assures MRO exists for R
self._base = R # Won't be needed when CategoryObject won't override anymore base_ring
Parent.__init__(self, category=GradedHopfAlgebras(R).WithRealizations())
def a_realization(self):
r"""
Return a particular realization of ``self`` (the Schur basis).
EXAMPLES::
sage: Sym = SymmetricFunctions(QQ)
sage: Sym.a_realization()
Symmetric Functions over Rational Field in the Schur basis
"""
return self.schur()
def _repr_(self): # could be taken care of by the category
r"""
Representation of ``self``
TESTS::
sage: SymmetricFunctions(RR) # indirect doctest
Symmetric Functions over Real Field with 53 bits of precision
"""
return "Symmetric Functions over %s" % self.base_ring()
def schur(self):
r"""
The Schur basis of the Symmetric Functions
EXAMPLES::
sage: SymmetricFunctions(QQ).schur()
Symmetric Functions over Rational Field in the Schur basis
"""
return schur.SymmetricFunctionAlgebra_schur(self)
s = schur
Schur = schur # Currently needed by SymmetricFunctions.__init_extra__
# and sfa.GradedSymmetricFunctionsBases.corresponding_basis_over
def powersum(self):
r"""
The power sum basis of the Symmetric Functions
EXAMPLES::
sage: SymmetricFunctions(QQ).powersum()
Symmetric Functions over Rational Field in the powersum basis
"""
return powersum.SymmetricFunctionAlgebra_power(self)
p = powersum
power = powersum # Todo: get rid of this one when it won't be needed anymore
def complete(self):
r"""
The complete basis of the Symmetric Functions
EXAMPLES::
sage: SymmetricFunctions(QQ).complete()
Symmetric Functions over Rational Field in the homogeneous basis
"""
return homogeneous.SymmetricFunctionAlgebra_homogeneous(self)
h = complete
homogeneous = complete
def elementary(self):
r"""
The elementary basis of the Symmetric Functions
EXAMPLES::
sage: SymmetricFunctions(QQ).elementary()
Symmetric Functions over Rational Field in the elementary basis
"""
return elementary.SymmetricFunctionAlgebra_elementary(self)
e = elementary
def monomial(self):
r"""
The monomial basis of the Symmetric Functions
EXAMPLES::
sage: SymmetricFunctions(QQ).monomial()
Symmetric Functions over Rational Field in the monomial basis
"""
return monomial.SymmetricFunctionAlgebra_monomial(self)
m = monomial
def witt(self, coerce_h=True, coerce_e=False, coerce_p=False):
r"""
The Witt basis of the symmetric functions.
EXAMPLES::
sage: SymmetricFunctions(QQ).witt()
Symmetric Functions over Rational Field in the Witt basis
sage: SymmetricFunctions(QQ).witt(coerce_p=True)
Symmetric Functions over Rational Field in the Witt basis
sage: SymmetricFunctions(QQ).witt(coerce_h=False, coerce_e=True, coerce_p=True)
Symmetric Functions over Rational Field in the Witt basis
"""
from . import witt
return witt.SymmetricFunctionAlgebra_witt(self, coerce_h=coerce_h, coerce_e=coerce_e, coerce_p=coerce_p)
w = witt
# Currently needed by sfa.GradedSymmetricFunctionsBases.corresponding_basis_over
Witt = witt
def irreducible_symmetric_group_character(self):
r"""
The irreducible `S_n` character basis of the Symmetric Functions.
This basis has the property that if the element indexed by the
partition `\lambda` is evaluated at the roots of a permutation of
cycle structure `\rho` then the value is the irreducible character
`\chi^{(|\rho|-|\lambda|,\lambda)}(\rho)`.
In terms of methods that are implemented in Sage, if ``n`` is
a sufficiently large integer, then
``st(lam).character_to_frobenius_image(n)`` is equal the Schur function
indexed by ``[n-sum(lam)]+lam``.
This basis is introduced in [OZ2015]_.
.. SEEALSO::
:meth:`~sage.combinat.sf.sfa.SymmetricFunctionAlgebra_generic_Element.character_to_frobenius_image`,
:meth:`~sage.combinat.sf.sfa.SymmetricFunctionAlgebra_generic_Element.eval_at_permutation_roots`
EXAMPLES::
sage: SymmetricFunctions(QQ).irreducible_symmetric_group_character()
Symmetric Functions over Rational Field in the irreducible symmetric group character basis
sage: st = SymmetricFunctions(QQ).st()
sage: s = SymmetricFunctions(QQ).s()
sage: s(st([3,2]).character_to_frobenius_image(9))
s[4, 3, 2]
sage: s(st([3,2]).character_to_frobenius_image(7))
0
sage: s(st([3,2]).character_to_frobenius_image(6))
-s[2, 2, 2]
sage: list(SymmetricGroup(5).character_table()[-2])
[4, 2, 0, 1, -1, 0, -1]
sage: list(reversed([st([1]).eval_at_permutation_roots(rho) \
....: for rho in Partitions(5)]))
[4, 2, 0, 1, -1, 0, -1]
"""
from .character import irreducible_character_basis
return irreducible_character_basis(self, 'st')
st = irreducible_symmetric_group_character
def induced_trivial_character(self):
r"""
The induced trivial character basis of the Symmetric Functions.
The trivial character of
.. MATH::
S_{n-|\lambda|} \times S_{\lambda_1} \times S_{\lambda_2} \times
\cdots \times S_{\lambda_\ell(\lambda)}
induced to the group `S_{n}` is a symmetric function in the
eigenvalues of a permutation matrix. This basis is that character.
It has the property that if the element indexed by the
partition `\lambda` is evaluated at the roots of a permutation of
cycle structure `\rho` then the value is the coefficient
`\left< h_{(n-|\lambda|,\lambda)}, p_\rho \right>`.
In terms of methods that are implemented in Sage, if ``n`` is
a sufficiently large integer, then
``ht(lam).character_to_frobenius_image(n)`` is equal the complete
function indexed by ``[n-sum(lam)]+lam``.
This basis is introduced in [OZ2015]_.
.. SEEALSO::
:meth:`~sage.combinat.sf.sfa.SymmetricFunctionAlgebra_generic_Element.character_to_frobenius_image`,
:meth:`~sage.combinat.sf.sfa.SymmetricFunctionAlgebra_generic_Element.eval_at_permutation_roots`
EXAMPLES::
sage: SymmetricFunctions(QQ).induced_trivial_character()
Symmetric Functions over Rational Field in the induced trivial character basis
sage: ht = SymmetricFunctions(QQ).ht()
sage: h = SymmetricFunctions(QQ).h()
sage: h(ht([3,2]).character_to_frobenius_image(9))
h[4, 3, 2]
sage: h(ht([3,2]).character_to_frobenius_image(7))
h[3, 2, 2]
sage: h(ht([3,2]).character_to_frobenius_image(5))
h[3, 2]
sage: h(ht([3,2]).character_to_frobenius_image(4))
0
sage: p = SymmetricFunctions(QQ).p()
sage: [h([4,1]).scalar(p(rho)) for rho in Partitions(5)]
[0, 1, 0, 2, 1, 3, 5]
sage: [ht([1]).eval_at_permutation_roots(rho) for rho in Partitions(5)]
[0, 1, 0, 2, 1, 3, 5]
"""
from .character import character_basis
return character_basis(self, self.h(), "induced trivial character", 'ht')
ht = induced_trivial_character
def forgotten(self):
r"""
The forgotten basis of the Symmetric Functions (or the basis dual to
the elementary basis with respect to the Hall scalar product).
EXAMPLES::
sage: SymmetricFunctions(QQ).forgotten()
Symmetric Functions over Rational Field in the forgotten basis
TESTS:
Over the rationals::
sage: Sym = SymmetricFunctions(QQ)
sage: e = Sym.e()
sage: f = Sym.f()
sage: h = Sym.h()
sage: p = Sym.p()
sage: s = Sym.s()
sage: m = Sym.m()
sage: e(f([2,1]))
-2*e[1, 1, 1] + 5*e[2, 1] - 3*e[3]
sage: f(e([2,1]))
3*f[1, 1, 1] + 2*f[2, 1] + f[3]
sage: h(f([2,1]))
h[2, 1] - 3*h[3]
sage: f(h([2,1]))
3*f[1, 1, 1] + f[2, 1]
sage: p(f([2,1]))
-p[2, 1] - p[3]
sage: f(p([2,1]))
-f[2, 1] - f[3]
sage: s(f([2,1]))
s[2, 1] - 2*s[3]
sage: f(s([2,1]))
2*f[1, 1, 1] + f[2, 1]
sage: m(f([2,1]))
-m[2, 1] - 2*m[3]
sage: f(m([2,1]))
-f[2, 1] - 2*f[3]
Over the integers::
sage: Sym = SymmetricFunctions(ZZ)
sage: e = Sym.e()
sage: f = Sym.f()
sage: h = Sym.h()
sage: p = Sym.p()
sage: s = Sym.s()
sage: m = Sym.m()
sage: e(f([2,1]))
-2*e[1, 1, 1] + 5*e[2, 1] - 3*e[3]
sage: f(e([2,1]))
3*f[1, 1, 1] + 2*f[2, 1] + f[3]
sage: h(f([2,1]))
h[2, 1] - 3*h[3]
sage: f(h([2,1]))
3*f[1, 1, 1] + f[2, 1]
sage: f(p([2,1]))
-f[2, 1] - f[3]
sage: s(f([2,1]))
s[2, 1] - 2*s[3]
sage: f(s([2,1]))
2*f[1, 1, 1] + f[2, 1]
sage: m(f([2,1]))
-m[2, 1] - 2*m[3]
sage: f(m([2,1]))
-f[2, 1] - 2*f[3]
Conversion from the forgotten basis to the power-sum basis over the
integers is not well-defined in general, even if the result happens
to have integral coefficients::
sage: p(f([2,1]))
Traceback (most recent call last):
...
TypeError: no conversion of this rational to integer
Fun exercise: prove that `p(f_{\lambda})` and `p(m_{\lambda})` have
integral coefficients whenever `\lambda` is a strict partition.
"""
return self.elementary().dual_basis()
f = forgotten
def symplectic(self):
"""
The symplectic basis of the symmetric functions.
.. SEEALSO:: :class:`~sage.combinat.sf.symplectic.SymmetricFunctionAlgebra_symplectic`
EXAMPLES::
sage: SymmetricFunctions(QQ).symplectic()
Symmetric Functions over Rational Field in the symplectic basis
"""
from . import symplectic
return symplectic.SymmetricFunctionAlgebra_symplectic(self)
sp = symplectic
def orthogonal(self):
"""
The orthogonal basis of the symmetric functions.
.. SEEALSO:: :class:`~sage.combinat.sf.orthogonal.SymmetricFunctionAlgebra_orthogonal`
EXAMPLES::
sage: SymmetricFunctions(QQ).orthogonal()
Symmetric Functions over Rational Field in the orthogonal basis
"""
from . import orthogonal
return orthogonal.SymmetricFunctionAlgebra_orthogonal(self)
o = orthogonal
def macdonald(self, q='q', t='t'):
r"""
Returns the entry point for the various Macdonald bases.
INPUT:
- ``q``, ``t`` -- parameters
Macdonald symmetric functions including bases `P`, `Q`, `J`, `H`, `Ht`.
This also contains the `S` basis which is dual to the Schur basis with
respect to the `q,t` scalar product.
The parameters `q` and `t` must be in the base_ring of parent.
EXAMPLES::
sage: Sym = SymmetricFunctions(FractionField(QQ['q','t']))
sage: P = Sym.macdonald().P(); P
Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the Macdonald P basis
sage: P[2]
McdP[2]
sage: Q = Sym.macdonald().Q(); Q
Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the Macdonald Q basis
sage: S = Sym.macdonald().S()
sage: s = Sym.schur()
sage: matrix([[S(la).scalar_qt(s(mu)) for la in Partitions(3)] for mu in Partitions(3)])
[1 0 0]
[0 1 0]
[0 0 1]
sage: H = Sym.macdonald().H()
sage: s(H[2,2])
q^2*s[1, 1, 1, 1] + (q^2*t+q*t+q)*s[2, 1, 1] + (q^2*t^2+1)*s[2, 2] + (q*t^2+q*t+t)*s[3, 1] + t^2*s[4]
sage: Sym = SymmetricFunctions(QQ['z','q'].fraction_field())
sage: (z,q) = Sym.base_ring().gens()
sage: Hzq = Sym.macdonald(q=z,t=q).H()
sage: H1z = Sym.macdonald(q=1,t=z).H()
sage: s = Sym.schur()
sage: s(H1z([2,2]))
s[1, 1, 1, 1] + (2*z+1)*s[2, 1, 1] + (z^2+1)*s[2, 2] + (z^2+2*z)*s[3, 1] + z^2*s[4]
sage: s(Hzq[2,2])
z^2*s[1, 1, 1, 1] + (z^2*q+z*q+z)*s[2, 1, 1] + (z^2*q^2+1)*s[2, 2] + (z*q^2+z*q+q)*s[3, 1] + q^2*s[4]
sage: s(H1z(Hzq[2,2]))
z^2*s[1, 1, 1, 1] + (z^2*q+z*q+z)*s[2, 1, 1] + (z^2*q^2+1)*s[2, 2] + (z*q^2+z*q+q)*s[3, 1] + q^2*s[4]
"""
return macdonald.Macdonald(self, q=q, t=t)
def hall_littlewood(self, t='t'):
"""
Returns the entry point for the various Hall-Littlewood bases.
INPUT:
- ``t`` -- parameter
Hall-Littlewood symmetric functions including bases `P`, `Q`, `Qp`.
The Hall-Littlewood `P` and `Q` functions at `t=-1` are the
Schur-P and Schur-Q functions when indexed by strict partitions.
The parameter `t` must be in the base ring of parent.
EXAMPLES::
sage: Sym = SymmetricFunctions(FractionField(QQ['t']))
sage: P = Sym.hall_littlewood().P(); P
Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the Hall-Littlewood P basis
sage: P[2]
HLP[2]
sage: Q = Sym.hall_littlewood().Q(); Q
Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the Hall-Littlewood Q basis
sage: Q[2]
HLQ[2]
sage: Qp = Sym.hall_littlewood().Qp(); Qp
Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the Hall-Littlewood Qp basis
sage: Qp[2]
HLQp[2]
"""
return hall_littlewood.HallLittlewood(self, t=t)
def jack(self, t='t'):
"""
Returns the entry point for the various Jack bases.
INPUT:
- ``t`` -- parameter
Jack symmetric functions including bases `P`, `Q`, `Qp`.
The parameter `t` must be in the base ring of parent.
EXAMPLES::
sage: Sym = SymmetricFunctions(FractionField(QQ['t']))
sage: JP = Sym.jack().P(); JP
Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the Jack P basis
sage: JQ = Sym.jack().Q(); JQ
Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the Jack Q basis
sage: JJ = Sym.jack().J(); JJ
Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the Jack J basis
sage: JQp = Sym.jack().Qp(); JQp
Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the Jack Qp basis
"""
return jack.Jack(self, t=t)
def zonal(self):
"""
The zonal basis of the Symmetric Functions
EXAMPLES::
sage: SymmetricFunctions(QQ).zonal()
Symmetric Functions over Rational Field in the zonal basis
"""
return jack.SymmetricFunctionAlgebra_zonal(self)
def llt(self, k, t='t'):
"""
The LLT symmetric functions.
INPUT:
- ``k`` -- a positive integer indicating the level
- ``t`` -- a parameter (default: `t`)
LLT polynomials in `hspin` and `hcospin` bases.
EXAMPLES::
sage: llt3 = SymmetricFunctions(QQ['t'].fraction_field()).llt(3); llt3
level 3 LLT polynomials over Fraction Field of Univariate Polynomial Ring in t over Rational Field
sage: llt3.hspin()
Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the level 3 LLT spin basis
sage: llt3.hcospin()
Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the level 3 LLT cospin basis
sage: llt3.hcospin()
Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the level 3 LLT cospin basis
"""
return llt.LLT_class(self, k, t=t)
def from_polynomial(self, f):
"""
Converts a symmetric polynomial ``f`` to a symmetric function.
INPUT:
- ``f`` -- a symmetric polynomial
This function converts a symmetric polynomial `f` in a polynomial ring in finitely
many variables to a symmetric function in the monomial
basis of the ring of symmetric functions over the same base ring.
EXAMPLES::
sage: P = PolynomialRing(QQ, 'x', 3)
sage: x = P.gens()
sage: f = x[0] + x[1] + x[2]
sage: S = SymmetricFunctions(QQ)
sage: S.from_polynomial(f)
m[1]
sage: f = x[0] + 2*x[1] + x[2]
sage: S.from_polynomial(f)
Traceback (most recent call last):
...