Search NKS | Online
111 - 120 of 210 for Listable
More colors [in additive cellular automata]
The pictures below show generalizations of rule 90 to k possible colors using the rule
CAStep[k_Integer, a_List] := Mod[RotateLeft[a] + RotateRight[a], k]
or equivalently Mod[ListCorrelate[{1, 0, 1}, a, 2], k] .
In particular, if a state of a cellular automaton has a certain spatial period, given by the minimum positive m for which RotateLeft[list, m] list , then this state can never evolve to one with a larger spatial period.
TMToRM[rules_] := Module[{segs, adrs}, segs = Map[TMCompile, rules] ; adrs = Thread[Map[First, rules] Drop[FoldList[Plus, 1, Map[Length, segs]], -1]]; MapIndexed[(# /. … Given the list of successive configurations of the register machine, the steps that correspond to successive steps of Turing machine evolution can be obtained from
(Flatten[Partition[Complement[#, #-1], 1, 2]]&)[ Position[list, {_,{_,_,0}}]]
The program given above works for Turing machines with any number of states, but it requires some simple extensions to handle more than two possible colors for each cell.
One can count the number of occurrences of each of the k b possible blocks of length b in a given state using
BC[list_] := With[{z = Map[FromDigits[#, k] &, Partition[list, b, 1, 1]]}, Map[Count[z, #] &, Range[0, k b - 1]]]
Conserved quantities of the kind discussed here are then of the form q . BC[a] where q is some fixed list.
Implementation [of 2D Turing machines]
With rules represented as a list of elements of the form {s, a} {sp, ap, {dx, dy}} ( s is the state of the head and a the color of the cell under the head) each step in the evolution of a 2D Turing machine is given by
TM2DStep[rule_, {s_, tape_, r : {x_, y_}}] := Apply[{#1, ReplacePart[tape, #2, {r}], r + #3} &, {s, tape 〚 x, y 〛 } /. rule]
This yields a chord such as
Play[Evaluate[Apply[Plus, Flatten[Map[Sin[1000 # t] &, N[2 1/12 ]^Position[list, 1]]]]], {t, 0, 0.2}]
A sequence of such chords can sometimes provide a useful representation of cellular automaton evolution.
The code numbers in these cases are given by 2/3 (4 n - 1) + Apply[Plus, 4 list ] where n is the number of neighbors, here 5.
Mathematical properties [of branching model]
If an element c of the list b is real, so that there is a stem that goes straight up, then the limiting height of the center of the pattern is obtained by summing a geometric series, and is given by 1/(1 - c) .
Block cellular automata
With a rule of the form {{1, 1} {1, 1}, {1, 0} {1, 0}, {0, 1} {0, 0}, {0, 0} {0, 1}} the evolution of a block cellular automaton with blocks of size n can be implemented using
BCAEvolveList[{n_Integer, rule_}, init_, t_] := FoldList[BCAStep[{n, rule}, #1, #2]&, init, Range[t]] /; Mod[Length[init], n] 0
BCAStep[{n_, rule_}, a_, d_] := RotateRight[ Flatten[Partition[RotateLeft[a, d], n]/.rule], d]
Starting with a single black cell, none of the k = 2 , n = 2 block cellular automata generate anything beyond simple nested patterns.
Since numbers can be factored uniquely into products of powers of primes, a number can be specified by a list in which 1's appear at the positions of the appropriate Prime[m] n (which can be sorted by size) and 0's appear elsewhere, as shown below.