Search NKS | Online
1 - 10 of 16 for Split
And the underlying rule is then typically set up so that under certain circumstances an active cell can split in two, or can disappear entirely.
… But in some cases, it specifies that the active cell should split in two, thereby creating an additional active cell.
Starting from the trunk at the bottom, the rules specify that at each step every branch of a particular color should split into smaller branches in the same way.
And with this setup the idea is to start from the trunk of the tree, and then at each step to use the rules for the substitution system to determine how every branch should be split into smaller branches.
Run-length encoding
Data can be converted to run lengths by Map[Length, Split[data]] .
The sequence {1, 2, 2, 1, 1, 2, …} defined by the property list Map[Length, Split[list]] was suggested as a mathematical puzzle by William Kolakoski in 1965 and is equivalent to
Join[{1, 2}, Map[First, CTEvolveList[{{1}, {2}}, {2}, t]]]
It is known that this sequence does not repeat, contains no more than two identical consecutive blocks, and has at least very close to equal numbers of 1's and 2's.
Iterated run-length encoding
Starting say with {1} consider repeatedly replacing list by (see page 1070 )
Flatten[Map[{Length[#], First[#]} &, Split[list]]]
The resulting sequences contain only the numbers 1, 2 and 3, but otherwise at first appear fairly random.
Simple examples in Mathematica include:
First[Prepend[p, q]] === q
Join[Join[p, q], r] === Join[p, Join[q, r]]
Partition[Union[p], 1] === Split[Union[p]]
One can set up axiom systems say by combining definitions of programming languages with predicate logic (as done by John McCarthy for Lisp in 1963).
Corresponding to the result on page 870 for rule 90, the number of black cells at row t in the pattern from rule 150 is given by
Apply[Times, Map[(2 # + 2 - (-1) # + 2 )/3 &, Cases[Split[IntegerDigits[t, 2]], k:{1 ..} Length[k]]]]
There are a total of 2 m Fibonacci[m+2] black cells in the pattern obtained up to step 2 m , implying fractal dimension Log[2, 1 + Sqrt[5]] .
With this setup, each step then corresponds to
LifeStep[list_] := With[{p=Flatten[Array[List, {3, 3}, -1], 1]}, With[{u = Split[Sort[Flatten[Outer[Plus, list, p, 1], 1]]]}, Union[Cases[u, {x_, _, _} x], Intersection[Cases[u, {x_, _, _, _} x], list]]]]
(A still more efficient implementation is based on finding runs of length 3 and 4 in Sort[u] .)
For any input x one can test whether the machine will ever halt using
u[{Reverse[IntegerDigits[x, 2]], 0}]
u[list_] := v[Split[Flatten[list]]]
v[{a_, b_: {}, c_: {}, d_: {}, e_: {}, f_: {}, g___}] := Which[a == {1} || First[a] 0, True, c {}, False, EvenQ[Length[b]], u[{a, 1 - b, c, d, e, f, g}], EvenQ[Length[c]], u[{a, 1 - b, c, 1, Rest[d], e, f, g, 0}], e {} || Length[d] ≥ Length[b] + Length[a] - 2, True, EvenQ[Length[e]], u[{a, b , c, d, f, g}], True, u[{a, 1 - b, c, 1 - d, e, 1, Rest[f], g, 0}]]
This test takes at most n/3 recursive steps, even though the original machine can take of order n 2 steps to halt.