Try now in the
Open Cloud »
(no sign-in required)

Moiré Patterns

Overlay grids of points and see patterns emerge.

Run the code to make an array of points. Try increasing the size from 3:

SHOW/HIDE DETAILS

This draws a grid of 9 points:

In[1]:=
X
Out[1]=

An easier way to make a grid of points is with Table.

This makes a grid of points where x and y vary from -1 to 1 in steps of 1:

In[2]:=
X
Out[2]=

This draws the grid:

In[3]:=
X
Out[3]=

Put more points in the grid by changing 1 to 3:

In[4]:=
X
Out[4]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Change the size of the grid with a slider:

SHOW/HIDE DETAILS

Make anything interactive with Manipulate.

To make the grid interactive, replace the 3s with the variable n, wrap the Graphics expression with Manipulate, and specify that n varies from 3 to 10 in steps of 1. Now you can change the size of the grid by dragging the slider:

In[1]:=
X
Out[1]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Include a second grid, rotated by 30 degrees. Try rotating by different amountsfor example, 45 degrees:

SHOW/HIDE DETAILS

Use With to give the table of points the name points (this will make the next steps easier):

In[1]:=
X
Out[1]=

Rotate the points by 30 degrees:

In[2]:=
X
Out[2]=

Draw the unrotated and rotated points together:

In[3]:=
X
Out[3]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Allow the angle to be varied interactively:

SHOW/HIDE DETAILS

This gives two interactive grids rotated 30 degrees from each other:

In[1]:=
X
Out[1]=

Add an angle control by replacing 30 with the variable angle and specifying that the angle varies from 0 to 180:

In[2]:=
X
Out[2]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Share ItMake an interactive website for exploring moiré patterns:

SHOW/HIDE DETAILS

Deploy the Manipulate to the Wolfram Cloud where anyone with a browser can use it:

In[1]:=
X
Out[1]=

Click the link in the output to visit the site.

Share the link by right-clicking it and choosing Copy Address. Paste the link into an email, tweet, or other message.

HIDE DETAILS
In[1]:=
X
Out[1]=