If we lived in a flat 2D world, visualizing a cube would be as mind-bending as visualizing a 4D hypercube in our 3D world. This project visualizes 4D Cellular Automata using its 3D cube components. In addition to the mesmerizing visualization, the fractal dimensions of 4D cellular automata are graphed to predict whether its hyper shape is regular or irregular .
Here is one of the results of my project. The manipulate visualizes the progression of a 4D cellular automata:
Out[]=
Comparing Patterns of 3D and 4D
Comparing Patterns of 3D and 4D
A point in 3D has coordinates of {x, y, z}, and a point in 4D has an additional dimension "w" with a coordinate of {x, y, z, w}.
In 3D space, and on an 2D computer screen, a 4D hypercube is seen as:
In[]:=
HypercubeGraph[4]
Out[]=
4D axises and a hypercube on the 4D axises:
A 3D cube is made out of layers of 2D arrays. To visualize the 2D arrays, a 3rd dimension height is assigned, and then the arrays are stacked.
A 3D cube is made out of layers of 2D arrays. To visualize the 2D arrays, a 3rd dimension height is assigned, and then the arrays are stacked.
Likewise, a 4D hypercube is made out 3D arrays (cubes). A"w" dimension is assigned to the cubes, which is the position of the 3D array in the 4D array.
Generating 4D Cellular Automata
Generating 4D Cellular Automata
The CellularAutomaton function is used to generate a 4D cellular automata array for a given rule r, and for a certain number of iterations, t. Taking the final resulting 4D array, the CellularAutomaton function returns a list of 3D arrays.
In[]:=
generate4DCArray[r_,t_]:=CellularAutomaton[{r,{2,1},{1,1,1,1}},{{{{{1}}}},0},t][[t]]
Visualizing the components of the 4D array by displaying the 3D cubes. The final result of rule 1222 with 8 iterations:
In[]:=
cubes3D=Image3D/@generate4DCArray[1222,8]
Out[]=
In[]:=
cubes3D//Length
Out[]=
17
The 8th iteration of rule 1222 creates a 17 by 17 by 17 by 17 array, with each of the 17 cubes having dimensions of 17 by 17 by 17.
Finding Patterns in 3D Cube Components
Finding Patterns in 3D Cube Components
The cubes composing a 4D object form a palindrome.
The 17 cubes of the 8th iteration of rule 1222:
In[]:=
Row@{cubes3D[[1;;9]],Reverse@cubes3D[[9;;17]]}
Out[]=
In[]:=
cubes3D[[1;;9]]==Reverse@cubes3D[[9;;17]]
Out[]=
True
Furthermore, from observation, all 4D CA objects have an odd number of cubes, with the first and last cube being empty space.
Visualizing 4D
Visualizing 4D
A unique hue and opacity is assigned to each 3D cube component of a 4D cellular automata. Then those 3D cubes are combined to visualize the 4D cellular automata.
The following function generates all the iterations of a 4D cellular automata for a certain rule:
In[]:=
caGenerate[rule_,iterations_]:=CellularAutomaton[{rule,{2,1},{1,1,1,1}},{{{{{1}}}},0},iterations];
The 10th iteration of rule 1222:
In[]:=
Image3D/@caGenerate[1222,10][[10]]
Out[]=
Each cube is assigned a unique and hue to each depending on their "w" position in the 4D array.
The duplicate half is removed to be able to clearly see the distinct cubes. The first and last cubes, empty, are also not visualized.
In[]:=
caCubes=caGenerate[1222,10][[10]];
Assigning unique hues and opacities to the 10th iteration of rule 1222:
In[]:=
caObjects=MapIndexed[ArrayPlot3D[#1,ColorRules->{0->RGBColor[0,0,0,0],1->Hue[(#2[[1]]-1)/Length@caCubes[[2;;(Length@caCubes+1)/2]],1,1,(#2[[1]]-.3)/Length@caCubes[[2;;(Length@caCubes+1)/2]]]}]&,caCubes[[2;;(Length@caCubes+1)/2]]]
Out[]=
The function combines the cubes of an iteration of a 4D cellular automata. The opacity of each cube depends on its position in the 4D array.
The argument rotate rotates the cubes of the 4D CA iteration so that Show displays the arrangement of cubes in a different order, if wanted.
The list animate visualizes the iterations 1 through 15 for a 4D rule:
Create a manipulate to change the order the cubes are displayed, the opacity, the rule, and iteration:
Maybe if we stare into the depths long enough, we'll be visually transported into the 4th dimension :)
Measuring Fractal Dimensions of 4D CA
Measuring Fractal Dimensions of 4D CA
Rather than looking at in-built "rules", we can specify the Growth Cases for the CA.
Growth and Decay cases refer to the amount of neighbors a cell must have to either grow (become a 1), or decay (become a 0). This project considers the neighbors in the VonNeumann neighborhood - the neighboring cells that are perpendicular to the center cell.
VonNeumann neighborhood for 1D, 2D, and 3D:
Based on the pattern of the number of VonNeumann neighbors in 1D, 2D, and 3D, a cell in the 4th dimension has 8 neighbors perpendicular to it.
Generating a 4D CA with Growth and Decay cases:
This cellular automata will grow for all neighbors.
The following grid shows the progression of the GrowthDecay4D cellular automata for 10 iterations. Each row shows the 3D cube components of that iteration.
The result for this CA (with all possible GrowthCases) is very symmetrical when looking at the diagonals. Because all neighbors become "alive" after each iteration, the 3D components become more and more spherical. We can assume that after many iterations this 4D shape would resemble a hypersphere.
However, other 4D CA are much harder to visually classify, for example:
However, other 4D CA are much harder to visually classify, for example:
In this 4D cellular automata, cells with 1, 2, and 3 neighbor grow, and decay for any other number of neighbors (4 - 8).
Side by side comparison of the two CA:
The arrangement of the single cubes is very interesting . For future work, it would be interesting to analyze their positions, and see if the position of the single cubes corresponds to the positions of black squares in certain 1D cellular automata .
Rather than trying to visually determine what hypershape the 3D components form, the dimension, analogous to the notion of fractal dimension, of the 4D CA can be analyzed to see if any patterns emerge.
To measure the dimension for an object, the number of neighbors for a certain radius r from the center are counted and stored in a list.
For r = 0 through 7. Visuals are from "The Notion of Dimension."
For r = 0 through 7. Visuals are from "The Notion of Dimension."
Then the the log of the amount of neighbors at each r is plotted to determine the dimension.
For 4D it is the same idea. Extending outwards from the center and counting the amount of neighbors for each r. Each cell has 8 neighbors to check.
For 4D it is the same idea. Extending outwards from the center and counting the amount of neighbors for each r. Each cell has 8 neighbors to check.
The initialization variables specifying the Growth Cases, Decay Cases, and amount of iterations for a cellular automata:
The variable evolution is the number of iterations the 4D CA evolves for. And iteration is the final evolution.
The following function finds checks the 8 neighbors of a cell and returns the ones that are "alive":
Then the following function runs recursively through the neighbors of the neighbors cells:
However, it counts duplicates of neighbors with a lower r that have been already counted previously. The following steps find neighbors at each radius r from the center, removes duplicates, and then plots the fractal dimension graph:
The fractal dimension plot for the 4D CA with growth cases of {1,2} for 25 iterations. There are no decay cases.
The final radius of the CA is directly correlated to the final iteration. The more iterations, the larger the CA, and has a greater radius from the center.
To check that the final count of the neighbors in the 4D CA is correct, the final total neighbor count is compared to the volume of the 4D object calculated during initialization.
For 5 iterations:
The final volume does indeed match!
Keeping the amount of iterations constant at 12, the dimensions for 4D CA with different growth cases are plotted.
The fractal dimension is the same for Growth Cases more than Range[4].
The fractal dimension can help predict whether the 4D hypershape is regular or irregular. Regular shapes resemble a regular shape, for a example a cube and sphere in 3D, and a hypercube and hypersphere in 4D. An irregular shape does not fit a certain pattern and is more interesting to look at.
With more growth cases, the more orderly the fractal change becomes after many iterations (with all 8 resembling a hyper sphere). With fewer growth cases, there is greater irregularity between the fractal dimensions, as seen with GC: {1}.
And as seen with the dataset, 4D CA have a lower fractal dimension when the change in fractal dimensions is varies, and have a higher fractal dimension with a pretty constant fractal dimension change.
Therefore, 4D cellular automata are more likely to be irregular with a lower fractal dimension (around 2.5 - 3.6), and resemble a more regular hyper shape with a higher fractal dimension (around 3.6 +).
With more growth cases, the more orderly the fractal change becomes after many iterations (with all 8 resembling a hyper sphere). With fewer growth cases, there is greater irregularity between the fractal dimensions, as seen with GC: {1}.
And as seen with the dataset, 4D CA have a lower fractal dimension when the change in fractal dimensions is varies, and have a higher fractal dimension with a pretty constant fractal dimension change.
Therefore, 4D cellular automata are more likely to be irregular with a lower fractal dimension (around 2.5 - 3.6), and resemble a more regular hyper shape with a higher fractal dimension (around 3.6 +).
Conclusion and Future Work
Conclusion and Future Work
A 4D cellular automata can be visualized using its 3D cube components, resulting in some pretty cool visualizations! Furthermore, the fractal dimension can be plotted, where a lower average dimension indicates a more irregular hyper shape.
Future work includes analyzing the fractal dimensions for a greater variety of growth and decay cases. And if possible, narrow down the specific hyper shapes rather than regular and irregular.
Future work includes analyzing the fractal dimensions for a greater variety of growth and decay cases. And if possible, narrow down the specific hyper shapes rather than regular and irregular.
Acknowledgements
Acknowledgements
I would like to thank my mentor Arben Kalziqi for helping me with my project and visualizations. I would also like to thank Quinn McIntyre for helping me grasp how the 8 neighbors are arranged around a 4D center cell.
References
References
Wolfram Physics Project, "The Notion of Dimension." https://www.wolframphysics.org/technical-introduction/limiting-behavior-and-emergent-geometry/the-notion-of-dimension/
Key Words
Key Words
◼
Cellular Automata
◼
4D Visualization
◼
Fractal Dimensions