combinat::permutations::peaks
--
Peaks of permutations
Functions related to the peaks of permutations
peaks(permutation p)
p
, that is the list of integers i such that
p[i-1]<=p[i]
and p[i]>p[i+1]
.
peaksNumber(permutation p)
p
.The peaks of a permutation are computed as:
>> combinat::permutations::peaks([2, 1, 6, 4, 7, 3, 5])
[3, 5]
The number of peaks can be directly computed using:
>> combinat::permutations::peaksNumber([2, 1, 6, 4, 7, 3, 5])
2
MuPAD Combinat, an open source algebraic combinatorics package