AngouriMath
Factor(AngouriMath.Entity,AngouriMath.Entity.Variable)
Method (no overloads)
Summary
irreducible over the rationals, or
be settled.
Parameter "expr"
The polynomial to factorise.
Parameter "variable"
The variable it is a polynomial in.
Returns
The factorisation; the input itself where it is irreducible over the
rationals, which is an answer and not a refusal; ornull where expr is not a polynomial in
variable with rational or polynomial coefficients, or where
the question is past what the factoriser will do.
rationals, which is an answer and not a refusal; or
the question is past what the factoriser will do.
Remarks
factorisation modulo a prime, Hensel lifting to a power of it above Mignotte's
bound, and recombination — and the factors are multiplied back and compared with
the input before they are returned. The degree bound is 32.
polynomial in the other variables — is taken out. Then whatever remains is
factored by Kronecker's substitution, which writes the exponent vector as a
numeral in mixed radix and reads a one-variable factorisation back. Its ceiling is
a degree budget rather than a variable count: the image has degree the product of
the radices less one, so three variables of degree 2 fit and four do not.
checked by exact division before it is kept, and the assembled factors are divided
back into the input.
Example
Console.WriteLine(MathS.Polynomials.Factor("x ^ 4 - 5 * x ^ 2 + 4", "x"));
// (x + 1) * (x + 2) * (x - 2) * (x - 1)
Console.WriteLine(MathS.Polynomials.Factor("x ^ 3 - 3 * x ^ 2 + 3 * x - 1", "x"));
// (x - 1) ^ 3
Console.WriteLine(MathS.Polynomials.Factor("x ^ 2 + 1", "x"));
// x ^ 2 + 1 -- irreducible over Q, which is an answer
Console.WriteLine(MathS.Polynomials.Factor("x * y + y", "x"));
// y * (x + 1) -- the content in x is taken out first
Console.WriteLine(MathS.Polynomials.Factor("x ^ 2 - y ^ 2", "x"));
// (x + y) * (x - y)
Console.WriteLine(MathS.Polynomials.Factor("x ^ 12 - y ^ 12", "x") is null);
// True -- past the substitution's degree budgetAngouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 4378 pages online