Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Strange Attractors

Simple feedback rules, iterated millions of times, drawn by density.

A strange attractor is the shape an extremely simple pair of equations settles into when you iterate it forever. Take a point (x, y), apply the rule to get a new point, repeat. The orbit never repeats and never escapes — it endlessly retraces a fractal skeleton. We don't draw lines: we drop millions of points into a grid, count how often each cell gets hit, then colour by that count (log-scaled, so faint filaments survive next to bright cores).

De Jong attractor

The systems

Five classic maps, each driven by four constants a, b, c, d:

System Update rule
Clifford x' = sin(a·y) + c·cos(a·x) , y' = sin(b·x) + d·cos(b·y)
De Jong x' = sin(a·y) − cos(b·x) , y' = sin(c·x) − cos(d·y)
Svensson x' = d·sin(a·x) − sin(b·y) , y' = c·cos(a·x) + cos(b·y)
Fractal Dream x' = sin(b·y) + c·sin(b·x) , y' = sin(a·x) + d·sin(a·y)
Hopalong x' = y − sgn(x)·√|b·x − c| , y' = a − x

Most parameter sets collapse to a point or a boring loop. The interesting ones stay chaotic, and tiny changes to a single constant morph the whole form.

Clifford attractor sweeping one parameter

A Clifford attractor with one constant swept through a seamless loop — the whole GIF (LZW and all) is encoded by attractors.py with no image library.

Two ways to explore

index.html — interactive explorer

Open it in any browser. No build, no dependencies.

  • Drag the parameter sliders to morph the attractor in real time (progressive render, ~4M points).
  • Scroll to zoom straight into the fractal detail and drag to pan — the orbit is re-iterated for whatever window you frame, so the filaments stay sharp as you dive in.
  • Animate sweeps a parameter through a seamless sine loop, live.
  • Switch systems and palettes, Randomize to go hunting, Save PNG to keep a find.

attractors.py — high-res renderer + GIF encoder

Pure Python standard library — no numpy, no Pillow. It writes PNG by hand (zlib + raw chunks) and animated GIF by hand (LZW + the block format), so it runs anywhere Python does.

# render the curated gallery (six images)
python3 attractors.py

# render one attractor with your own parameters
python3 attractors.py clifford -1.7 1.8 -1.9 -0.4 -o mine.png -p ember
python3 attractors.py hopalong -2.0 0.2 1.0 0.0 -o lace.png -p ember

# render an animated GIF, sweeping parameter 0 (-s picks which: 0..3)
python3 attractors.py gif clifford -1.7 1.8 -1.9 -0.4 -o anim.gif -p orchid -s 0

# list available systems and palettes
python3 attractors.py list

Systems: clifford, de_jong, svensson, fractal_dream, hopalong. Palettes: ember, abyss, orchid, ice. PNGs default to 1000×1000 from 6 million iterations (a few seconds on a laptop).

Gallery

How the density colouring works

  1. Bounding box — sample the orbit briefly to learn where it lives in the plane.
  2. Accumulate — iterate for real, binning every point into a 2D histogram.
  3. Log-map — colour = palette[ log(count) / log(peak) ]. Linear scaling would blow out the dense cores and hide everything else; log keeps the whole dynamic range visible, which is what gives these images their smoky depth.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages