CoCalc lets you use Linux, Python, LaTeX, Jupyter notebooks and much more in your browser! Pivately share with collaborators. Changes are synchronized in realtime.
SharedPeriodicity.ipynbOpen in CoCalc


We consider the doubling map on the circle R/Z\mathbb{R}/\mathbb{Z}:

D(x) = 2*x - floor(2*x)
x  2x2xx \ {\mapsto}\ 2 \, x - \left \lfloor 2 \, x \right \rfloor

Some example applications:


Here we plot the function over the interval (0,1):

plot(D,(x,0,1), aspect_ratio=1)

As a remark, we can get rid of those vertical lines (which arise because Sage doesn't realize that the function is not continuous) using the exclude parameter:

plot(D,(x,0,1), aspect_ratio=1, exclude=[1/2,1])
# exclude corrects the plotting for discontinuities
def forward_orbit(x, T, N):
    Return the list [x, T(x), ..., T^N(x)].
    orbit = [x] # Start of the orbit.
    y = x
    for i in range(N):
        y = T(y) # Redefine y to be T(y)
        orbit.append(y) # Add y at the end of the orbit.
    return orbit

Recall that a fixed point of DD is a value xx so that D(x)=xD(x)=x. Zero is a fixed point:


A periodic point of DD is a point xx so that Dk(p)=pD^k(p)=p for some k1k \geq 1. The least period (or prime period) of pp is the smallest such kk. We say xx has period kk if Dk(x)=xD^k(x)=x.

The number 13\frac{1}{3} has least period two, since the following output shows that D(1/3)=2/3D(1/3)=2/3 and D2(1/3)=1/3D^2(1/3)=1/3.

forward_orbit(1/3, D, 2)
[1/3, 2/3, 1/3]

A cobweb plot is a useful way to visualize an orbit of a map T:RRT:{\mathbb R} \to {\mathbb R}. It involves several things:

  • The graph of the function ff.
  • The diagonal (the graph of the identity map)
  • The orbit. The orbit is visualized as the sequence of points (the cobweb path) [(x,x),(x,T(x)),(T(x),T(x)),(T(x),T2(x)),].[(x,x), (x,T(x)), (T(x),T(x)), (T(x), T^2(x)), \ldots].

The following function draws a cobweb plot of the orbit of xx, connecting (x,x)(x,x) to (TN(x),TN(x))\big(T^N(x),T^N(x)\big) by a cobweb path:

def cobweb(x, T, N, xmin, xmax):
    cobweb_path = [(x,x)]
    for i in range(N):
        y = T(x) # Reassign y to be T(x).
        cobweb_path.append( (x,y) )
        cobweb_path.append( (y,y) )
        x = y # Reassign x to be identical to y.
    cobweb_plot = line2d(cobweb_path, color="red", aspect_ratio=1)

    function_graph = plot(T, (xmin, xmax), color="blue")
    # define the identity map:
    identity(t) = t
    id_graph = plot(identity, (xmin, xmax), color="green")
    return cobweb_plot + function_graph + id_graph    

Here is the cobweb plot of 1/3:

plt = cobweb(1/3, D, 2, 0, 1)

The point 1/51/5 has period 44:

plt = cobweb(1/5, D, 4, 0, 1)

Here is another phenomenon. The point 1/61/6 is pre-periodic or eventually periodic. This means that there is a k>0k>0 so that Dk(1/6)D^k(1/6) is periodic. For 1/61/6, this kk is one since D(1/6)=1/3D(1/6)=1/3, and above we showed that 1/31/3 is period 22:

plt = cobweb(1/6, D, 3, 0, 1)

Lets compute the least period of 73/103:

x = D(73/103)
k = 1
while x != 73/103:
    x = D(x)
    k = k+1
print( "73/103 has least period " + str(k) )
73/103 has least period 51
cobweb(73/103, D, 51, 0, 1)

Exercise: Think about why if p/qp/q is a fraction, then it must be either periodic or eventually periodic under DD. Under what conditions is it periodic? When is it eventually periodic?