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.
divisor of the coefficients, which is a polynomial in the other variables — is
taken out first. What 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, while the image's degree, the product of the
radices less one, is at most 32. Past that, Hensel lifting along an evaluation
homomorphism: the polynomial is factored at a point and the factorisation
lifted back. In three or more variables the lift brings back one variable at a
time, each to its own degree, after Wang; a leading coefficient that is a
polynomial in the others is first made monic, by
Where that declines, the variables other than
substituted into one, in mixed radix again, and lifted as two, while that image's
degree is at most 127. The lifts need an image with no repeated factor, so a
polynomial with one has its square-free part factored instead and the
multiplicities put back by division. The greatest common divisor that part needs is
taken by evaluation at a large integer, after Char, Geddes and Gonnet, and by the
subresultant sequence where that declines.
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 ^ 3 - (y + z) ^ 3", "x"));
// (x - y - z) * (x ^ 2 + x * y + x * z + y ^ 2 + 2 * y * z + z ^ 2)
Console.WriteLine(MathS.Polynomials.Factor("(y * x ^ 2 + z * w) * (x - y - w) * (z * x + 1)", "x"));
// -1 * (w - x + y) * (x * z + 1) * (w * z + x ^ 2 * y)Angouri © 2019-2026 · Project's repo · Site's repo · Octicons · Transparency · 6091 pages online