Note
Go to the end to download the full example code.
Baker’s Map: Stretch, Cut, and Stack#
The (generalized) baker’s map cuts the unit square \([0,1) \times [0,1)\) at \(x=\alpha\), stretches each piece horizontally back to unit width (contracting it vertically to match), and stacks the two pieces:
It is the textbook conceptual bridge of deterministic chaos: it makes this “stretch, cut, and stack” mechanism – the geometric operation behind exponential sensitivity and topological mixing – completely explicit and exactly solvable. Unlike the Henon map, it is area-preserving (its Jacobian determinant is exactly 1 everywhere), yet it is still uniformly hyperbolic, ergodic, and mixing. The example below uses the classic symmetric cut, \(\alpha=0.5\).
Animation: stretch, cut, and stack, in motion#
A dense, regular grid of square markers starts colored in just two bands –
blue on the left half, red on the right – about as simple an initial
state as there is, and one that (for this map’s default alpha = 0.5)
lines up exactly with the map’s own cut point. Rather than blending
straight to each iteration’s end state, every iteration is animated as
three distinct phases: the square visibly stretches out to twice its
width (squashed vertically, stretched horizontally, spilling past the
unit square’s outline), pauses on the dashed cut line at x = 1,
then stacks as the right-hand piece slides back and up onto the
left-hand piece – landing the two original colors as clean top and
bottom halves after the very first iteration. Because every square keeps
its original color, the two halves are then seen getting sliced and
interleaved into progressively thinner, more numerous fragments. After 20
iterations the two colors are, to the eye, uniformly salt-and-peppered
across the whole square: mixing, made literal.
anim = animate_bakers_map(system, n_points=10000, n_iterations=20, frames_per_iteration=15)
plt.show()