ifs_fractal — MATH construct op

• Data kinds: none → pairs (an op determined by its arguments alone — it takes no image or data input)

• Call: import fullseye as fs; fs.ledger.ifs_fractal(preset='sierpinski', maps=None, n_points=60000, seed=0, burn_in=32) (to call the implementation directly, import mathops; mathops.ifs_fractal(preset='sierpinski', maps=None, n_points=60000, seed=0, burn_in=32); from the registry, opsmath.get("ifs_fractal"))

Usage

Chaos game on an iterated function system — the dimension is a closed form.

Picks a map at random (by `weights`, or by area if none are given), applies

it, and plots the orbit. After a short burn-in the orbit lands on the

attractor and stays there, so the picture is the attractor and not a path to

it.

★**Why this earns its place — two numbers that must agree and were computed

two different ways**:

• *Moran's equation.* For similarities with ratios `r_i` satisfying the

open set condition, the similarity dimension `d` is the unique root of

`sum(r_i**d) == 1` — a closed form read off the maps, before

anything is drawn. Sierpinski gives `log 3 / log 2 = 1.5850`, the Koch

curve `log 4 / log 3 = 1.2619, Cantor dust log 4 / log 3` as well.

• *Box counting.* This repository's existing `fractal_dimension`

operator measures the dimension from the drawing. The two must agree,

and they are not the same computation: one is algebra on the maps, the

other is a regression on a rasterised image.

Hutchinson's theorem gives a third, structural check: the attractor is

invariant, so applying every map to the point set maps it back into

itself.

`maps overrides preset: a sequence of (a, b, c, d, e, f)` meaning

`x -> [[a, b], [c, d]] x + [e, f]`.

Returns `pairs (n, 2)`.

Raises `ValueError`: unknown preset; a map that is not 6 numbers; a map

that is not a contraction (spectral norm >= 1 — the orbit would escape);

`n_points below 1 or over the cap; negative burn_in`.

HALCON: no operator.

Family-wide input contract (fail-closed)

Every mathops op validates its input before computing (nothing slips through silently):

• **complex input raises ValueError** — coercing to float64 silently discards the imaginary part (numpy only emits a ComplexWarning and returns a plausible-looking wrong real number). State .real/.imag/abs() explicitly, or use complexops, which handles complex data.

• **masked arrays with masked elements raise ValueError** — the implicit conversion that peels off the mask and uses the raw values underneath is refused. Say explicitly whether to fill or to drop.

• **NaN/Inf raises ValueError on every input** (refused with the count stated — it propagates through the whole result).

• Shapes are strict: 1-D and 2-D are never implicitly promoted or broadcast (a matrix in a vector slot, or a vector in a matrix slot, raises ValueError; reshape explicitly).

• Size cap: ops that take a matrix, and the stat_histogram bins, raise ValueError beyond mathops.MAX_ELEMENTS (2^26 ≈ 67 million elements).

Detailed usage guide

• math_metrology family guide

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Runnable examples (verified samples that actually call this op)

• poc_theorems_as_pictures — py -3.11 examples/poc_theorems_as_pictures.py

Ops the type connects to (they accept pairs as input)

neighbour_index_gaps · curve_locality

Same category (construct)

circle_packing_apollonian · ford_circles · phyllotaxis_pattern · neighbour_index_gaps · ifs_similarity_dimension · space_filling_curve · curve_locality


*Provenance: mathops.py — MATH operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.