Ticket #14136: trac_14136-p_partition_enumerator-review-ts.patch

File trac_14136-p_partition_enumerator-review-ts.patch, 3.4 KB (added by tscrim, 8 years ago)
  • sage/combinat/posets/posets.py

    # HG changeset patch
    # User Travis Scrimshaw <tscrim@ucdavis.edu>
    # Date 1368112575 25200
    # Node ID 92ad6be2d9207775cab8501a36d40d088b286d93
    # Parent 76b1347350a0a50721779d22eb9747d20cc1369d
    #14136: review patch.
    
    diff --git a/sage/combinat/posets/posets.py b/sage/combinat/posets/posets.py
    a b class FinitePoset(UniqueRepresentation,  
    32373237
    32383238    def p_partition_enumerator(self, tup, R, check=False):
    32393239        r"""
    3240         return a `P`-partition enumerator of ``self``
    3241 
    3242         This is a quasisymmetric function which depends on a total
    3243         order on the vertices of the poset.
     3240        Return a `P`-partition enumerator of ``self``.
     3241
     3242        Given a total order `\prec` on the vertices of a poset `P`, a
     3243        `P`-parition enumerator is the quasisymmetric function
     3244        `\sum_f \prod_{p \in P} x_{f(p)}`, where the first sum is taken over
     3245        all `P`-partitions `f`.
     3246
     3247        A `P`-partition is a function `f : P \to \{1,2,3,...\}` satisfying
     3248        the following properties for any two elements `i` and `j` of `P`:
     3249
     3250        - if `i \prec j` then `f(i) \leq f(j)`,
     3251
     3252        - if `j \prec i` then `f(j) < f(i)`.
    32443253
    32453254        INPUT:
    32463255
    3247         - `tup` -- tuple: the elements of `P` in some total order; this does not have to be a linear extension.
    3248 
    3249         - `R` -- commutative ring
     3256        - ``tup`` -- A tuple of elements of `P` representing a total order
     3257          (this does not have to be a linear extension)
     3258
     3259        - ``R`` -- A commutative ring
    32503260
    32513261        OUTPUT:
    32523262
    3253         the `P`-partition enumerator of ``self`` according to `tup` in the
     3263        The `P`-partition enumerator of ``self`` according to ``tup`` in the
    32543264        algebra `QSym` over the base ring `R`.
    32553265
    3256         This is the quasisymmetric function `\sum\limits_{f\text{ a
    3257         }P\text{-partition}} \prod\limits_{p \in P} x_{f(p)}`, where a
    3258         `P`-partition is a function `P \to \{1,2,3,...\}` satisfying
    3259         the following properties:
    3260 
    3261         For any two elements `i` and `j` of `P`,
    3262 
    3263         - if `i < j` then `f(i) \leq f(j)`,
    3264 
    3265         - if `i < j` and `i` appears left of `j` in `tup` then `f(i) < f(j)`.
    3266 
    32673266        EXAMPLES::
    32683267
    32693268            sage: P = Poset([[1,2,3,4],[[1,4],[2,4],[4,3]]])
    3270             sage: FP = P.p_partition_enumerator((3,1,2,4), QQ, check=True);FP
     3269            sage: FP = P.p_partition_enumerator((3,1,2,4), QQ, check=True); FP
    32713270            2*M[1, 1, 1, 1] + 2*M[1, 2, 1] + M[2, 1, 1] + M[3, 1]
    32723271
    32733272            sage: expansion = FP.expand(5)
    class FinitePoset(UniqueRepresentation,  
    32763275            True
    32773276
    32783277            sage: P = Poset([[],[]])
    3279             sage: FP = P.p_partition_enumerator((), QQ, check=True) ; FP
     3278            sage: FP = P.p_partition_enumerator((), QQ, check=True); FP
    32803279            M[]
    32813280        """
    32823281        if check:
    32833282            if sorted(self.list()) != sorted(tup):
    32843283                raise ValueError("the elements of tup are not those of P")
     3284        from sage.combinat.composition import Composition
    32853285        from sage.combinat.ncsf_qsym.qsym import QuasiSymmetricFunctions
    3286         from sage.combinat.composition import Composition
    3287         print('no error yet')
    32883286        QR = QuasiSymmetricFunctions(R)
    3289         print('error is before this line')
    32903287        n = len(tup)
    32913288        res = QR.zero()
    32923289        tupdict = dict(zip(tup, range(n)))