Fractals/Mathematics/doubling

=Definition=

Angle doubling map


 * $$T(r) = (2 r) \bmod 1$$

Input: proper fraction $$r $$ in forms
 * decimal ratio ( if r is not irrational )
 * decimal sequence of digits and radix
 * binary sequence of digits and radix

Output: proper fraction

=Doubling map on binary fraction= Effect of doubling map d on binary representation of fraction x is to simply shift the bits of x to the left, discarding the bit that shifted into the ones place = left shift.

$$ x = 0.b_1 b_2 b_3\dots. $$

$$ d(x) = 0.b_2 b_3\dots. $$

Example
 * $$2*\frac{11}{31} = 2 * 0.01011 = 0.10110 = \frac{22}{31} $$

=Orbits= Iteration of the map gives orbit ( sequence of angles):
 * periodic ( input is a rational number with odd denominator $$d = 2^p - 1$$)
 * preperiodic ( input is rational number with even denominator )
 * aperiodic ( when input is irrational number )

All above types are infinite. Finite binary expansion has equal infinite preperiodic representation.

periodic
Periodic orbits of angles under doubling map

Note that here chord joining 2 points z1 and z2 on unit circle means that $$z_2 = z_1^2$$. It does not mean that these points are landing points of the same ray.

Some orbits do not cross :

Periodic orbits for angles $$ r = \frac{n}{d} $$ with odd denominator d

$$r = \frac{n}{d} = \frac{n}{2^p - 1}$$ Where:
 * n is numerator of the fraction = integer from 0 to (d-1)
 * d is denominator of the fraction = positive integer
 * p is a period = positive integer

Period 1 ( 1 orbit) for angles = $$\frac{n}{2^1 - 1} = \frac{n}{1} $$

{0/1 = 1/1 }

Period 2 ( 1 orbit) for angles = $$\frac{n}{2^2 - 1} = \frac{n}{3} $$

{1/3, 2/3}

Period 3 ( 2 orbits) for angles = $$\frac{n}{2^3 - 1} = \frac{n}{7} $$

{1/7, 2/7, 4/7 } {3/7, 6/7, 5/7 }

Period 4 ( 3 orbits) for angles = $$\frac{n}{2^4 - 1} = \frac{n}{15} $$

{1/15, 2/15,  4/15,  8/15 } {3/15,  6/15, 12/15,  9/15 } {7/15, 14/15, 13/15, 11/15 } Period 5 ( 6 orbits) for angles = $$\frac{n}{2^5 - 1} = \frac{n}{31} $$

{ 1/31, 2/31,  4/31,  8/31, 16/31} { 3/31,  6/31, 12/31, 24/31, 17/31} { 5/31, 10/31, 20/31,  9/31, 18/31} { 7/31, 14/31, 28/31, 25/31, 19/31} {11/31, 22/31, 13/31, 26/31, 21/31} {15/31, 30/31, 29/31, 27/31, 23/31}

Period 6 ( 9 orbits ) for angles = $$\frac{n}{2^6 - 1} = \frac{n}{63} $$, only numerators

{ 1, 2, 4, 8,16,32} { 3, 6,12,24,48,33} { 5,10,20,40,17,34} { 7,14,28,56,49,35} [11,22,44,25,50,37} [13,26,52,41,19,38} [15,30,60,57,51,39} [23,46,29,58,53,43] [31,62,61,59,55,47]

Period = 7 for angles = $$\frac{n}{2^7 - 1} = \frac{n}{127} $$

Period = 8 for angles = $$\frac{n}{2^8 - 1} = \frac{n}{255} $$

Period = 9 for angles = $$\frac{n}{2^9 - 1} = \frac{n}{511} $$

See also
 * external ray for root points ( bond point) on the parameter plane:
 * wake
 * subwake
 * island = midget = mini Mandelbrot set
 * dynamic plane
 * external rays that land on the parabolic fixed point . ( first angle is angle of the wake)

preperiodic
Here denominator d of fraction r


 * $$r = \frac{n}{d}$$

is even:


 * $$d = 2^tq$$

and q is odd.

Here
 * t is preperiod

Example orbits:

Preperiod 1 and period 1 for angles $$\frac{n}{2}$$

{1/2, (0/2)}

See
 * Misiurewicz points on the parameter plane
 * Dendrite Julia sets on the dynamic plane

aperiodic


Compare
 * Siegel disc
 * Herman rings ( rational maps)

= Implementations =
 * integer:
 * 2 integers ( numerator and denominator)
 * rational number
 * mpq type from GMP library
 * floating point
 * double

Forward

 * Using 32bit signed int limits maximum preperiod to about 30
 * Using double for fractions limits maximum number of accurate bits to about 53

C using double numbers

 * using double gives precision of 53 bits of binary number expansion (the number of bits of accuracy of double precision floating point)

C using rational type mpq from GMP library ( arbitrary precision)
C function (using GMP library) :

Compile: gcc r.c -lgmp

run ./a.out

result:

a rational number 1 / 6 is in a canonical form ( decimal fraction) : 1/6 numerator of rational number = 1 denominator of rational number = 6 binary rational ( string ) : 1/110 decimal floating point number : 0.166666666666666666667 mantissa of binary floating ( string ) : 101010101010101010101010101010101010101010101010101010101010101011 exponent : -2 binary floatin in exponential form =0.101010101010101010101010101010101010101010101010101010101010101011*2^-2

Maxima CAS

 * Maxima CAS function using numerator and denominator as an input

doubling_map(n,d):=mod(2*n,d)/d $

or using rational number as an input

DoublingMap(r):= block([d,n],        n:ratnumer(r),         d:ratdenom(r),         mod(2*n,d)/d)$

Haskell
Haskell function

Inverse function of doubling map
Every angle α ∈ R/Z measured in turns has:
 * one image = 2α mod 1 under doubling map
 * "two preimages under the doubling map: α/2 and (α + 1)/2.". Inverse of doubling map is multivalued function.

In Maxima CAS:

InvDoublingMap(r):= [r/2, (r+1)/2];

Note that difference between these 2 preimages


 * $$\frac{\alpha}{2} - \frac{\alpha +1}{2} = \frac{1}{2}$$

is half a turn = 180 degrees = Pi radians.

=Q&A=

analysis

 * find expansion type
 * find preperiod and period
 * convert decimal fraction to binary expansion
 * format the expansion

How to find expansion type
Binary expansion of decimal fraction

How to find preperiod and period ?

 * Period and the doubling map

How to find the period of angle under doubling map
 * visual
 * numerical
 * read period from denominator of decimal fraction ( reduced rational fraction m/n )
 * find period/preperiod in the binary expansion ( binary sequence)
 * string matching algorithms, for instance, naive or brute-force search, Knuth-Morris-Pratt algorithm
 * discrete Fourier transform
 * read it from the itinerary of angle under doubling map

Period of binary expansion of reduced rational fraction m/n is equal to the multiplicative order of 2 modulo n:

$$ Period_2(m/n) = {ord}_n(2)$$

Maxima CAS version
DoublingMap(r):= block([d,n], n:ratnumer(r), d:ratdenom(r), mod(2*n,d)/d)$

/* Tests : GivePeriod (1/7) 3 GivePeriod (1/14) 0 GivePeriod (1/32767) 15 GivePeriod (65533/65535) 16

Gives 0 if :
 * not periodic ( preperiodic )
 * period >pMax

GivePeriod (r):= block([rNew, rOld, period, pMax, p],     pMax:100,      period:0,      p:1,       rNew:DoublingMap(r),      while ((p<pMax) and notequal(rNew,r)) do        (rOld:rNew, rNew:DoublingMap(rOld), p:p+1 ),     if equal(rNew,r) then period:p,      period );

Haskell version
Haskell version

Conversion from an integer type (Int or Integer) to anything else is done by "fromIntegral". The target type is inferred automatically

conversion

 * Convert binary fraction to decimal ratio
 * convert decimal fraction to binary
 * knowledgedoor calculators

Can all decimal fractions be converted exactly to binary?
Not all. Only those for which denominator is a power of 2 ( finite ) have exact decimal representation. "In every other case, there will be an error in the representation. The error's magnitude depends on the number of digits used to represent it."

precision
What number type precision do I need for computing doubling map?
 * "the doubling map loses one bit of precision with every iterate."
 * storing the angle as an exact rational (e.g. mpq_t using libgmp), allows it to be accurate for more than 53 iterations (the number of bits of accuracy of double precision floating point). Convert to double only when needing to do sin and cos for finding the target point.  Double is plenty accurate for target point. Claude Heiland-Allen

=See also=
 * binary fraction

=References=