Macaulay2 » Documentation
Packages » EuclideanDistanceDegree :: EuclideanDistanceDegree
next | previous | forward | backward | up | index | toc

EuclideanDistanceDegree -- produce critical equations and compute ED degrees

Description

The Euclidean distance (ED) degree of a varieties arises from the following problem: given a (generic) data point, find the point on a given variety which minimizes the (possibly weighted) Euclidean distance function. The number of nonsingular critical points of the distance function is the ED degree of the variety.

This package provides several routines for determining the (generic or unit) Euclidean distance degree of an algebraic variety. These routines include symbolic methods and numerical methods for determining these degrees; they can be grouped into four main types:

As an example, this code computes the (unit) ED degree of a circle both symbolically and numerically

i1 : R = QQ[x,y];
i2 : F = {x^2 + y^2 - 1};
i3 : determinantalUnitEDDegree(F)

o3 = 2
i4 : leftKernelUnitEDDegree(F)
Warning: The HomVariableGroup is written first and then the AffVariableGroup is written second.

o4 = 2

When the variety is an affine cone, one is able to compute ED degrees using ED degree homotopies, i.e., a structured parameter homotopy. The easiest case is when the variety is a hypersurface (or more generally, a complete intersection)

i5 : R = QQ[x1,x2,x3,x4];
i6 : F = G = {det genericMatrix(R,2,2)};
i7 : numericGenericEDDegree(F, G)
-- warning: experimental computation over inexact field begun
--          results not reliable (one warning given per session)

o7 = 6

When a $V(F)$ is not a complete intersection we incorporate a membership test to filter out residual critical points. Here $V(F)$ is an irreducible component of $V(G)$ (a reducible variety) and `#G===codim ideal F`. These methods employ an equation by equation method called regeneration.

i8 : R = QQ[x1,x2,x3,x4,x5,x6];
i9 : F = (minors(2, genericMatrix(R,3,2)))_*;
i10 : G = drop(F, -1);
i11 : #G == codim ideal F;
i12 : numericGenericEDDegree(F, G)

o12 = 10

One may also determine ED degrees using a parameter homotopy called a Weight-ED Degree Homotopy. This code computes a unit ED degree:

i13 : R = QQ[x1,x2,x3,x4,x5,x6];
i14 : F = (minors(2, genericMatrix(R,3,2)))_*;
i15 : G = drop(F, -1);
i16 : NCO = newNumericalComputationOptions(F, G);
i17 : NCO#"TargetWeight" = apply(#gens R, i->1);
i18 : homotopyEDDegree(NCO, "Weight", true, true)

o18 = 2

Menu

Authors

Version

This documentation describes version 1.1 of EuclideanDistanceDegree, released April 2026.

Citation

If you have used this package in your research, please cite it as follows:

@misc{EuclideanDistanceDegreeSource,
  title = {{EuclideanDistanceDegree: produce critical equations and compute ED degrees. Version~1.1}},
  author = {Jose Israel Rodriguez and Will Huang},
  howpublished = {A \emph{Macaulay2} package available at
    \url{https://github.com/Macaulay2/M2/tree/stable/M2/Macaulay2/packages}}
}

Exports

  • Types
  • Functions and commands
  • Methods
    • averageNumericEDDegree(List,List,ZZ) -- see averageNumericEDDegree -- compute average ED degrees using sampled data
    • homotopyEDDegree(NumericalComputationOptions,String,Boolean,Boolean) -- see homotopyEDDegree -- numerically compute ED degrees of affine cones using homotopy continuation
    • leftKernelGenericEDDegree(List) -- see leftKernelWeightEDDegree -- numerically compute Euclidean distance degrees of complete intersections
    • leftKernelUnitEDDegree(List) -- see leftKernelWeightEDDegree -- numerically compute Euclidean distance degrees of complete intersections
    • leftKernelWeightEDDegree(List,List,List) -- see leftKernelWeightEDDegree -- numerically compute Euclidean distance degrees of complete intersections
    • newNumericalComputationOptions(List,List) -- see newNumericalComputationOptions -- define homotopy options and configurations
    • numericGenericEDDegree(List,List) -- see numericWeightEDDegree -- numerically compute ED degrees of affine cones using homotopy continuation
    • numericUnitEDDegree(List,List) -- see numericWeightEDDegree -- numerically compute ED degrees of affine cones using homotopy continuation
    • numericWeightEDDegree(List,List,List,List) -- see numericWeightEDDegree -- numerically compute ED degrees of affine cones using homotopy continuation
    • parameterizedGenericEDDegree(List) -- see parameterizedWeightEDDegree -- compute ED degrees of parameterized varieties
    • parameterizedUnitEDDegree(List) -- see parameterizedWeightEDDegree -- compute ED degrees of parameterized varieties
    • parameterizedWeightEDDegree(List,List,List) -- see parameterizedWeightEDDegree -- compute ED degrees of parameterized varieties
    • determinantalGenericEDDegree(List) -- see symbolicWeightEDDegree -- symbolically compute ED degrees of affine varieties
    • determinantalUnitEDDegree(List) -- see symbolicWeightEDDegree -- symbolically compute ED degrees of affine varieties
    • symbolicWeightEDDegree(List,List,List) -- see symbolicWeightEDDegree -- symbolically compute ED degrees of affine varieties
  • Symbols
    • ReturnCriticalIdeal -- whether to return the ideal of critical points
    • SampleGenerator (missing documentation)
    • Submodel (missing documentation)
    • TempDirectory -- set directory for Bertini runs
    • UseMonodromy -- whether to use monodromy methods to compute degrees

For the programmer

The object EuclideanDistanceDegree is a package, defined in EuclideanDistanceDegree.m2, with auxiliary files in EuclideanDistanceDegree/.


The source of this document is in EuclideanDistanceDegree.m2:141:0.