StringTools - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Programming : Names and Strings : StringTools Package : Combinatorics on Words : StringTools/MonotonicFactors

StringTools

 MonotonicFactors
 compute the (left-to-right) monotonic factorization of a string

 Calling Sequence MonotonicFactors( w )

Parameters

 w - Maple string

Description

 • The MonotonicFactors(w) command produces the monotonic factorization of the string w. It returns a list of strings whose catenation is the string w, such that each string in the list is maximal monotonic (either increasing or decreasing).

Examples

 > $\mathrm{with}\left(\mathrm{StringTools}\right):$
 > $\mathrm{MonotonicFactors}\left("abc"\right)$
 $\left[{"abc"}\right]$ (1)
 > $\mathrm{MonotonicFactors}\left("abcdedcccbabab"\right)$
 $\left[{"abcde"}{,}{"dc"}{,}{"ccba"}{,}{"ba"}{,}{"b"}\right]$ (2)
 > $\mathrm{MonotonicFactors}\left(\mathrm{ThueMorse}\left(60\right)\right)$
 $\left[{"01"}{,}{"10"}{,}{"10"}{,}{"01"}{,}{"10"}{,}{"01"}{,}{"01"}{,}{"10"}{,}{"10"}{,}{"01"}{,}{"01"}{,}{"10"}{,}{"01"}{,}{"10"}{,}{"10"}{,}{"01"}{,}{"10"}{,}{"01"}{,}{"01"}{,}{"10"}{,}{"01"}{,}{"10"}{,}{"10"}{,}{"01"}{,}{"01"}{,}{"10"}{,}{"10"}{,}{"01"}{,}{"10"}{,}{"01"}\right]$ (3)
 > $\mathrm{MonotonicFactors}\left(\mathrm{Fibonacci}\left(8\right)\right)$
 $\left[{"01"}{,}{"001"}{,}{"01"}{,}{"001"}{,}{"001"}{,}{"01"}{,}{"001"}{,}{"01"}{,}{"001"}{,}{"001"}{,}{"01"}{,}{"001"}{,}{"001"}\right]$ (4)

 See Also

## Was this information helpful?

 Please add your Comment (Optional) E-mail Address (Optional) What is ? This question helps us to combat spam