Search NKS | Online

121 - 130 of 255 for Apply
Each arrow indicates an equivalence established by applying a single axiom.
Now each successive person in each successive row determines the color of the card they hold up by looking at the person directly above them, and above them immediately to their left and right, and then applying the simple rule on page 27 .
Such interfaces work well if what one wants is basically to take a single object and apply operations to it.
For somehow there also has to be a way to store arbitrarily large amounts of data—and to apply suitable combinations of Nand operations to it.
f[n_] := n f[n - 1]; f[1] = 1 f[n_] := Product[i, {i, n}] f[n_] := Module[{t = 1}, Do[t = t i, {i, n}]; t] f[n_] := Module[{t = 1, i}, For[i = 1, i ≤ n, i++, t ⋆ = i]; t] f[n_] := Apply[Times, Range[n]] f[n_] := Fold[Times, 1, Range[n]] f[n_] := If[n  1, 1, n f[n - 1]] f[n_] := Fold[#2[#1] &, 1, Array[Function[t, # t] &, n]] f = If[#1  1, 1, #1 #0[#1 - 1]] &
Implementation [of tag systems] With the rules for case (a) on page 94 given for example by {2, {{0, 0}  {1, 1}, {1, 0}  {}, {0, 1}  {1, 0}, {1, 1}  {0, 0, 0}}} the evolution of a tag system can be obtained from TSEvolveList[{n_, rule_}, init_, t_] := NestList[If[Length[#] < n, {}, Join[Drop[#, n], Take[#, n] /. rule]]&, init, t] An alternative implementation is based on applying to the list at each step rules such as {{0, 0, s___}  {s, 1, 1}, {1, 0, s___}  {s}, {0, 1, s___}  {s, 1, 0}, {1, 1, s___}  {s, 0, 0, 0}} There are a total of ((k r + 1 - 1)/(k - 1)) k n possible rules if blocks up to length r can be added at each step and k colors are allowed.
An explicit formula for the n th term in each sequence can be found by solving the algebraic equation obtained by applying the replacement f[m_]  t m to the recurrence relation.
Then the rules for the language consisting of balanced runs of parentheses (see page 939 ) can be written as {s[e]  s[e, e], s[e]  s["(", e, ")"], s[e]  s["(",")"]} Different expressions in the language can be obtained by applying different sequences of these rules, say using (this gives so-called leftmost derivations) Fold[# /. rules 〚 #2 〛 &, s[e], list] Given an expression, one can then use the following to find a list of rules that will generate it—if this exists: Parse[rules_, expr_] := Catch[Block[{t = {}}, NestWhile[ ReplaceList[#, MapIndexed[ReverseRule, rules]] &, {{expr, {}}}, (# /. … = {}) &];]] ReverseRule[a_  b_, {i_}] := {___, {s[x___, b, y___], {u___}}, ___}  {s[x, a, y], {i, u}} /; FreeQ[s[x], s[a]] In general, there will in principle be more than one such list, and to pick the appropriate list in a practical situation one normally takes the rules of the language to apply with a certain precedence—which is how, for example, x + y z comes to be interpreted in Mathematica as Plus[x, Times[y, z]] rather than Times[Plus[x, y], z] .
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]] .
As discussed on page 903 this sequence can be generated by applying substitution rules derived from the continued fraction form of h .
1 ... 10111213 ...