How does one instruct CellularAutomaton
to wrap at the edges? (I want a 2d finite-width CA, so it evolves on a torus.) I cannot tell from the docs if this is possible.
2 Answers
$\begingroup$
$\endgroup$
2
From some experiments and from reading between the lines of the documentation, if the second argument is a vector, then the system set up with periodic boundary conditions. See for example this one:
ArrayPlot[CellularAutomaton[30, PadLeft[{1}, 100], 150]]
-
$\begingroup$ If you can elaborate a bit more on which documentation you are relying on and how it applies to the 2D (instead of 1d) case, that would help. I am guessing you are referring to this: "a_1,a_2,... explicit list of values a_i, assumed cyclic". I suppose that is suppose to mean that this
init
is implicitly 1d wrapping at the bounderies). In which case, I suppose, a 2d rectangular array forinit
should implicitly be 2d wrapping at the boundaries. $\endgroup$– AlanCommented Jul 24, 2018 at 2:37 -
$\begingroup$ Yes, exactly there. I only found it by searching for "cyclic" and "periodic" (with ctrl + f). I am not sure, but the 2D case should work exactly as you have just anticipated. $\endgroup$ Commented Jul 24, 2018 at 7:03
$\begingroup$
$\endgroup$
An alternative way to specify the initial condition:
ArrayPlot[CellularAutomaton[30, SparseArray[1 -> 1, 50], 50]]
Note: CellularAutomaton >> Scope >> Initial Conditions:
Explicit initial conditions are assumed cyclic