# Ticket #12645: trac_12645-fix_rst_markup-sk.patch

File trac_12645-fix_rst_markup-sk.patch, 12.6 KB (added by nthiery, 8 years ago)
• ## doc/en/reference/combinat/symmetric_functions.rst

# HG changeset patch
# User Simon King <simon.king@uni-jena.de>
# Date 1331304426 -3600
# Node ID 7653d2fd417636a0ae1400009dcfd95457e92e96
diff --git a/doc/en/reference/combinat/symmetric_functions.rst b/doc/en/reference/combinat/symmetric_functions.rst
diff --git a/sage/combinat/sf/sf.py b/sage/combinat/sf/sf.py
 a """ Symmetric functions, with their multiple realizations """ from sage.structure.parent import Parent from sage.structure.unique_representation import UniqueRepresentation from sage.categories.all import Rings, GradedHopfAlgebrasWithBasis, ModulesWithBasis class SymmetricFunctions(UniqueRepresent sage: Sym Symmetric Functions over Rational Field Todo: add one example of non trivial computation, and then proceed with the detailed explanations .. todo:: Add one example of non trivial computation, and then proceed with the detailed explanations. Todo: expand this tutorial, merging with that of MuPAD-Combinat .. todo:: Expand this tutorial, merging with that of MuPAD-Combinat :: 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() # todo: not implemented class SymmetricFunctions(UniqueRepresent p[2, 1, 1] Badly enough, due to a limitation in Python syntax, one cannot use:: sage: p[]       # todo: not implemented Please use instead:: sage: p[[]] p[] class SymmetricFunctions(UniqueRepresent sage: p[2,1,1] + 2 * (p[4] + p[2,1]) 2*p[2, 1] + p[2, 1, 1] + 2*p[4] ..topic: Algebra structure .. rubric:: Algebra structure Let us explore the other operations of p. First, we can ask for the mathematical properties of p: the mathematical properties of p:: sage: p.categories() # todo: not implemented [The category of multiplicative bases on primitive elements of Sym, class SymmetricFunctions(UniqueRepresent sage: (p.one() + 2 * p[3,1]) * p[4, 2] p[4, 2] + 2*p[4, 3, 2, 1] ..topic: Hopf algebra structure .. rubric:: Hopf algebra structure p is further endowed with a coalgebra algebra structure (in fact, it is, up to isomorphism, the unique free algebra on class SymmetricFunctions(UniqueRepresent p[] # p[2] + p[2] # p[] The coproduct being cocommutative on the generators is cocommutative everywhere:: sage: p[2, 1].coproduct()       # todo: not implemented p[] # p[2, 1] + p[1] # p[2] + p[2, 1] # p[] + p[2] # p[1] The antipode is an anti-algebra morphism (Todo: explain what it is); on the p basis, it sends the generators to their opposite: is); on the p basis, it sends the generators to their opposite:: sage: p[3].antipode()           # todo: not implemented -p[3] sage: p[1,3,2].antipode()       # todo: not implemented -p[2, 3, 1] ..topic: Other concrete representations .. rubric:: Other concrete representations Todo: demonstrate how to customize the basis names .. todo:: Demonstrate how to customize the basis names. Sym admits many other concrete representations:: class SymmetricFunctions(UniqueRepresent sage: m = Sym.monomial() sage: f = Sym.forgotten()       # todo: not implemented To change from one basis to another, one simply does: To change from one basis to another, one simply does:: sage: m(p[3]) m[3] sage: m(p[3,2]) m[3, 2] + m[5] In general, one can mix up different basis in computations: In general, one can mix up different basis in computations:: 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] class SymmetricFunctions(UniqueRepresent sage: P = Jack.P(); J = Jack.J(); Q = Jack.Q()  # todo: not implemented sage: J(P[2,1])                                 # todo: not implemented t can be specialized as follow:: It can be specialized as follow:: sage: Sym = SymmetricFunctions(QQ) sage: Jack = Sym.jack_polynomials(t = 1)        # todo: not implemented sage: P = Jack.P(); J = Jack.J(); Q = Jack.Q()  # todo: not implemented sage: J(P[2,1])                                 # todo: not implemented Todo: introduce a field with degree 1 elements as in MuPAD-Combinat, to get proper plethysm. .. todo:: Introduce a field with degree 1 elements as in MuPAD-Combinat, to get proper plethysm. Similarly one can get Hall-Littlewood, Macdonald polynomials, etc:: class SymmetricFunctions(UniqueRepresent sage: P = Mcd.P(); J = Mcd.J(); Q = Mcd.Q()     # todo: not implemented sage: J(P[2,1])                                 # todo: not implemented Further things to do: - 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. .. todo:: - 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. - Use #7980 to handle the multiple realizations """ def __init__(self, R): class SymmetricFunctions(UniqueRepresent We override the canonical coercion from the Schur basis to the powersum basis by a (stupid!) map s_\lambda\mapsto 2p_\lambda. :: sage: Sym = SymmetricFunctions(QQ['zorglub']) # make sure we are not going to screw up later tests sage: s = Sym.s(); p = Sym.p().dual_basis() class SymmetricFunctions(UniqueRepresent INPUT: - shorthands - a list (or iterable) of strings (default: ['e', 'h', 'm', 'p', 's']) - shorthands -- a list (or iterable) of strings (default: ['e', 'h', 'm', 'p', 's']) EXAMPLES:: class SymmetricaConversionOnBasis: """ INPUT: - t -- a function taking a monomial in CombinatorialFreeModule(QQ, Partitions()), and returning a (partition, coefficient) list. - t -- a function taking a monomial in CombinatorialFreeModule(QQ, Partitions()), and returning a (partition, coefficient) list. - domain, codomain -- parents - domain, codomain -- parents Construct a function mapping a partition to an element of codomain. This is a temporary quick hack to wrap around the existing symmetrica conversions, without changing their specs. EXAMPLES: EXAMPLES:: sage: Sym = SymmetricFunctions(QQ[x]) sage: p = Sym.p(); s = Sym.s()
diff --git a/sage/structure/dynamic_class.py b/sage/structure/dynamic_class.py
 a """ Dynamic classes ..topic: Why dynamic classes? .. rubric:: Why dynamic classes? The short answer: parent, but we won't discuss this point choose a data structure for the permutations, typically among the following: - Stored by cycle type - Stored by code - Stored in list notation - C arrays of short ints (for small permutations) - python lists of ints (for huge permutations) - ... - Stored by reduced word - Stored as a function - ... - Stored by cycle type - Stored by code - Stored in list notation - C arrays of short ints (for small permutations) - python lists of ints (for huge permutations) - ... - Stored by reduced word - Stored as a function - ... Luckily, the Sage library provides (or will provide) classes implementing each of those data structures. Those classes all share a just derive our class from the chosen on Then we may want to further choose a specific memory behavior (unique representation, copy-on-write) which (hopefuly) can again be achieved by inheritance. by inheritance:: class MyPermutation(UniqueRepresentation, PermutationCycleType): ... by inheritance. Finaly, we may want to endow the permutations in S with further operations coming from the (algebraic) structure of S: - group operations - or just monoid operations (for a subset of permutations not stable by inverse) - poset operations (for left/right/Bruhat order) - word operations (searching for substrings, patterns, ...) - group operations - or just monoid operations (for a subset of permutations not stable by inverse) - poset operations (for left/right/Bruhat order) - word operations (searching for substrings, patterns, ...) Or any combination thereof. Now, our class typically looks like:: time. Let us take another standard const Depending on the structure of B and C, and possibly on further options passed down by the user, A may be: - an enumerated set - a group - an algebra - a poset - ... - an enumerated set - a group - an algebra - a poset - ... Or any combination thereof. tedious. Furthermore, this would require lookup the appropriate class depending on the desired combination. Instead, one may use the ability of Python to create new classes dynamicaly: dynamicaly:: type("class name", tuple of base classes, dictionary of methods) address. The purpose of this library is Sage, and in particular to ensure that the constructed classes are reused whenever possible (unique representation), and can be pickled. ..topic: combining dynamic classes and Cython classes .. rubric:: Combining dynamic classes and Cython classes Cython classes cannot inherit from a dynamic class (there might be some partial support for this in the future). On the other hand, such from sage.structure.unique_representatio def dynamic_class(name, bases, cls = None, reduction = None, doccls=None): r""" INPUT:: - name: a string - bases: a tuple of classes - cls: a class or None - reduction: a tuple or None - doccls: a class or None INPUT: - name -- a string - bases -- a tuple of classes - cls -- a class or None - reduction -- a tuple or None - doccls -- a class or None Constructs dynamically a new class C with name name, and bases bases. If cls is provided, then its methods will be def dynamic_class(name, bases, cls = Non module of cls or from the first base class (bases should be non empty if cls is None). Documentation and source instrospection is taken from doccls, or cls if doccls is None, or bases[0] if both are None. Documentation and source instrospection is taken from doccls, or cls if doccls is None, or bases[0] if both are None. The constructed class can safely be pickled (assuming the arguments themselves can). def dynamic_class(name, bases, cls = Non The result is cached, ensuring unique representation of dynamic classes. See sage.structure.dynamic_class? for a discussion of the dynamic classes paradigm, and its relevance to Sage. See :mod:sage.structure.dynamic_class` for a discussion of the dynamic classes paradigm, and its relevance to Sage. EXAMPLES: