construct op• Data kinds: none → table (an op determined by its arguments alone — it takes no image or data input)
• Call: import fullseye as fs; fs.ledger.circle_packing_apollonian(curvatures=(-1.0, 2.0, 2.0, 3.0), depth=4, min_curvature=0.0) (to call the implementation directly, import mathops; mathops.circle_packing_apollonian(curvatures=(-1.0, 2.0, 2.0, 3.0), depth=4, min_curvature=0.0); from the registry, opsmath.get("circle_packing_apollonian"))
Apollonian gasket from a Descartes quadruple — every circle a theorem.
Four mutually tangent circles satisfy the Descartes circle theorem
(k1 + k2 + k3 + k4)**2 == 2 * (k12 + k22 + k32 + k42)
where `k = 1/r` is the curvature (negative for the enclosing circle). The
theorem is quadratic in `k4`, so a triple of mutually tangent circles has
two solutions and the second is `k4' = 2*(k1+k2+k3) - k4`; recursing on
that reflection fills the gasket. The centres follow the complex form
`k4*z4 = k1*z1 + k2*z2 + k3*z3 +- 2*sqrt(k1*k2*z1*z2 + ...)`, so no
geometry is fitted — every circle is produced by an exact algebraic step.
★Why this earns its place: the drawing carries its own proof. Each circle
can be checked against Descartes to machine precision, tangency is
`|z_i - z_j| == |r_i +- r_j|` exactly, and **an integral quadruple stays
integral for ever** — start from `(-1, 2, 2, 3)` and every curvature in the
infinite packing is an integer (Lagarias-Mallows-Wilks). A drawing routine
that is slightly wrong cannot keep integers integral.
Parameters
----------
curvatures : 4 floats
A Descartes quadruple. The default `(-1, 2, 2, 3)` is the smallest
integral gasket. Must satisfy the theorem to `1e-9` relative.
depth : int >= 0
Reflection levels. Level 0 is the four seed circles; each further level
adds `4 * 3**(level-1), so the total is 2 * 3**depth + 2`.
min_curvature : float
Drop circles smaller than `1/min_curvature` (0 = keep all).
Returns a `table: x, y, radius, curvature, depth`
(the enclosing circle has negative curvature and positive radius).
Raises `ValueError`: not four curvatures; the quadruple does not
satisfy Descartes; every curvature negative or zero (no packing); `depth`
negative or so large the packing exceeds the cap; non-finite input.
HALCON: no operator.
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).
• 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.
• poc_theorems_as_pictures — py -3.11 examples/poc_theorems_as_pictures.py
table as input)construct)ford_circles · phyllotaxis_pattern · neighbour_index_gaps · ifs_fractal · 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.