[Previous] [Next] [Contents]

[ImplState=stable,TestState=stable,DocState=stable]

## `combinat::permutations::haspattern` -- Patterns on standard permutations

#### Introduction

Functions related to patterns on standard permutations

#### Details

- A permutation perm=(p1,p2,...,pn) of size n avoids the pattern pattt=(s1,s2,...,sk) of size k if and only if there is no subsequence iπ(1) < iπ(2) < ...< iπ(k) in [1,n] such that σ(i1) < σ(i2) < ...< σ(ik).

#### Method hasPattern: Test of existence of a pattern in a standard permutation

- `hasPattern(standard permutations perm, patt)`

- Returns the boolean answering the question ''Is `patt` a pattern appearing in `perm`?''

#### Method patternPositions: list of the positions of a pattern in a permutation

- `patternPositions(standard permutations perm, patt)`

- Returns the list of positions where the pattern `patt` appears in the standard permutations `perm`.

#### Example 1

To check whether a permutation contains a given pattern, you can use:

    >> combinat::permutations::hasPattern([3, 5, 1, 4, 6, 2], [1, 3, 2])

                                       TRUE

To look at the positions where the pattern appears, you can ask:

    >> combinat::permutations::patternPositions([3, 5, 1, 4, 6, 2], [1, 3, 2])

                         [[1, 2, 4], [3, 4, 6], [3, 5, 6]]

#### Super-Domain

`combinat::words`

#### Axioms

`Ax::systemRep`

[Previous] [Next] [Contents]

MuPAD Combinat, an open source algebraic combinatorics package