Notes

Chapter 3: The World of Simple Programs

Section 5: Substitution Systems


Implementation [of substitution systems]

The rule for a neighbor-independent substitution system such as the first one on page 82 can conveniently be given as {1{1, 0}, 0 {0, 1}}. And with this representation, the evolution for t steps is given by

SSEvolveList[rule_, init_List, t_Integer] := NestList[Flatten[# /. rule]&, init, t]

where in the first example on page 82, the initial condition is {1}.

An alternative approach is to use strings, representing the rule by {"B""BA", "A""AB"} and the initial condition by "B". In this case, the evolution can be obtained using

SSEvolveList[rule_, init_String, t_Integer] := NestList[StringReplace[#, rule]&, init, t]

For a neighbor-dependent substitution system such as the first one on page 85 the rule can be given as

{{1, 1} {0, 1}, {1, 0} {1, 0}, {0, 1} {0}, {0, 0} {0, 1}}

And with this representation, the evolution for t steps is given by

SS2EvolveList[rule_, init_List, t_Integer] := NestList[Flatten[Partition[#, 2, 1] /. rule]&, init, t]

where the initial condition for the first example on page 85 is {0, 1, 1, 0}.



Image Source Notebooks:

From Stephen Wolfram: A New Kind of Science [citation]