cplx_argument_principle — MATH complex op

Data kinds: cpoints × cpointsmeasurement

Call: import mathops; mathops.cplx_argument_principle(z, fz) (or opsmath.get("cplx_argument_principle"))

Usage

Argument principle: count zeros minus poles enclosed by a contour, from sampled values of `f` alone.

`Z - P = 1/(2*pi*i) ∮ f'/f dz` equals the winding number of the **image

curve** `f(z)` around the origin (Cauchy 1831 / Riemann): as the contour

is traversed once counter-clockwise, the argument of `f` increases by

`2*pi (Z - P)`, counting multiplicities. Computing it as a winding number

of the image needs no derivative and no root finding — only `f` sampled

on the path — and returns an exact integer.

Honest limitations, all of them real:

• It returns the difference `Z - P`, never the two separately. A

simple zero and a simple pole inside cancel to 0.

• The result is multiplied by the winding number of the contour itself,

so it equals `Z - P` only for a simple, positively-oriented

contour (a clockwise one returns `-(Z - P)`).

• It is the winding of the *sampled* image polygon, so it aliases low

on a coarse contour. A half-turn jump between samples is detected and

raised; anything below that is indistinguishable from a genuine slower

turn — `f = z**5` on a 4-point circle returns 1, not 5 (measured).

A `RuntimeWarning fires from pi/2` per step onward

(:data:WIND_ALIAS_WARN); the verification that actually works is to

double `n` until the count repeats.

Raises `ValueError: f` vanishes at a sample point (a zero *on*

the path — the count is undefined there), the image curve is undersampled

(a half-turn between consecutive samples: refine the contour), plus the

usual shape/finiteness contracts.

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)

math_complexpy -3.11 examples/math_complex.py

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

Same category (complex)

cplx_contour_circle · cplx_poly_eval · cplx_contour_integral · cplx_winding_number · cplx_cauchy_value · cplx_laurent_coeffs · cplx_joukowski · cplx_mobius


*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.