Jason Cawley
Wolfram Science Group
Phoenix, AZ USA
Registered: Aug 2003
Posts: 712 |
The usual ways are either to have an infinite background of uniform values, and track the pattern in the middle of it, or to wrap the boundary, called cyclic boundary conditions. The infinite background can be all 0, a typical default, but can also be any other cell value or a repeating block.
In the built in CellularAutomaton function, these are implemented by different forms for the initial condition argument, the second. (First is the rule specification, and third is steps).
So for example -
CellularAutomaton[30, {0,0,0,0,1,0,0,0,0}, 5]
- is interpreted as cyclic boundary, since the initial condition argument is a flat list. Thus once the pattern grows beyond the initial block of zeros, it will not keep growing, nor import a fixed boundary of 0s, but will instead wrap.
But if you ask instead for -
CellularAutomaton[30, {{1}, 0}, 5]
- you will get a single 1 cell in an infinite background of 0s. The function will track the locations that can be reached by the initial given the form of the rule, and return everything within that window. Thus for a 5 step range 1 rule, the output returned would be 11 wide. For 10 steps, 21 wide.
To get a repeating background that isn't all 0, you just put it where that 0 is now, a list for a repeating block. To get a wider initial in the midst of that repeating background, just lengthen that inner {1}. For example -
CellularAutomaton[30,{1,1,1,1,1,1},{0,0,1,0}, 20]
That says, start with 6 1s in a background of repeating 0,0,1,0 blocks. Since those make a definite structure, there will be a regular import, in effect, from the edges of the pattern - which will in general be different from step to step and different on the right side or the left, etc. All calculated as though the initial extends forever, but only the slice through it as wide as the {1,1,1,1,1,1} part could reach, shown.
Report this post to a moderator | IP: Logged
|