The tent map is a famous example of a chaotic function. We will show how a tiny modification of the tent maps retains continuity of the function but prevents chaos.
The tent map is the function f: [0, 1] → [0, 1] defined by
This map has an unstable fixed point at x0 = 2/3. If you start exactly at x0, then you’ll stay there forever as you keep iteratively applying f. But if you start a tiny bit away from x0, you’ll move away from your starting point and bounce around throughout the interval [0, 1].
Now pick some positive ε less than 1/6  and modify the function f on the interval
I =[x0 – ε, x0 + ε]
as described in . To do this, we define fε to be the same as f outside the interval I. We then create a flat spot in the middle of the interval by defining fε to be x0 on
[x0 – ε/2, x0 + ε/2]
and extend fε linearly on the rest of I.
Here’s a plot of fε with ε = 0.05.
Now here’s a cobweb plot of the iterates of f0.05 starting at π – 3.
The iterates of fε always converge to x0 in finite time. If the iterates ever wander into the interval [x0 – ε/2, x0 + ε/2] then they get trapped at x0. And because the tent map is ergodic, nearly all sequences will wander into the entrapping interval.
Here’s Python code to make the construction of fε explicit.
def tent(x): if x < 0.5: return 2*x else: return 2*(1 - x) def interpolate(x, x1, y1, x2, y2): "Linearly interpolate with f(x1) = y1 and f(x2) = y2" m = (y2 - y1)/(x2 - x1) return y1 + m*(x - x1) def tent2(x, epsilon): x0 = 2/3 if x < x0 - epsilon or x > x0 + epsilon: return tent(x) x1 = x0 - epsilon/2 x2 = x0 + epsilon/2 if x > x1 and x < x2: return x0 return interpolate(x, x1, tent(x1), x2, tent(x2))
Revenge of floating point
In theory, almost all starting points should lead to sequences that converge to x0 in finite time. But it took a fair amount of trial and error to come up the plot above that illustrates this. For most starting points that I tried, the sequence of iterates converged to 0.
Now 0 is an unstable fixed point. This is easy to see: if x ever gets close to 0, the next iterate is 2x, twice as far from 0. Iterates keep getting doubled until they're larger than 1/2. How can this be?
Computers can only represent fractions with some power of 2 in the denominator. And I believe the tent map (not the modified tent map with a trap) will always converge to 0 when starting with a floating point number.
Here are the iterates of the tent map starting at (the floating point representation of) π - 3:
Note that the sequence doesn't sneak up on 0: it leaps from 1 to 0. So this does not contract the argument above that points near zero are repelled away.
Related posts: More on dynamical systems
 Why less than 1/6? So we stay in the same branch of the definition of f. The distance from x0 to 1/2 is 1/6.
 Achim Clausing, Ducci Matrices. American Mathematical Monthly, December 2018.