Greatest Common Divisors

The functions in this section can be applied to multivariate polynomials over any ring which has a GCD algorithm.

Contents

Common Divisors and Common Multiples

GreatestCommonDivisor(f, g) : RngMPolElt, RngMPolElt -> RngMPolElt
Gcd(f, g) : RngMPolElt, RngMPolElt -> RngMPolElt
GCD(f, g) : RngMPolElt, RngMPolElt -> RngMPolElt
The greatest common divisor of f and g in a multivariate polynomial ring P. If either of the inputs is zero, then the result is the other input (and if the inputs are both zero then the result is zero). The result is normalized (see the function Normalize), so the result is always unique.

The valid coefficient rings are those which themselves have a GCD algorithm for their elements (which includes most commutative rings in Magma).

For polynomials over the integers or rationals, a combination of three algorithms is used: (1) the heuristic evaluation `GCDHEU' algorithm of Char et al. ([CGG89] and [GCL92, section 7.7]), suitable for moderate-degree dense polynomials with several variables; (2) the EEZ-GCD algorithm of Wang ([Wan80], [MY73] and [GCL92, section 7.6]), based on evaluation and sparse ideal-adic multivariate Hensel lifting ([Wan78] and [GCL92, section 6.8]), suitable for sparse polynomials; (3) a recursive multivariate evaluation-interpolation algorithm (similar to that in [GCL92, section 7.4]), which in fact works generically over {Z} or most fields.

For polynomials over any finite field or any field of characteristic zero besides {Q}, the generic recursive multivariate evaluation-interpolation algorithm (3) above is used, which effectively takes advantage of any fast modular algorithm for the base univariate polynomials (e.g., for number fields). See the function GreatestCommonDivisor in the univariate polynomials chapter for details of univariate GCD algorithms.

For polynomials over another polynomial ring or rational function field, the polynomials are first "flattened" to be inside a multivariate polynomial ring over the base coefficient ring, then the appropriate algorithm is used for that base coefficient ring.

For polynomials over any other ring, the generic subresultant algorithm [Coh93, section 3.3] is called recursively on a subring with one less variable.

GCD(Q) : [ RngMPolElt ] -> RngMPolElt
Given a sequence Q of polynomials, return the GCD of the elements of Q. If Q has length 0 and universe P, then the zero element of P is returned.
LeastCommonMultiple(f, g) : RngMPolElt, RngMPolElt -> RngMPolElt
Lcm(f, g) : RngMPolElt, RngMPolElt -> RngMPolElt
LCM(f, g) : RngMPolElt, RngMPolElt -> RngMPolElt
The least common multiple of f and g in a multivariate polynomial ring P. The LCM of zero and anything else is zero. The result is normalized (see the function Normalize), so the result is always unique. The valid coefficient rings are as for the function GCD, above.

The LCM is effectively computed as Normalize((F div GCD(F, G)) * G), for non-zero inputs.

LCM(Q) : [ RngMPolElt ] -> RngMPolElt
Given a sequence Q of polynomials, return the LCM of the elements of Q. If Q has length 0 and universe P, then the one element of P is returned.
Normalize(f) : RngMPolElt -> RngMPolElt
Given a polynomial f over the base ring R, this function returns the unique normalized polynomial g which is associate to f (so g=uf for some unit in R). This is chosen so that if R is a field then g is monic, if R is Z then the leading coefficient of g is positive, if R is a polynomial ring itself, then the leading coefficient of g is recursively normalized, and so on for other rings.
ClearDenominators(f) : RngMPolElt -> RngMPolElt
ClearDenominators(Q) : [ RngMPolElt ] -> [ RngMPolElt ]
Given a polynomial f over a field K such that K is the field of fractions of a domain D, the first function computes the lowest common denominator L of the coefficients of f and returns the polynomial g=L.f over D with cleared denominators, and L. The second function returns the sequence of polynomials derived from independently clearing the denominators in each polynomial in the given sequence Q.

Content and Primitive Part

Content(f) : RngMPolElt -> RngIntElt
The content of f, that is, the greatest common divisor of the coefficients of f as an element of the coefficient ring.
PrimitivePart(f) : RngMPolElt -> RngMPolElt
The primitive part of f, being f divided by the content of f.
ContentAndPrimitivePart(f) : RngMPolElt -> RngIntElt, RngMPolElt
Contpp(f) : RngMPolElt -> RngIntElt, RngMPolElt
The content (the greatest common divisor of the coefficients) of f, as an element of the coefficient ring, as well as the primitive part (f divided by the content) of f.
V2.28, 13 July 2023