Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Decompose a nested iteration into its transient and repeating parts
ResourceFunction["FindNestedTransientRepeat"][fun,init,n] for an atypical function fun, requires repeat to occur successively at least n times. | |
ResourceFunction["FindNestedTransientRepeat"][fun,init,n,m] terminates after at most m steps. |
Test the Collatz conjecture for n=23:
In[1]:= | ![]() |
Out[1]= | ![]() |
Rational inputs to the tent map always end up repeating:
In[2]:= | ![]() |
Out[2]= | ![]() |
Inputs with even numerator have no transient part:
In[3]:= | ![]() |
Out[3]= | ![]() |
Prove the elementary CellularAutomaton Rule 30 is not reversible:
In[4]:= | ![]() |
Out[4]= | ![]() |
Test Rule 240 reversibility and cycle lengths:
In[5]:= | ![]() |
Out[5]= | ![]() |
Find repeat runs in a sequence of random integer digits:
In[6]:= | ![]() |
Out[3]= | ![]() |
But the next digit is not another 1:
In[7]:= | ![]() |
Out[8]= | ![]() |
Encode and decode hash functions allow more efficient data structures:
In[9]:= | ![]() |
Out[9]= | ![]() |
Setting the decode function to Automatic keeps an extra dictionary in memory:
In[10]:= | ![]() |
Out[10]= | ![]() |
Compare with FindTransientRepeat and NestList:
In[11]:= | ![]() |
Out[11]= | ![]() |
Compare again with NestList:
In[12]:= | ![]() |
Out[12]= | ![]() |
Some inputs can possibly lead to non-terminating loops:
In[13]:= | ![]() |
Out[13]= | ![]() |
Add a cutoff parameter for returning a purely transient result:
In[14]:= | ![]() |
Out[14]= | ![]() |
Plot the transient and repeating parts of a Rule 30 iteration:
In[15]:= | ![]() |
Out[15]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License