• Source: Optimal radix choice
    • In mathematics and computer science, optimal radix choice is the problem of choosing the base, or radix, that is best suited for representing numbers. Various proposals have been made to quantify the relative costs of using different radices in representing numbers, especially in computer systems. One formula is the number of digits needed to express it in that base, multiplied by the base (the number of possible values each digit could have). This expression also arises in questions regarding organizational structure, networking, and other fields.


      Definition


      The cost of representing a number N in a given base b can be defined as




      E
      (
      b
      ,
      N
      )
      =
      b


      log

      b



      (
      N
      )
      +
      1




      {\displaystyle E(b,N)=b\lfloor \log _{b}(N)+1\rfloor \,}


      where we use the floor function







      {\displaystyle \lfloor \rfloor }

      and the base-b logarithm




      log

      b




      {\displaystyle \log _{b}}

      .
      If both b and N are positive integers, then the quantity



      E
      (
      b
      ,
      N
      )


      {\displaystyle E(b,N)}

      is equal to the number of digits needed to express the number N in base b, multiplied by base b. This quantity thus measures the cost of storing or processing the number N in base b if the cost of each "digit" is proportional to b. A base with a lower average



      E
      (
      b
      ,
      N
      )


      {\displaystyle E(b,N)}

      is therefore, in some senses, more efficient than a base with a higher average value.
      For example, 100 in decimal has three digits, so its cost of representation is 10×3 = 30, while its binary representation has seven digits (11001002), so the analogous calculation gives 2×7 = 14. Likewise, in base 3 its representation has five digits (102013), for a value of 3×5 = 15, and in base 36 (2S36) one finds 36×2 = 72.
      If the number is imagined to be represented by a combination lock or a tally counter, in which each wheel has b digit faces, from



      0
      ,
      1
      ,
      .
      .
      .
      ,
      b

      1


      {\displaystyle 0,1,...,b-1}

      and having





      log

      b



      (
      N
      )
      +
      1



      {\displaystyle \lfloor \log _{b}(N)+1\rfloor }

      wheels, then



      E
      (
      b
      ,
      N
      )


      {\displaystyle E(b,N)}

      is the total number of digit faces needed to inclusively represent any integer from 0 to N.


      Asymptotic behavior


      The quantity



      E
      (
      b
      ,
      N
      )


      {\displaystyle E(b,N)}

      for large N can be approximated as follows:




      E
      (
      b
      ,
      N
      )
      =
      b


      log

      b



      (
      N
      )
      +
      1


      b


      log

      b



      (
      N
      )
      =


      b

      ln

      (
      b
      )



      ln

      (
      N
      )
      .


      {\displaystyle E(b,N)=b\lfloor \log _{b}(N)+1\rfloor \sim b\ \log _{b}(N)={b \over \ln(b)}\ln(N).}








      E
      (
      b
      ,
      N
      )


      ln

      (
      N
      )






      b

      ln

      (
      b
      )



      .


      {\displaystyle {E(b,N) \over \ln(N)}\sim {b \over \ln(b)}.}


      The asymptotically best value is obtained for base 3, since




      b


      ln

      (
      b
      )



      {\displaystyle b \over \ln(b)}

      attains a minimum for



      b
      =
      3


      {\displaystyle b=3}

      in the positive integers:






      2

      ln

      (
      2
      )




      2.88539

      ,


      {\displaystyle {2 \over \ln(2)}\approx 2.88539\,,}







      3

      ln

      (
      3
      )




      2.73072

      ,


      {\displaystyle {3 \over \ln(3)}\approx 2.73072\,,}







      4

      ln

      (
      4
      )




      2.88539

      .


      {\displaystyle {4 \over \ln(4)}\approx 2.88539\,.}


      For base 10, we have:






      10

      ln

      (
      10
      )




      4.34294

      .


      {\displaystyle {10 \over \ln(10)}\approx 4.34294\,.}



      Comparing different bases


      The values of



      E
      (
      b
      ,
      N
      )


      {\displaystyle E(b,N)}

      of bases b1 and b2 may be compared for a large value of N:







      E
      (

      b

      1


      ,
      N
      )


      E
      (

      b

      2


      ,
      N
      )








      b

      1




      log


      b

      1





      (
      N
      )




      b

      2




      log


      b

      2





      (
      N
      )




      =



      (





      b

      1


      ln

      (
      N
      )


      ln

      (

      b

      1


      )




      )


      (





      b

      2


      ln

      (
      N
      )


      ln

      (

      b

      2


      )




      )



      =




      b

      1


      ln

      (

      b

      2


      )



      b

      2


      ln

      (

      b

      1


      )




      .


      {\displaystyle {{E(b_{1},N)} \over {E(b_{2},N)}}\approx {{b_{1}{\log _{b_{1}}(N)}} \over {b_{2}{\log _{b_{2}}(N)}}}={\left({\dfrac {b_{1}\ln(N)}{\ln(b_{1})}}\right) \over \left({\dfrac {b_{2}\ln(N)}{\ln(b_{2})}}\right)}={{b_{1}\ln(b_{2})} \over {b_{2}\ln(b_{1})}}\,.}


      Choosing e for b2 gives







      E
      (
      b
      )


      E
      (
      e
      )







      b
      ln

      (
      e
      )


      e
      ln

      (
      b
      )



      =



      b


      e
      ln

      (
      b
      )




      .


      {\displaystyle {{E(b)} \over {E(e)}}\approx {{b\ln(e)} \over {e\ln(b)}}={{b} \over {e\ln(b)}}\,.}


      The average



      E
      (
      b
      ,
      N
      )


      {\displaystyle E(b,N)}

      of various bases up to several arbitrary numbers (avoiding proximity to powers of 2 through 12 and e) are given in the table below. Also shown are the values relative to that of base e.



      E
      (
      1
      ,
      N
      )


      {\displaystyle E(1,N)}

      of any number



      N


      {\displaystyle N}

      is just



      N


      {\displaystyle N}

      , making unary the most economical for the first few integers, but this no longer holds as N climbs to infinity.


      Ternary tree efficiency


      One result of the relative economy of base 3 is that ternary search trees offer an efficient strategy for retrieving elements of a database. A similar analysis suggests that the optimum design of a large telephone menu system to minimise the number of menu choices that the average customer must listen to (i.e. the product of the number of choices per menu and the number of menu levels) is to have three choices per menu.
      In a d-ary heap, a priority queue data structure based on d-ary trees, the worst-case number of comparisons per operation in a heap containing



      n


      {\displaystyle n}

      elements is



      d

      log

      d



      n


      {\displaystyle d\log _{d}n}

      (up to lower-order terms), the same formula used above. It has been suggested that choosing



      d
      =
      3


      {\displaystyle d=3}

      or



      d
      =
      4


      {\displaystyle d=4}

      may offer optimal performance in practice.
      Brian Hayes suggests that



      E
      (
      b
      ,
      N
      )


      {\displaystyle E(b,N)}

      may be the appropriate measure for the complexity of an Interactive voice response menu: in a tree-structured phone menu with



      n


      {\displaystyle n}

      outcomes and



      r


      {\displaystyle r}

      choices per step, the time to traverse the menu is proportional to the product of



      r


      {\displaystyle r}

      (the time to present the choices at each step) with




      log

      r



      n


      {\displaystyle \log _{r}n}

      (the number of choices that need to be made to determine the outcome). From this analysis, the optimal number of choices per step in such a menu is three.


      Computer hardware efficiencies


      The 1950 reference High-Speed Computing Devices describes a particular situation using contemporary technology. Each digit of a number would be stored as the state of a ring counter composed of several triodes. Whether vacuum tubes or thyratrons, the triodes were the most expensive part of a counter. For small radices r less than about 7, a single digit required r triodes. (Larger radices required 2r triodes arranged as r flip-flops, as in ENIAC's decimal counters.)
      So the number of triodes in a numerical register with n digits was rn. In order to represent numbers up to 106, the following numbers of tubes were needed:

      The authors conclude,

      Under these assumptions, the radix 3, on the average, is the most economical choice, closely followed by radices 2 and 4. These assumptions are, of course, only approximately valid, and the choice of 2 as a radix is frequently justified on more complete analysis. Even with the optimistic assumption that 10 triodes will yield a decimal ring, radix 10 leads to about one and one-half times the complexity of radix 2, 3, or 4. This is probably significant despite the shallow nature of the argument used here.


      See also


      Ternary computer
      List of numeral systems


      References




      Further reading


      S.L. Hurst, "Multiple-Valued Logic-Its Status and its Future", IEEE trans. computers, Vol. C-33, No 12, pp. 1160–1179, DEC 1984.
      J. T. Butler, "Multiple-Valued Logic in VLSI Design, ” IEEE Computer Society Press Technology Series, 1991.
      C.M. Allen, D.D. Givone “The Allen-Givone Implementation Oriented Algebra", in Computer Science and Multiple-Valued Logic: Theory and Applications, D.C. Rine, second edition, D.C. Rine, ed., The Elsevier North-Holland, New York, N.Y., 1984. pp. 268–288.
      G. Abraham, "Multiple-Valued Negative Resistance Integrated Circuits", in Computer Science and Multiple-Valued Logic: Theory and Applications, D.C. Rine, second edition, D.C. Rine, ed., The Elsevier North-Holland, New York, N.Y., 1984. pp. 394–446.

    Kata Kunci Pencarian: