about things notes.zzstoatzz.io
notes math root-counts.md
3.5 kB · 70 lines
Markdown
at main

numerical root counts #

Counting the solutions of a geometric system numerically, for instance the squares inscribed in a given curve, goes wrong in two directions. A discretized curve has solutions the true curve does not, and a search from random starts misses solutions the true curve has. Both failures are silent: the count looks like data either way.

a discretization invents solutions #

A polygon or spline of a curve is a different curve, and near a degenerate configuration it has different roots.

  • Nearly parallel strands. Where a curve has nearly concentric or nearly parallel pieces, a polygonal approximation has exact small squares between neighbouring pieces that the smooth curve does not have.
  • Continuous symmetry. If the exact curve is invariant under a one-parameter group, its solutions come in orbits and none is isolated. The approximation breaks the symmetry and turns each orbit, or each near-orbit, into isolated roots. A count of "isolated" solutions on an approximation of a symmetric curve is meaningless.

Count on the exact curve where there is a formula for it. Otherwise accept a root only after an isolation test on its Jacobian, and follow it across refinements of the discretization.

a zero count on a symmetric object says little #

For the same reason, "no isolated solutions" on an exactly symmetric curve does not carry over to nearby curves. On two arcs of one logarithmic-spiral family, a search finds no isolated inscribed square; a ripple of relative size 10⁻⁴, 10⁻³, 10⁻² in the radius gives 24, 273 and 2,065 at one pitch. Perturb a candidate before believing its zero.

random starts miss roots on fine structure #

Newton's method from random starts finds a root only if a start lands in its basin, and basins shrink with the smooth pieces of the data. On curves with sawteeth at three successive scales, where a grid search found 2,860, 19,878 and 96,460 isolated squares, Newton from random starts found 2,809, 731 and 7, and none at a fourth scale. A zero from random starts is not evidence of absence, and a nonzero count is a lower bound.

Alternatives, in order of strength:

  • A grid with a sign test. Parametrize by a subset of the unknowns that determines the rest (for a square, two curve points as one side), scan a grid, and look for sign changes of the remaining conditions. Then polish.
  • Follow the degree. Compute the winding number of the map around a box and subdivide. On roughened strands a root-finder started from a grid missed about a quarter of the roots that the winding number located.
  • Exhaust. When the curve is piecewise linear, a square with vertices on four given edges is one 4 × 4 linear solve, so all quadruples of edges can be enumerated. When a zero matters, look for the algebraic condition that makes the enumeration finite.

a test has to be hard at the right scale #

A solution whose points avoid a region is untouched by changes inside it, and a non-degenerate solution survives any change much smaller than itself. So adding small rough features to a tame curve does not test whether roughness removes solutions: the tame curve's solutions persist. A test curve has to be rough at the scale of the solutions it is meant to remove.

sources #

  • zzstoatzz.io/square-peg — JOURNEY.md §30–§32 and writeups/inscribed-square-problem.md, 2026-10; counts from anim/ scripts on log-spiral coils, floating point, single runs.