3
$\begingroup$

Consider the following example for a polynomial in several variables:

pol = x^2 y + x^4 z + x^3 y z + x^6 y z^2 + x y^2 z^2 + x^5 y^2 z^2 + x^5 z^3 + x^4 y z^3 + x^3 y^3 z^3 + x^2 y^4 z^3 + x^2 y^2 z^4 + x^4 y^5 z^4 + x^3 y^4 z^5;

Let's say I have a suspicion that this polynomial or a part of it should factor into two sub-polynomials, one of which I guess to be factor = (x^2 z^3 + y x^3 z^2 + x z). I would like to have a function that explicitly finds the factorization:

FactorSubpol[pol,factor]

x^2 y + (x^3 + x^2 y + x y^4 z^2 + y^2 z) (x^2 z^3 + y x^3 z^2 + x z)

in case if such a factorization is possible, and returns the unfactorized terms in pol if such a factorization is impossible. I have tried Collect[pol,factor], but it only seems to work with very simple factor expressions. Is there a way to do the above consistently with larger factors? Thanks for any suggestion!

$\endgroup$
5
$\begingroup$
res = Rest@Select[Subsets@pol, PolynomialMod[#, factor] == 0 &]

So, out of the 8192 (== 2^13) possible "sub-polys", only these ones are divisible by factor:

Mathematica graphics

Grid[Join[{{"pol == Non-factored", "Plus (factor by ...)"}}, 
           {pol - # factor // Expand, #} & /@ (PolynomialQuotient[#, factor, z] & /@ 
            res)], Frame -> All]

Mathematica graphics

$\endgroup$
4
$\begingroup$
pol = x^2 y + x^4 z + x^3 y z + x^6 y z^2 + x y^2 z^2 + x^5 y^2 z^2 + 
   x^5 z^3 + x^4 y z^3 + x^3 y^3 z^3 + x^2 y^4 z^3 + x^2 y^2 z^4 + 
   x^4 y^5 z^4 + x^3 y^4 z^5;

guess = (x^2 z^3 + y x^3 z^2 + x z);

FullSimplify[pol/guess]*Simplify[guess]

xz(1 + x^2*yz + xz^2)* (x^2*(x + y) + (x*y)/z + y^2*z + x*y^4*z^2 - (x^2*y*(xy + z))/ (1 + xz*(x*y + z)))

Consequently, your guess is not a factor of pol

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.