Search NKS | Online
1 - 10 of 255 for Apply
One approach suggested by the idea of combinators from the 1920s is to consider expressions with forms such as e[e[e][e]][e][e] and then to make transformations on these by repeatedly applying rules such as e[x_][y_] x[x[y]] , where x_ and y_ stand for any expression.
… At each step the transformation is done by scanning once from left to right, and applying the rule wherever possible without overlapping.
… This transformation corresponds to applying the basic Mathematica operation expression /. rule .
The pictures at the bottom of the previous page show what happens when one applies run-length encoding using representation (e) from page 560 to various sequences of data. … The pictures below show the results of applying run-length encoding to typical patterns produced by cellular automata. … Examples of applying run-length encoding to patterns produced by cellular automata.
The picture is obtained by applying the simple rule shown for a total of 150 steps, starting with a single black cell.
The general idea of building up patterns by repeatedly applying geometrical rules is at the heart of so-called fractal geometry. … Note that in applying the rule to a particular square, one must take account of the orientation of that square.
particular string, then at each successive step one applies all possible transformations, so that in the end one builds up a whole network of connections between strings, as in the pictures below.
… One might at first assume that any theorem that is easy
The result of applying the same transformations as on the facing page —but in all possible ways, corresponding to the evolution of a multiway system that represents all possible theorems that can be derived from the axioms.
At each step, the whole string is scanned once to try to apply the first replacement, and is then scanned again if necessary to try to apply the second replacement.
JPEG compression
In common use since the early 1990s JPEG compression works by first assigning color values to definite bins, then applying a discrete Fourier cosine transform, then applying Huffman encoding to the resulting weights.
Recursive subdivision [encoding]
In one dimension, encoding can be done using
Subdivide[a_] := Flatten[ If[Length[a] 2, a, If[Apply[SameQ, a], {1,First[a]}, {0, Map[Subdivide, Partition[a, Length[a]/2]]}]]]
In n dimensions, it can be done using
Subdivide[a_, n_] := With[{s = Table[1, {n}]}, Flatten[ If[Dimensions[a] 2s, a, If[Apply[SameQ, Flatten[a]], {1, First[Flatten[a]]}, {0, Map[Subdivide[#, n] &, Partition[a, 1/2Length[a] s], {n}]}]]]]
Note that to generate the pictures that follow requires applying the underlying cellular automaton rule for individual cells a total of about 12 million times.
Note that to generate the pictures that follow requires applying the underlying cellular automaton rule for individual cells a total of about 12 million times.