3
$\begingroup$

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.

$\endgroup$
0

2 Answers 2

5
$\begingroup$

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]]

enter image description here

$\endgroup$
2
  • $\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 for init should implicitly be 2d wrapping at the boundaries. $\endgroup$
    – Alan
    Commented 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
4
$\begingroup$

An alternative way to specify the initial condition:

ArrayPlot[CellularAutomaton[30, SparseArray[1 -> 1, 50], 50]]

enter image description here

Note: CellularAutomaton >> Scope >> Initial Conditions:

Explicit initial conditions are assumed cyclic

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.