AngouriMath

Navigation

← Back to list of members

Gcd​(AngouriMath.​Entity,​AngouriMath.​Entity)

 Method (no overloads)

Summary

The greatest common divisor of two polynomials, or null where
that could not be settled.

Parameter "left"

The first polynomial.

Parameter "right"

The second polynomial.

Returns

A polynomial dividing both, of the greatest degree that does — 1 where
they are coprime — or null where either is not a polynomial
with rational coefficients in at most eight variables of degree at most 127,
or where the computation declined.

Remarks

Multivariate, by recursion on the variables with the content taken out at each
level and a subresultant remainder sequence at the bottom, so that the
coefficients stay the size of the minors they are rather than compounding. The
result is normalised so that its leading coefficient is positive, which is what
makes two greatest common divisors of the same pair comparable; it is fixed only
up to a rational factor otherwise.

Example

Console.WriteLine(MathS.Polynomials.Gcd("x ^ 2 - 1", "x ^ 2 + 2 * x + 1"));
// x + 1
            
Console.WriteLine(MathS.Polynomials.Gcd("x ^ 2 - y ^ 2", "x ^ 2 - 2 * x * y + y ^ 2"));
// x - y
            
Console.WriteLine(MathS.Polynomials.Gcd("x ^ 2 + 1", "x ^ 2 + 2"));
// 1                -- coprime

























Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 4378 pages online