MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: On special polynomials decomposition

  • To: mathgroup at
  • Subject: [mg126614] Re: On special polynomials decomposition
  • From: "djmpark" <djmpark at>
  • Date: Fri, 25 May 2012 04:57:11 -0400 (EDT)
  • Delivered-to:
  • References: <16485754.54319.1337850113967.JavaMail.root@m06>

There are probably people on this group who can give a better theoretical
answer. There is a small problem in the specification of the problem.  I
will look for solutions that consist of two factored terms, of which the
first is a perfect square. You are probably thinking of something more

We can explore some "by hand" solutions. With the Presentations Application
it is possible to operate on selected level parts of an expression. So we
can pick out terms to Factor.

poly = a^2 + 2*a*b + a^2*b + b^2 + a*c + a*b*c + c^2;


poly // MapLevelParts[Factor, {{1, 2, 4}}] 
% // MapLevelParts[Factor, {{1, 3, 4, 5}}] 

a^2 b + (a + b)^2 + a c + a b c + c^2 
(a + b)^2 + (a + c) (a b + c) 

If we knew what the potential factors were we could use GroebnerBasis to
find the new polynomial.

GroebnerBasis[{poly, v1 - a b - c, v2 - a - c, v3 - a - b}, {v1, 
  v2}, {a, b, c}] 

{v1 v2 + v3^2}
The following routine partitions a polynomial into two sets of terms and
checks if the first set is a perfect square and the second set can be
factored and adds good cases to a set of solutions.

twoTermFactor::usage = 
  "twoTermFactor[polynomial, nterms1] will split the polynomial into \
two sets of terms with nterms1 terms in the first set. It then checks \
if the first set is a square and the second set factors. If so, the \
two factored terms are added to a list of solutions, which is \

SyntaxInformation[twoTermFactor] = {"ArgumentsPattern" -> {_, _}};

twoTermFactor[poly_, nterms1_Integer?Positive] :=
 Module[{sols = {}, terms = Length[poly], termSets, process},
  process[set1_] :=
   Module[{p1, p2},
    p1 = Factor@Part[poly, set1];
    p2 = Factor@Part[poly, Complement[Range[terms], set1]];
    If[! SquareFreeQ[p1] && Head[p2] === Times, 
     AppendTo[sols, {p1, p2}]]
  termSets = Subsets[Range[terms], {nterms1}];
  Scan[process, termSets];

twoTermFactor[poly, 3] 

{{(a + b)^2, (a + c) (a b + c)}} 

This could certainly be generalized. Perhaps the first term only has to be
factored and not a perfect square. Perhaps we allow more than two terms. We
could use IntegerPartitions to generate possible subsets. 


{{7}, {6, 1}, {5, 2}, {5, 1, 1}, {4, 3}, {4, 2, 1}, {4, 1, 1, 1}, {3, 
  3, 1}, {3, 2, 2}, {3, 2, 1, 1}, {3, 1, 1, 1, 1}, {2, 2, 2, 1}, {2, 
  2, 1, 1, 1}, {2, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1, 1}} 

Must every term contain more than one variable or would we allow terms such
as b^2?

If there is not already a general routine, these might be some of the

David Park
djmpark at 

From: Konstantin Nosov [mailto:nodus0 at] 

Dear friends

I'm seeking for standard Mathematica means for solving the following
problem. Say, there is a polynomial in multiple variables. I try to present
this polynomial in the form of polynomial in new variables, which are in
turn polynomials in initial variables.

For example, the polynomial
can be presented as 
i.e. as a polynomial in the new variables {v1=a*b+c, v2=a+c, v3=a+b}.

Solution is complete, if for a given polynomial and new
polynomials-variables at least one such presentation could be obtained or
impossibility of the presentation is confirmed.

I'll be appreciate for any suggestion.

  • Prev by Date: Re: Fourier DFT scaling problem
  • Next by Date: Stop on message?
  • Previous by thread: Re: On special polynomials decomposition
  • Next by thread: Loss of precision