Search NKS | Online
91 - 100 of 165 for FromDigits
(a) (Successive digits sequence) The sequence produced is repetitive, with the element at position n being black for n odd and white for n even. … (b) (Thue–Morse sequence) The color s[n] of the element at position n is given by 1 - Mod[DigitCount[n - 1, 2, 1], 2] . … The sequence on step t can be obtained from Nest[Join[#, 1 - #] &, {1}, t - 1] .
[Classes in] continuous cellular automata
In ordinary cellular automata, going from one rule to the next in a sequence involves some discrete change. … In fact, there is often a complicated set of transitions that depends more on the digit sequence of the parameter than its size.
Continued fractions
The first n terms in the continued fraction representation for a number x can be found from the built-in Mathematica function ContinuedFraction , or from
Floor[NestList[1/Mod[#, 1]&, x, n - 1]]
A rational approximation to the number x can be reconstructed from the continued fraction using FromContinuedFraction or by
Fold[(1/#1 + #2 )&, Last[list], Rest[Reverse[list]]]
The pictures below show the digit sequences of successive iterates obtained from NestList[1/Mod[#, 1]&, x, n] for several numbers x .
Unlike ordinary digits, the individual terms in a continued fraction can be of any size. … Numbers with digits given by concatenation sequences in any base k (see note above ) seem to have unusual continued fractions, in which most terms are fairly small, but some are extremely large.
Arithmetic coding
Consider dividing the interval from 0 to 1 into a succession of bins, with each bin having a width equal to the probability for some sequence of blocks to occur. The idea of arithmetic coding is to represent each such bin by the digit sequence of the shortest number within the bin—after trailing zeros have been dropped. For any sequence s this can be done using
Module[{c, m = 0}, Map[c[#] = {m, m += Count[s, #]/Length[s]} &, Union[s]]; Function[x, (First[RealDigits[2 # Ceiling[2 -# Min[x]], 2, -#, -1]] &)[Floor[Log[2, Max[x] - Min[x]]]]][ Fold[(Max[#1] - Min[#1]) c[#2] + Min[#1] &, {0, 1}, s]]]
Huffman coding of a sequence containing a single 0 block together with n 1 blocks will yield output of length about n ; arithmetic coding will yield length about Log[n] .
History [of Pascal's triangle mod k ]
Pascal's triangle probably dates from antiquity; it was known in China in the 1200s, and was discussed in some detail by Blaise Pascal in 1654, particularly in connection with probability theory. The digit-based approach to finding binomial coefficients modulo k has been invented independently many times since the mid-1800s, notably by Edouard Lucas in 1877 and James Glaisher in 1899.
Powers of three in base 2
The n th row in the pattern shown can be obtained simply as IntegerDigits[3 n , 2] . … Typical vertical columns have one obvious deviation from randomness: it is twice as probable for the same colors to occur on successive steps than for opposite colors. … The sequence Mod[3 n , 2 s ] obtained from the rightmost s digits corresponds to a simple linear congruential pseudorandom number generator.
In d dimensions (2d)^DigitCount[t, 2, 1] cells are black at step t . The fractal dimension of the (d + 1) -dimensional structure formed from all black cells is Log[2, 1 + 2d] .
Second-order cellular automata
Second-order elementary rules can be implemented using
CA2EvolveList[rule_List, {a_List, b_List}, t_Integer] := Map[First, NestList[CA2Step[rule, #]&, {a, b}, t]]
CA2Step[rule_List, {a_, b_}] := {b, Mod[a + rule 〚 8 - (RotateLeft[b] + 2 (b + 2 RotateRight[b])) 〛 , 2]}
where rule is obtained from the rule number using IntegerDigits[n, 2, 8] .
The combination Drop[list, -1] + 2 Drop[list, 1] of the result from CA2EvolveList corresponds to evolution according to a first-order k = 4 , r = 1 rule.
[No text on this page]
Universality in arithmetic, illustrated by an integer equation whose solutions in effect emulate the rule 110 universal cellular automaton from Chapter 11 . … If one fills in fixed values for x 1 , x 2 and x 3 , then only one value for x 4 is ever possible—corresponding to the evolution history of rule 110 for x 3 steps starting from a width x 1 initial condition given by the digit sequence of x 2 . … So from this it follows that in at least some instances the axioms of arithmetic can never be used to give a finite proof of whether or not the statement is true.
An example in computation theory is the concept emphasized by Gregory Chaitin of a number whose n th digit specifies whether a computation with initial condition n in a particular system will ever halt. This particular number is far from being computable (see page 1128 ), as a result of the undecidability of the halting problem (see page 754 ).