MathGroup Archive 2001

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

Search the Archive

Re: Re: Q: Factor with Polynominals?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27038] Re: [mg26985] Re: Q: Factor with Polynominals?
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Thu, 1 Feb 2001 03:00:25 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

I have found a bit of time to consider your problem more carefully and I
concluded that while in principle what you want done is quite easy,  there
seems to be an ambiguity in what you call "factoring a polynomial".

Here is the function which will produce the output you wanted in the first
case, while in your second case it will essentially the same output:

PolynomialFactor[f_, g_] :=
  If[PolynomialReduce[f, g][[1, 1]] === 0, PolynomialReduce[f, g][[2]],
    PolynomialFactor[PolynomialReduce[f, g][[1, 1]], g]*g +
      PolynomialReduce[f, g][[2]]]

Here is what happens with your two examples:

In[2]:=
PolynomialFactor[3 x^2 + 3 y^2 + x + y^3 + y x^2, x^2 + y^2]

Out[2]=
x + (3 + y)*(x^2 + y^2)

This is just what you wanted.

In[3]:=
PolynomialFactor[Expand[(x^2 + y^2)^4 + y (x^2 + y^2) + y], x^2 + y^2]

Out[3]=
      2    2         2    2 3
y + (x  + y ) (y + (x  + y ) )

This looks somewhat different, but actually that's because it is factored
more deeply than you asked for. This sort of problem will occur in other
examples, e.g. 

In[15]:=
PolynomialFactor[(1 + x^2)^2*(x + 3) + (1 + x^2)*(x - 3), 1 + x^2]

Out[15]=
      2                          2
(1 + x ) (-3 + x + (3 + x) (1 + x ))

Again, this is factored further than is the case in your examples. One can
probably fix it with some further programming but quite frankly I do not
think it is worth the effort, having got to this point it should be easy to
re-arrange things by hand.

-- 
Andrzej Kozlowski
Toyama International University
JAPAN

http://platon.c.u-tokyo.ac.jp/andrzej/
http://sigma.tuins.ac.jp/


on 01.1.31 1:22 PM, Robert at robert.schuerhuber at gmx.at wrote:

> 
> 
> thanks again for your answers!
> unfortunately your method works with the (rather simple) examples, but it
> fails
> with longer, more complex poynomials.
> robert
> 
> Allan Hayes wrote:
> 
>> Here is a technique that works, with little thought, for both of the
>> examples given so far in this thread.
>> 
>> poly = (x^2 + y^2)^4 + y (x^2 + y^2) + y;
>> poly2 = 3 x^2 + 3 y^2 + x + y^3 + y x^2;
>> 
>> tf[u___ + a_ b_ + v___ + a_ c_ + w___] := u + a(b + c) + v + w;
>> tf[z_] := z;
>> 
>> fs = FullSimplify[poly, TransformationFunctions -> {Automatic, tf},
>> ComplexityFunction -> (Length[#] &)
>> ]
> 
> 
> 




  • Prev by Date: Re: Font display
  • Next by Date: Re: Re: Q: Factor with Polynominals?
  • Previous by thread: Re: Font display
  • Next by thread: Re: Re: Q: Factor with Polynominals?