 FindRepetitions - Maple Help

ListTools

 FindRepetitions
 find the repeated elements in a list Calling Sequence FindRepetitions(L, N, f, opt1, opt2, ...) Parameters

 L - list N - (optional) non-negative integer or infinity f - (optional) procedure opt1, opt2, ... - (optional) extra arguments to f Description

 • The FindRepetitions(L) function inspects the elements in list L and returns all the elements which previously appeared in the list.
 • If the optional second argument is specified, FindRepetitions(L, N) removes N copies of each unique element in list L (if possible).
 • By default, operands are compared by using boolean comparison. If a third argument is specified, then the function f(x, y, opt1, opt2, ...) is called to check if x and y should be considered equal. This function should implement an equivalence relation (i.e. it should be reflexive, commutative, and transitive).  If it is not, then the result may not be valid. Examples

 > $\mathrm{with}\left(\mathrm{ListTools}\right):$
 > $L≔\left[1,2,3,4,3,2,3,4,5,4,3,4,5,6\right]$
 ${L}{≔}\left[{1}{,}{2}{,}{3}{,}{4}{,}{3}{,}{2}{,}{3}{,}{4}{,}{5}{,}{4}{,}{3}{,}{4}{,}{5}{,}{6}\right]$ (1)
 > $\mathrm{FindRepetitions}\left(L\right)$
 $\left[{3}{,}{2}{,}{3}{,}{4}{,}{4}{,}{3}{,}{4}{,}{5}\right]$ (2)
 > $\mathrm{FindRepetitions}\left(L,0\right)$
 $\left[{1}{,}{2}{,}{3}{,}{4}{,}{3}{,}{2}{,}{3}{,}{4}{,}{5}{,}{4}{,}{3}{,}{4}{,}{5}{,}{6}\right]$ (3)
 > $\mathrm{FindRepetitions}\left(L,2\right)$
 $\left[{3}{,}{4}{,}{3}{,}{4}\right]$ (4)
 > $\mathrm{FindRepetitions}\left(L,'\mathrm{∞}'\right)$
 $\left[\right]$ (5)
 > $L≔\left[0,\left(x-1\right)\left(x+1\right),0.,{x}^{2}-1,-0.,-\left(1-x\right)\left(x+1\right)\right]$
 ${L}{≔}\left[{0}{,}\left({x}{-}{1}\right){}\left({x}{+}{1}\right){,}{0.}{,}{{x}}^{{2}}{-}{1}{,}{-0.}{,}{-}\left({1}{-}{x}\right){}\left({x}{+}{1}\right)\right]$ (6)
 > $\mathrm{FindRepetitions}\left(L\right)$
 $\left[\right]$ (7)
 > $\mathrm{FindRepetitions}\left(L,1,\mathrm{verify},\mathrm{expand}\right)$
 $\left[{0.}{,}{{x}}^{{2}}{-}{1}{,}{-0.}{,}{-}\left({1}{-}{x}\right){}\left({x}{+}{1}\right)\right]$ (8)