Biased Radix

Normal radix n numerals for reals partition a unit interval into n equal sub-intervals and use the first digit beyond the decimal point, d1, to determine which of those the number is in. Likewise that sub-interval is partitioned into n sub-sub intervals and d2 chooses one of those. This continues indefinitely.

Now we let n=2. One approach to biased bits is to modify the concept of binary fractions thus: X is in [0, ⅔] if b1 is 0 and in [⅔, 1] otherwise. Now we have one of two disjoint sub-intervals of [0, 1] and b2 chooses between the first two thirds and last third of one of those sub-intervals and we have 4 sub-sub-intervals: [0, 4/9], [4/9, ⅔], [⅔, 8/9], [8/9, 1]. And so forth. It is clear that if X is chosen uniformly in [0, 1] then each of the bits in this altered representation has expected value ⅓.

It seems that ½ in this biased base is not repeating.
½ = .01000101001011011000000010000100100000110110100000001000011
When E('1') = ¼
½ = .001001110000010011000010110000011010011000000000000011000000001
Most peculiar.

If you choose a real in the unit interval and take its unbiased binary representation, and interpret that representation as biased and convert back to a real, we have a continuous monotonic function, differentiable almost everywhere, but it does not preserve measure.

This stuff bears on Arithmetic coding. The function of the previous paragraph decompresses a density E('1') bit string most efficiently, and of course, its inverse compresses it.

Using the value BiasBin described here we can make some notes on several fields. ((fileVal "BiasBin") b) produces a pair of functions converting a number to or from biased binary with expected value of bits = b.

(define fp ((fileVal "BiasBin") 1/3))
(define tb (car fp))
(define fb (cdr fp))
(tb x n) yields n ‘bits’ of x as an improper list; the unconverted value at the end terminates the ‘list’ instead of nil.
(tb 1/2 65)
yields:
(0 1 0 0 0 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 1 1 0 1 1 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 1 . 39823294924651/70368744177664)
which agrees with our C program.

Mixed Bias Conversion

(define C (fileVal "BiasBin"))
(define (mr x) ((cdr (C 1/3)) ((car (C 1/2)) x 60)))
mr above is a continuous monotonic increasing function from the unit interval onto itself; and so thus is its inverse.