Skip to content

Baker

Systems / Maps / Geometric maps

The baker's map — stretch, cut, and stack; the cleanest model of mixing and the horseshoe.

discrete · map2 dimensionsmixing

Start here

Python
import tsdynamics as ts

system = ts.systems.Baker()
traj = system.run(steps=2_000, seed=0)
ts.plot(traj)

traj.t contains the sample times and traj.y the state array; system.info shows the defaults. In a notebook the last line displays the plot. In a Python script, call .show() on it to open a window, or .save("trajectory.svg") to export it.

steps counts map iterations; there is no integration step size.

single-orbit state projection (x, y); points appear in iteration order, without interpolated motion. Interactive: drag to rotate; use the play/pause control in the viewer.

This finite simulation illustrates one initial condition and view. The diagnostics below report their own inputs and observation windows.

Dynamics at the default parameters

Lyapunov exponents measure separation rates along an orbit. The Kaplan–Yorke dimension is derived from those rates, not a direct geometric measurement. Finite runs depend on the initial condition, transient and observation window; a value near zero needs a convergence check.

Lyapunov spectrum
Finite-time / numerical estimate
$+0.6931,\; -0.6931$
per iteration
Method and evidence

Benettin QR tangent dynamics

Finite-time estimate, not a convergence certificate. All state-space directions were computed.

Settings

{
  "backend": "jit",
  "k": 2,
  "n": 20000,
  "transient": 0,
  "ic": [
    0.13514772961361254,
    0.2338282626421176
  ]
}

Preparation

{
  "steps": 500,
  "seed": 92850017,
  "ic": [
    0.11557049786487572,
    0.8760784649559669
  ]
}

Estimator runtime in the recorded environment: 0.3137 s.

Kaplan–Yorke dimension
Finite-time / numerical estimate
$D_{KY} = 2$
Method and evidence

Kaplan–Yorke interpolation of the recorded spectrum

Lyapunov dimension estimate; equality with a fractal or information dimension requires additional dynamical assumptions.

Settings

{
  "backend": "jit",
  "k": 2,
  "n": 20000,
  "transient": 0,
  "ic": [
    0.13514772961361254,
    0.2338282626421176
  ]
}
Divergence ∇·f
Not applicable: discrete map — flow divergence undefined (per-step contraction is |det J|)
Equilibria / fixed points
Finite-time / numerical estimate
1 fixed points found
0 stable · 1 unstable · 0 marginal / undetermined
Method and evidence

A seeded numerical search, not a completeness proof. Stability means linear asymptotic stability. Marginal/nonhyperbolic roots have no nonlinear stability verdict from this linearisation.

max Re(eigenvalue) for flows; max |multiplier| - 1 for maps. Boundary band: 1e-7 * max(1, max |eigenvalue|).

Settings

{
  "method": "newton",
  "n_seeds": 80,
  "seed": 0
}

Estimator runtime in the recorded environment: 0.0257 s.

Recorded parameters and software
{
  "parameters": {
    "alpha": 0.5
  },
  "parameter_expressions": {},
  "state_dimension": 2,
  "explicit_time": false,
  "library_version": "6.0.3",
  "python": "3.14.8",
  "numpy": "2.4.4",
  "scipy": "1.17.1",
  "protocol_version": 1
}

Definition

Python
@staticmethod
def _step(X, alpha):
    """
    Right-hand side of the Baker map.

    x, y: Current state variables
    alpha: Contraction ratio of the fold (0 < alpha <= 0.5)

    The canonical ``x`` fold is ``(2 * x) % 1``, but the pure doubling map
    drains a float mantissa one bit per step (``2 * x`` is an exact binary
    shift), so every orbit collapses onto the ``x = 0`` fixed point in ~52
    iterations and the chaos dies. Wrapping just below 1 injects a ~5e-8
    offset at each fold that keeps the orbit non-degenerate; the dynamics
    (and the exponents ``ln 2`` / ``ln alpha``) are unchanged to that
    tolerance. This is the same guard :class:`KaplanYorke` carries.

    The ``y`` branch is written with ``np.where`` (rather than a Python
    ``if`` on the state) so the step traces to a straight-line tape and runs
    on the Rust engine.
    """
    x, y = X
    xp = (2 * x) % 0.99999995  # stretch in x (wrapped just below 1)
    yp = np.where(x < 0.5, alpha * y, alpha * y + (1 - alpha))  # contract + stack
    return xp, yp

Parameters

Symbol Default Role
alpha 0.5 fold fraction splitting the height (0.5 = area-preserving)

State variables: x, y

Explore further

Reference

Hopf (1937), Ergodentheorie (Springer, Berlin)
doi:10.1007/978-3-642-86630-2

BibTeX
BibTeX
@misc{baker,
  title = {Baker system},
  note = {Hopf (1937), Ergodentheorie (Springer, Berlin)},
  doi = {10.1007/978-3-642-86630-2}
}