AngouriMath

Try it live

Navigation

HeuristicGcd


← Back to list of classes

Description

Summary

The greatest common divisor of two polynomials by evaluation at a large integer,
after Char, Geddes and Gonnet's GCDHEU: one variable is replaced by an integer
ξ, the gcd of what is left is found the same way, and the answer is read back
from its digits in base ξ.

Remarks

Why it is asked at all.PolynomialGcd runs the subresultant
remainder sequence, whose intermediates multiply through by leading coefficients that
are themselves polynomials. A product of three factors in three variables and its
derivative already take it past MaxIntermediateTerms.
This never builds a polynomial larger than its inputs: the size goes into the integers
instead, which is where arbitrary precision is cheap.
Why the answer can be believed. With ξ above twice the smaller of the
two inputs' largest coefficients, a candidate read back from the digits that divides
both inputs is their greatest common divisor (Char, Geddes and Gonnet, "GCDHEU:
Heuristic polynomial GCD algorithm based on integer GCD computation", 1989).
Whether it divides is checked by exact division, so a ξ that was unlucky costs
another attempt or a refusal and never a wrong answer.

Members

























Angouri © 2019-2026 · Project's repo · Site's repo · Octicons · Transparency · 6091 pages online