Formulas Reference

The Intending Topology workflow uses three formal equations. This page gives definition and explanation to each one, says where it lives in the code, and shows how the three relate to each other.

Dataset provenance note (June 2026). Numeric examples and regressions in this reference are aligned to the run-2 operational dataset (post-fix rerun corpus, including Stage 1 combinatorics reliability corrections and Stage 3b semantic/path corrections). Historical mixed-output runs and legacy comparison outputs remain archival only.

Reading the equations. The formulas below are written in LaTeX math notation, the standard for scientific writing. On GitHub and most Markdown viewers they render as typeset equations. A few conventions: $...$ wraps an inline expression (mid-sentence), $$...$$ wraps a display expression (centred on its own line); \frac{a}{b} is a fraction $\frac{a}{b}$; subscripts use an underscore, so c_i becomes $c_i$; |x| is absolute value; \max(a,b) is the larger of $a$ and $b$; and \sigma, \mu are the Greek letters $\sigma$ (sigma) and $\mu$ (mu, mean). In this document, $\sigma$ is context-dependent: in Formula 1 it denotes standard deviation in the dispersion term, while in Formulas 2 and 3 it denotes the diversity coefficient. If your viewer shows the raw source instead of the rendered maths, open the file on GitHub.


1. Per-region coherence

Plain-language walkthrough: Section 1 companion

$$\text{coherence} = \frac{\text{spread_ratio}}{1 + \text{dispersion}}$$

where, for one region:

and $\max_dist$, $\min_dist$, $\sigma$, $\mu$ are computed over the set of distances from every line-segment endpoint in the region to the region's centroid (the mean of all endpoints).

For one region, collect every endpoint of every line segment, take the centroid of those points, and measure each endpoint's distance from that centroid. The spread-ratio term (dynamic range) is the farthest endpoint distance divided by the nearest — how stretched the region is, not how tightly grouped it is. Dispersion is how uneven those distances are around their mean (standard deviation divided by mean). Coherence rewards regions with a wide spread-ratio that nonetheless stays even around the mean (low dispersion), and penalises regions where the distances are flat or noisy. The 1 + in the denominator keeps the maths well-behaved when dispersion is near zero.

Reading the spread-ratio. Two properties follow from this definition and are deliberate characteristics of the measure, not defects: (1) it is scale-invariant, so uniformly resizing a region leaves coherence unchanged; and (2) it is sensitive to extreme endpoints by design — a single far or near endpoint can move the score, because the measure is built to register extremes rather than smooth them out. A single-segment region is a defined boundary case: its two endpoints are equidistant from their midpoint, so the spread-ratio is 1 and dispersion is 0, giving coherence exactly 1.0 (the floor of the range).

Range on the 3×4 polygon field (run-2 operational dataset). From 1.00 (r2c3 and r3c1) to 18.1743 (r4c1).

Where it's computed. 04_analyze_polygon_region_coherence.py — function calculate_coherence_from_coords(), lines ~126–177. Per-region coherence values are staged by 03c_consolidate_cell_csvs.py and surfaced in the Illustrator layer scripts 03b_4_CREATE_COHERENCE_LAYERS.jsx and 03b_5_CREATE_COHERENCE_STRENGTH_LAYERS.jsx.


2. Diversity coefficient (between two regions)

Plain-language walkthrough: Section 2 companion

The theoretical definition, as used in Layer 2 and Layer 5:

$$\sigma_{ij} = \frac{|c_i - c_j|}{\max(c_i, c_j)}$$

— the absolute gap between two regions' coherence scores, normalised by the larger of the two. Range $0$ (identical) to $1$ (one region has effectively no coherence relative to the other).

Given two regions with coherence scores $c_i$ and $c_j$, this asks how different they are, relative to the larger of the two. The normalisation makes the result comparable across pairs whose raw coherence values differ wildly.

Where it's computed. 04_analyze_polygon_region_coherence.py.

Implementation note. In the current run-2 pipeline, diversity_coefficient is computed with the normalised formula above (|c_1-c_2|/max(c_1,c_2)) and is the value used for the primary regression. A legacy comparison field, diversity_coefficient_std = np.std([coh1, coh2]), is still emitted as diversity_coefficient_std for archival continuity. Compatibility classification still uses a related similarity score, $1 - |c_1-c_2|/\max(c_1,c_2)$.


3. Pair-loss regression (3×4 polygon field, 66 pairs)

Plain-language walkthrough: Section 3 companion

$$\text{Loss} = -5.5567\,\sigma + 16.2611, \quad R^2 = 0.2035$$

A linear regression fitted across all 66 unordered region pairs in the 3×4 polygon field, predicting coherence loss for a pair from that pair's diversity coefficient $\sigma$.

Where:

Across all 66 possible region pairs, the more diverse the two regions are (higher $\sigma$), the less coherence is lost when they're taken together (lower Loss). The negative slope ($-5.5567$) is the central empirical finding in the run-2 operational dataset: diversity can preserve coherence when anchoring reserve is available. $R^2 = 0.2035$ means about 20% of the variation in Loss across pairs is explained by $\sigma$ in this run.

Simple breakdown (how the fitted line is computed).

  1. Put all 66 pair observations on a plot: $x=\sigma$, $y=\text{Loss}$.
  2. Fit one straight line, $\hat y = m x + b$, to all points at once.
  3. Choose $m$ and $b$ so the total squared vertical gaps to the line are as small as possible:

$$\sum_i \left(y_i - (m x_i + b)\right)^2$$

  1. The resulting slope is $m=-5.5567$:
  2. The intercept is $b=16.2611$:

Residual direction (above/below line):

Where it's computed. 04_analyze_polygon_region_coherence.py, lines ~505–531, using scipy.stats.linregress(sigmas, losses). The fitted coefficients and $R^2$ are emitted into pair_coherence_composition.json and printed to the analysis log.

Legacy comparison (archival only). The same run output also records a regression against $\sigma_{std}$ (standard-deviation diversity) as regression_formula_std_legacy: Loss = -1.0217\sigma_{std} + 16.0248, R^2 = 0.5802.


How the three formulas chain together

Stage 2/3:  per-region vectors  ──►  formula 1  ──►  c_i  (one number per region)
                                                     │
                                                     ▼
Stage 4:    pairs of regions   ──►  formula 2  ──►  σ_ij  (one number per pair)
                                                     │
                                                     ▼
Stage 4:    66 (σ, Loss)     ──►  formula 3  ──►  slope, intercept, R²
            points across
            the whole polygon field

Each formula consumes the output of the previous one:

  1. Formula 1 turns geometry (raw endpoint coordinates per region) into a single coherence score per region.
  2. Formula 2 takes any two of those per-region scores and turns them into a normalised gap.
  3. Formula 3 regresses the per-pair coherence loss against that gap across the whole polygon field, yielding the empirical claim that higher diversity → lower loss.

The Layer 5 selection workflow (05_extract_coherence_pairs.jsx) then uses per-pair categorisation derived from formula 2's related similarity score (1 - |c_1-c_2|/max(c_1,c_2)) to extract high_coherence_compatible and low_coherence_complementary pair sets for composition; formula 3 provides the dataset-level loss trend context.


Where each formula appears in the theory readers

Formula Primary reader(s)
1. Per-region coherence 05 — Layer 3: Synthesis & Coherence Measurement
2. Diversity coefficient 04 — Layer 2: Emergence Through Diversity (formal definition/mechanism) + 07 — Layer 5: Emergence Through Selection (selection categorisation context via related similarity)
3. Pair-loss regression 04 — Layer 2: Emergence Through Diversity (primary mechanism) + 07 — Layer 5: Emergence Through Selection (operational selection context)

For the stage-by-stage workflow that produces all three, see 3×4 Coherence-Stratified Workflow.