Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Generate a periodic pattern
ResourceFunction["PeriodicPatternGenerator"][{n,{x,y},disp}] creates a periodic square array with a side length of x×y based on repeated x×y rectangles filled with the digits of integer n in base 2 with displacement disp on subsequent rows. | |
ResourceFunction["PeriodicPatternGenerator"][{n,{x,y},disp,b}] uses base b. |
Create a periodic pattern based on the binary expansion of 3::
In[1]:= |
Out[1]= |
Show a binary periodic pattern:
In[2]:= |
Out[2]= |
Show the order 2 binary periodic patterns (horizontal stripes, vertical stripes, checkerboard):
In[3]:= |
Out[4]= |
Show all eight order 3 binary periodic patterns:
In[5]:= |
Out[6]= |
Show all twenty order 4 periodic patterns (with Tooltips):
In[7]:= |
Out[7]= |
These periodic patterns are equivalent by displacement:
In[8]:= |
Out[8]= |
There are 8 order-3 ternary periodic patterns:
In[9]:= |
Out[9]= |
There are 65 order-4 ternary periodic patterns:
In[10]:= |
Out[10]= |
Boring patterns usually have a simpler representation:
In[11]:= |
Out[11]= |
In[12]:= |
Out[12]= |
Using PeriodicPatternGenerator, CanonicalListRotation and a brute force algorithm, we can find all displacement-distinct binary patterns up to order 9, given here as a convenience:
In[13]:= |
Show all 180 order 5 ternary patterns:
In[14]:= |
Out[14]= |
Show samples of the 129064 order 16 binary patterns:
In[15]:= |
Out[15]= |
This work is licensed under a Creative Commons Attribution 4.0 International License