Search NKS | Online
51 - 60 of 210 for Listable
Thus, for example, rule 30 can be given as
{{1, 1, 1} 0, {1, 1, 0} 0, {1, 0, 1} 0, {1, 0, 0} 1, {0, 1, 1} 1, {0, 1, 0} 1, {0, 0, 1} 1, {0, 0, 0} 0}
To use rules in this form, CAStep can be rewritten as
CAStep[rule_, a_List] := Transpose[{RotateRight[a], a, RotateLeft[a]}] /. rule
or
CAStep[rule_, a_List] := Partition[a, 3, 1, 2] /. rule
The rules that are given can now contain patterns, so that rule 90, for example, can be written as
{{1, _, 1} 0, {1, _, 0} 1, {0, _, 1} 1, {0, _, 0} 0}
But how can one set up a program that can handle rules in several different forms? … Then, for example, one can define
CAStep[ElementaryCARule[rule_List], a_List] := rule 〚 8 - (RotateLeft[a] + 2 (a + 2 RotateRight[a])) 〛
CAStep[GeneralCARule[rule_, r_Integer:1], a_List] := Partition[a, 2r + 1, 1, r + 1] /. rule
CAStep[FunctionCARule[f_, r_Integer:1], a_List] := Map[f, Partition[a, 2r + 1, 1, r + 1]]
Note that the second two definitions have been generalized to allow rules that involve r neighbors on each side.
One-element-dependence tag systems [emulating TMs]
Writing the rule {3, {{0, _, _} {0, 0}, {1, _, _} {1, 1, 0, 1}}} from page 895 as {3, {0 {0, 0}, 1 {1, 1, 0, 1}}} the evolution of a tag system that depends only on its first element is obtained from
TS1EvolveList[rule_, init_, t_] := NestList[TS1Step[rule, #] &, init, t]
TS1Step[{n_, subs_}, {}] = {}
TS1Step[{n_, subs_}, list_] := Drop[Join[list, First[list] /. subs], n]
Given a Turing machine in the form used on page 888 the following will construct a tag system that emulates it:
TMToTS1[rules_] := {2, Union[Flatten[rules /.
Implementation [of 2D substitution systems]
With the rule on page 187 given for example by {1 {{1, 0}, {1, 1}}, 0 {{0, 0}, {0, 0}}} the result of t steps in the evolution of a 2D substitution system from a initial condition such as {{1}} is given by
SS2DEvolve[rule_, init_, t_] := Nest[Flatten2D[# /. rule] &, init, t]
Flatten2D[list_] := Apply[Join, Map[MapThread[Join, #] &, list]]
Given a sequence of length n , an approximation to h can be reconstructed using
Max[MapIndexed[#1/First[#2] &, FoldList[Plus, First[list], Rest[list]]]]
The fractional part of the result obtained is always an element of the Farey sequence
Union[Flatten[Table[a/b, {b, n}, {a, 0, b}]]]
(See also pages 892 , 932 and 1084 .)
Nested radicals
Given a list of integers acting like digits one can consider representing numbers in the form Fold[Sqrt[#1 + #2]&, 0, Reverse[list]] . … For any number x the first n digits are given by
Ceiling[NestList[(2 - Mod[-#, 1]) 2 &, x 2 , n - 1] - 2]
Even rational numbers such as 3/2 do not yield simple digit sequences.
Implementation [of patterning model]
Given a 2D array of values a and a list of weights w , each step in the evolution of the system corresponds to
WeightedStep[w_List, a_] := Map[If[# > 0, 1, 0]&, Sum[w 〚 1 + i 〛 Apply[Plus, Map[RotateLeft[a, #]&, Layer[i]]], {i, 0, Length[w] - 1}], {2}]
Layer[n_] := Layer[n] = Select[Flatten[Table[{i, j}, {i, -n, n}, {j, -n, n}],1], MemberQ[#, n| - n]&]
DNF minimization
From a table of values for a Boolean function one can immediately get a DNF representation just by listing cases where the value is 1. … To reduce the representation, one must introduce "don't care" elements _ ; in this example the final minimal form consists of the list of 3 so-called implicants {{1, 0, 0}, {0, 1, _}, {0, _, 1}} . … Given the original list s and the complete prime implicant list p the so-called Quine–McCluskey procedure can be used to find a minimal list of prime implicants, and thus a minimal DNF:
QM[s_, p_] := First[Sort[Map[p 〚 # 〛 &, h[{}, Range[Length[s]], Outer[MatchQ, s, p, 1]]]]]
h[i_, r_, t_] := Flatten[Map[h[Join[i, r 〚 # 〛 ], Drop[r, #], Delete[Drop[t, {}, #], Position[t 〚 All, # 〛 ], {True}]]] &, First[Sort[Position[#, True] &, t]]]], 1]
h[i_, _, {}] := {i}
The number of steps required in this procedure can increase exponentially with the length of p .
[Turing] machine 596440
For any list of initial colors init , it turns out that successive rows in the first t steps of the compressed evolution pattern turn out to be given by
NestList[Join[{0}, Mod[1 + Rest[FoldList[Plus, 0, #]], 2], {{0}, {1, 1, 0}} 〚 Mod[Apply[Plus, #], 2] + 1] 〛 &, init, t]
Inside the right-hand part of this pattern the cell values can then be obtained from an upside-down version of the rule 60 additive cellular automaton, and starting from a sequence of 1 's the picture below shows that a typical rule 60 nested pattern can be produced, at least in a limited region.
Negative bases
Given a suitable list of digits from 0 to k - 1 one can obtain any positive or negative number using FromDigits[list, -k] .
Neighbor-dependent [2D] substitution systems
Given a list of individual replacement rules such as {{_, 1}, {0, 1}} {{1, 0}, {1, 1}} , each step in the evolution shown corresponds to
Flatten2D[Partition[list, {2, 2}, 1, -1] /. rule]
One can consider rules in which some replacements lead to subdivision of elements but others do not.