Search NKS | Online

1 - 10 of 165 for FromDigits
Specifying an operator f (taken in general to have n arguments with k possible values) by giving the rule number u for f[p, q, …] , the rule number for an expression with variables vars can be obtained from With[{m = Length[vars]}, FromDigits[ Block[{f = Reverse[IntegerDigits[u, k, k n ]] 〚 FromDigits[ {##}, k] + 1 〛 &}, Apply[Function[Evaluate[vars], expr], Reverse[Array[IntegerDigits[# - 1, k, m] &, k m ]], {1}]], k]]
Implementation of digit sequences A whole number n can be converted to a sequence of digits in base k using IntegerDigits[n,k] or (see also page 1094 ) Reverse[Mod[NestWhileList[Floor[#/k] &, n, # ≥ k &], k]] and from a sequence of digits using FromDigits[list,k] or Fold[k #1 + #2 &, 0, list] For a number x between 0 and 1, the first m digits in its digit sequence in base k are given by RealDigits[x, k, m] or Floor[k NestList[Mod[k #, 1]&, x, m - 1]] and from these digits one can reconstruct an approximation to the number using FromDigits[{list, 0}, k] or Fold[#1/k + #2 &, 0, Reverse[list]]/k
Digit reversal Sequences of the form Table[FromDigits[ Reverse[IntegerDigits[n, k, m]], k], {n, 0, k m - 1}] shown below appear in algorithms such as the fast Fourier transform and, with different values of k for different coordinates, in certain quasi-Monte Carlo schemes.
[Universal] recursive functions The general recursive functions from page 907 provided an early example of universality (see page 907 ). … With the state of a 2-color tag system encoded as an integer according to FromDigits[Reverse[list] + 1, 3] the following takes the rule for any such tag system (in the first form from page 894 ) and yields a primitive recursive function that emulates a single step in its evolution: TSToPR[{n_, rule_}] := Fold[Apply[c, Flatten[{#1, Array[p, # 2], c[r[z, c[r[p[1], s], c[r[z, p[2]], c[r[z, r[c[s, z], c[r[c[s, c[s, z]], z], p[2]]]], p[2]]], p[1]]], p[#2]]}]] & , c[c[r[p[1], s], p[1], c[r[p[1], r[z, c[s, c[s, s]]]], c[c[r[z, c[r[p[1], s], c[r[z, c[s, z]], c[r[p[1], r[z, c[r[p[1], s], c[r[z, p[2]], c[ r[z, r[c[s, z], c[r[c[s, c[s, z]], z], p[2]]]], p[2]]], p[1]]]], p[2], p[3]]], p[1]]], p[1], p[1]], p[1]], p[2]]], p[n + 1], MapIndexed[c[r[z, c[r[p[1], p[4]], p[2], p[3], p[4]]], c[r[z, r[c[s, z], c[r[c[s, c[s, z]], z], p[2]]]], p[Length[#2] + 1]], # 1 〚 1 〛 , #1 〚 2 〛 ] & , Nest[Partition[#1, 2] & , Table[Nest[c[s, #] & z, FromDigits[Reverse[IntegerDigits[i, 2, n] /. rule] + 1, 3]], {i, 0, 2 n - 1}], n - 1], {0, n - 1}]], Range[n, 1, -1]] (For tag system (a) from page 94 this yields a primitive recursive function of size 325.) … Note that the same basic approach can be used to emulate Turing machines with recursive functions; the Turing machine configuration {s, list, n} can be encoded by an integer such as 2^FromDigits[Reverse[Take[list, n - 1]]] 3^FromDigits[Take[list, {n + 1, -1}]] 5^list 〚 n 〛 7 s
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] . The picture below shows the digit sequences of successive numbers in base -2; the row j from the bottom turns out to consist of alternating black and white blocks of length 2 j . (In ordinary base 2 a number -n can be represented as on a typical electronic computer by complementing each digit, including leading 0's.)
The idea of representing a number by a sequence of digits is familiar from everyday life: indeed, our standard way of writing numbers corresponds exactly to giving their digit sequences in base 10. … The most familiar case is base 10, where starting from the right successive digits correspond to units, tens, hundreds and so on. … And in this base, successive digits starting from the right have coefficients 1 , 2 , 4 = 2×2 , 8 = 2×2×2 , etc.
Connection [of geometric substitution systems] with digit sequences Patterns after t steps can be viewed as containing all t -digit integers in an appropriate complex base. Thus the patterns on page 189 can be formed from t -digit integers in base  - 1 containing only digits 0 and 1, as given by Table[FromDigits[IntegerDigits[s, 2, t],  - 1], {s, 0, 2 t -1}] In the particular case of base  - q with digits 0 through q 2 , it turns out that for sufficiently large t any complex integer can be represented, and will therefore be part of the pattern.
[No text on this page] Examples of iterated maps starting from simple initial conditions. … In case (c), the digit sequences are complicated but the sizes of the numbers tend rapidly to zero. … Note that in the pictures above each horizontal row of digits corresponds to a number, and that digits further to the left contribute progressively more to the size of this number.
The procedure works by looking at the base 2 digit sequences of the coordinates. If any digit in the y coordinate of a particular square is 0 when the corresponding digit in the x coordinate is 1 then the square is white; otherwise it is black. … Starting from the black square, one follows the sequence of connections that corresponds to the successive digits that one encounters in the y and x coordinates.
But as soon as one even allows trigonometric functions, for example, it turns out that it becomes possible to construct equations for which finding a solution is equivalent to finding Results from mathematical operations on numbers with similar digit sequences. Each successive line in each picture gives the digit sequence obtained by using a value of x in which one successive digit has been reversed. The top row of pictures start from the repetitive base 2 digit sequence of x=3/5 ; the bottom row of pictures from x=π/4 .
1 ...