FindTransientRepeat

FindTransientRepeat[list,n]

returns a pair of lists {transient,repeat} where the elements of repeat occur successively at least n times after the elements of the transient part of list.

FindTransientRepeat[string,n]

returns a pair of strings {transient,repeat}.

Details and Options

  • In FindTransientRepeat[list,n], n must be a positive integer.
  • FindTransientRepeat[list,1] returns {{},repeat}, where repeat is the shortest repeated part found in list, or list itself if no repetition is found.
  • FindTransientRepeat[list,n,SameTest->test] applies test to each pair of elements in list to determine whether they should be considered the same.

Examples

open allclose all

Basic Examples  (2)

Find the transient and repeated parts of a list:

Find the transient and repeated parts of a string:

Scope  (4)

Find the transient and repeated parts of a list of any kind of elements:

Change the constraint on the minimal number of occurrences of the repeated sublist:

The elements of the first argument of FindTransientRepeat can have different heads:

FindTransientRepeat accepts SparseArray and structured array objects:

Generalizations & Extensions  (1)

FindTransientRepeat can detect an incomplete copy of the repeated sublist in the last position:

The minimum number of repetitions refers to complete repetitions:

Options  (3)

SameTest  (3)

Use equivalence classes based on absolute value:

Use equivalence classes based on Floor:

Use Total of list elements:

Applications  (7)

Recover the generator of a StringRepeat expression:

Select all sublists containing a repeated part of given properties:

Compare with Repeated:

Find the period of a function on a given interval:

Compare with FunctionPeriod:

Quadratic irrational numbers have continued fractions that are ultimately periodic:

Compare the representations for a rational number with an infinite decimal part:

Find the repeated part of a cellular automaton:

Find periods of the rule 90 cellular automaton with different sizes:

Properties & Relations  (4)

When no repeated part exists, FindTransientRepeat returns its first argument and an empty list:

When no repeated part satisfies the condition on the number of occurrences, FindTransientRepeat returns its first argument and an empty list:

FindTransientRepeat returns the pair of sublists {transient,repeat} for which transient has a minimum length:

FindTransientRepeat finds the transient part and the repeated part of an expression:

FindRepeat expects a periodic expression:

When an expression has no transient part, FindRepeat[expr,n] is identical to Last[FindTransientRepeat[expr,n]]:

Introduced in 2016
 (10.4)