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

# Periodicity¶

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

D(x) = 2*x - floor(2*x)
show(D)

$x \ {\mapsto}\ 2 \, x - \left \lfloor 2 \, x \right \rfloor$

Some example applications:

D(1/4)

1/2
D(2/3)

1/3

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 $D$ is a value $x$ so that $D(x)=x$. Zero is a fixed point:

D(0)

0

A periodic point of $D$ is a point $x$ so that $D^k(p)=p$ for some $k \geq 1$. The least period (or prime period) of $p$ is the smallest such $k$. We say $x$ has period $k$ if $D^k(x)=x$.

The number $\frac{1}{3}$ has least period two, since the following output shows that $D(1/3)=2/3$ and $D^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:{\mathbb R} \to {\mathbb R}$. It involves several things:

• The graph of the function $f$.
• 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), T^2(x)), \ldots].$

The following function draws a cobweb plot of the orbit of $x$, connecting $(x,x)$ to $\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)
plt The point $1/5$ has period $4$:

plt = cobweb(1/5, D, 4, 0, 1)
plt Here is another phenomenon. The point $1/6$ is pre-periodic or eventually periodic. This means that there is a $k>0$ so that $D^k(1/6)$ is periodic. For $1/6$, this $k$ is one since $D(1/6)=1/3$, and above we showed that $1/3$ is period $2$:

plt = cobweb(1/6, D, 3, 0, 1)
plt 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/q$ is a fraction, then it must be either periodic or eventually periodic under $D$. Under what conditions is it periodic? When is it eventually periodic?