Expand description
Strange attractor implementations — RK4 integration, Lyapunov exponents, warmup.
All seven classical attractors are implemented with:
- 4th-order Runge-Kutta (RK4) integration for accuracy
- Lyapunov exponent approximation (numerical divergence tracking)
- Warmup / transient discard so initial noise is removed before sampling
- Normalised output bounding boxes (attractor fits ≈ unit cube)
- Bifurcation parameter sweeps for each attractor family
Structs§
- Attractor
Pool - A pool of attractor samplers — one per particle stream. Allows spawning particles from multiple independent trajectories.
- Attractor
Sampler - Stateful sampler that integrates an attractor over time.
Maintains the current state and advances it on each call to
next(). - Attractor
Stats - Statistical metadata about an attractor’s trajectory.
Enums§
- Attractor
Palette - Colour palette for attractor visualisation.
- Attractor
Type - Which strange attractor to use.
Functions§
- derivatives
- Compute continuous-time derivatives at state
sfor the given attractor. Returns(dx/dt, dy/dt, dz/dt). - initial_
state - Canonical initial conditions close to the attractor.
- initial_
state_ warmed - Return a warmed-up initial state on the attractor surface.
- kaplan_
yorke_ dimension - Kaplan–Yorke dimension from Lyapunov spectrum: D_KY = j + Σ(λ_i) / |λ_{j+1}|
- largest_
lyapunov_ exponent - Compute the largest Lyapunov exponent numerically.
- lorenz_
bifurcation - Lorenz bifurcation diagram: sweep rho from
rho_mintorho_max, return last-n states. - lorenz_
parametric - Lorenz attractor with configurable parameters.
- lyapunov_
spectrum - Compute all three Lyapunov exponents via QR decomposition (Gram–Schmidt).
Returns
[λ1, λ2, λ3]in descending order. - poincare_
section - Collect Poincaré section crossings (z =
z_level, z going upward). Returns the x,y coordinates at each crossing. - recurrence_
plot - Compute a recurrence matrix for a sampled attractor trajectory.
matrix[i][j] = 1if|state_i - state_j| < threshold. Returns a flatn × nbit vector. - rk4_
step - Single RK4 step. More accurate than Euler at the cost of 4× function evaluations.
- rossler_
parametric - Rössler attractor with configurable parameters.
- step
- Evolve by one step and return (new_state, displacement). Uses RK4 for accuracy.
- velocity_
color - Map an attractor velocity magnitude to a colour using a gradient.
Returns
(r, g, b, a)all in[0.0, 1.0]. - warmup
- Warm up an attractor (discard the transient trajectory). Call before sampling to ensure the state is on the attractor.