Overview
The Sturm sequence module implements sophisticated algorithms for:- Counting real roots in intervals
- Isolating real roots
- Finding complex roots in rectangular regions
- Root refinement using Newton’s method
- Computing Sturm sequences for polynomials
Complex Sturm Sequences
csturm_seq
First polynomial (typically P)
Second polynomial (typically P’)
Output: list of quotients Q_k
Output: coefficients coeffP_k
Output: coefficients coeffR satisfying the recurrence relation
Context pointer
GCD of r0 and r1 (without content)
csturm_square
Polynomial (as symbolic expression)
Lower-left corner of rectangle (complex number)
Upper-right corner of rectangle (complex number)
Output: GCD if a factor is found
Context pointer
Number of complex roots in rectangle, or -1 if factor found
Complex Root Finding
complex_roots
Polynomial with numeric coefficients in Q[i]
Lower bound for real part
Lower bound for imaginary part
Upper bound for real part
Upper bound for imaginary part
Output: vector of complex roots
Output: factor of P if found
Target precision
False if a factor was found, true otherwise
complex_roots (high-level)
Polynomial with numeric coefficients
Lower bound for real part
Lower bound for imaginary part
Upper bound for real part
Upper bound for imaginary part
Whether to find complex roots
Target precision
Whether to use proot algorithm as fallback
Vector of roots
complexroot / realroot
Polynomial or expression
Whether to find complex roots (internal version)
Context pointer
Roots of the polynomial
Real Root Isolation
vas
Polynomial
Left endpoint of interval
Right endpoint of interval
Target precision
Output: list of intervals or rational roots
Whether to include multiplicities
Context pointer
True if successful
Newton Refinement
newton_improve
Polynomial coefficients
Derivative polynomial coefficients
Whether P has real coefficients
Approximate roots to refine
Output: radius of convergence for each root
Index of root to refine
Maximum Newton iterations
Current precision in bits
Target precision in bits
eps^2 / degree(P)^2 as a gen
Target precision as gen
True if refinement successful
newton_complex_1root
Polynomial
Lower bound for real part
Lower bound for imaginary part
Upper bound for real part
Upper bound for imaginary part
Output: found root (appended to vector)
Target precision
True if a root was found
Polynomial Root Algorithms
aberth
Polynomial coefficients
Input/output: approximate roots
Output: error radii for each root
Degree of polynomial
Target precision
Isolation mode flag
Whether to compute exact roots when possible
Context pointer
True if successful
The Aberth method simultaneously refines all roots, taking into account their mutual interactions. This often converges faster than individual Newton iterations.
mps_solve
Polynomial coefficients
Output: approximate roots
Output: error radii
Target precision
Isolation mode
Whether to use secular equation algorithm
Context pointer
Status code
Rational Root Finding
crationalroot / rationalroot
Polynomial
Whether to find complex rational roots (Gaussian rationals)
Vector of rational (or Gaussian rational) roots
Coordinate Transformations
change_scale
Polynomial to transform (modified in place)
Scale factor
Power of 2 scale (if not 1 shifted left 31, use l=2^lb)
linear_changevar
Polynomial
Linear coefficient
Constant term
Transformed polynomial
ab2a0b0a1b1
First corner of rectangle (complex)
Opposite corner of rectangle (complex)
Output: minimum real part
Output: minimum imaginary part
Output: maximum real part
Output: maximum imaginary part
Context pointer
Utility Functions
horner_minmax
Polynomial coefficients
Whether P has real coefficients
Evaluation point
Perturbation radius
Output: minimum value of P in [r-eps, r+eps]
Output: maximum value of P in [r-eps, r+eps]
round2
Value to round (modified in place)
Number of bits precision
keep_in_rectangle
Complex roots to filter
Minimum real part
Minimum imaginary part
Maximum real part
Maximum imaginary part
Whether to embed in surrounding space
Context pointer
Filtered roots within rectangle
symb2poly_num
Symbolic expression
Context pointer
Numeric polynomial coefficients
Algorithm Overview
Sturm Sequences
Sturm Sequences
Classical Sturm sequences count real roots in an interval by tracking sign changes. Complex Sturm sequences extend this to rectangular regions in the complex plane.The algorithm computes a sequence P₀, P₁, P₂, … where P₀ is the polynomial, P₁ is its derivative, and subsequent terms follow the Euclidean algorithm. Sign changes at interval endpoints indicate root presence.
VAS Algorithm
VAS Algorithm
The Vincent-Akritas-Strzeboński algorithm efficiently isolates real roots using continued fractions and Descartes’ rule of signs. It’s particularly effective for high-degree polynomials.The method recursively subdivides intervals and applies transformations to isolate roots to arbitrary precision.
Aberth's Method
Aberth's Method
Aberth’s method simultaneously approximates all roots of a polynomial by solving:This accounts for interactions between nearby roots and often converges cubically.
Newton Refinement
Newton Refinement
Once roots are isolated, Newton’s method provides rapid local convergence:With multiprecision arithmetic, this achieves arbitrary accuracy.
Related Functions
- Equation Solving - General equation solving functions
- Polynomial arithmetic - See polynomial module
- Root finding - See numeric module
