Message Boards Message Boards

5
|
4614 Views
|
0 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Expanding Capabilities of CellularAutomaton Function

Posted 10 years ago

An area of interest of mine that I explored more in-depth at the Wolfram Summer School recently was probabilistic cellular automata. Currently, the CellularAutomaton function is rule based, and these rules represent distinct deterministic cellular automata. To work around this, I helped create function that generalizes CellularAutomaton; here is a function that generates a probabilistic elementary cellular automata,

pECA[r_List, init_List, {{n_Integer}}] := {Last[pECA[r, init, n]]}
pECA[r_List,init_List,n_Integer]:=
Module[{rule},
rule:=Thread[Tuples[{1,0},3]->Flatten[RandomVariate[BernoulliDistribution[#],1]&/@r]];
NestList[Partition[#,3,1,{2,2}]/.rule&,init,n]];

Here is an example of how it works. Feel free to play with it and check out the scope!

pECA[{1,.9,0,.34354,.5,0,1,.2},RandomInteger[1,100],100]//ArrayPlot

enter image description here

I was curious if the CellularAutomaton function itself could somehow replicate pECA, and for awhile I was convinced that it couldn't (and I spent a few days during the program trying to test this) but was getting nothing that looked like how I wanted it to. I think one of the issues was that it at some point the code tests all combos and saves the resultant rule list and just uses that format instead of relying on the user one. As in, it looked like this:

enter image description here

However, after talking with a friend about the problem, I think we figured out that is was some sort of optimization issue within the CellularAutomaton function.

Here is the revised rule from the pECA function to make it compatible with CellularAutomaton function:

pbs={1,.9,0,.34354,.5,0,1,.2};
rule:=MapThread[#1 :> Boole[RandomReal[]< #2]&,{Tuples[{1,0},3],pbs}]

And here is an example of how it turns out:

CellularAutomaton[rule,RandomInteger[1,100],100]//ArrayPlot

enter image description here

Just wanted to share this! It's made my computations faster and thus easier when examining pECAs.

POSTED BY: Jesse Dohmann
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract