Skip to main content

Module attractors

Module attractors 

Source
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§

AttractorPool
A pool of attractor samplers — one per particle stream. Allows spawning particles from multiple independent trajectories.
AttractorSampler
Stateful sampler that integrates an attractor over time. Maintains the current state and advances it on each call to next().
AttractorStats
Statistical metadata about an attractor’s trajectory.

Enums§

AttractorPalette
Colour palette for attractor visualisation.
AttractorType
Which strange attractor to use.

Functions§

derivatives
Compute continuous-time derivatives at state s for 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_min to rho_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] = 1 if |state_i - state_j| < threshold. Returns a flat n × n bit 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.