MathGroup Archive 1997

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

Search the Archive

Re: Simplifying Ploynomials

  • To: mathgroup at smc.vnet.net
  • Subject: [mg5678] Re: Simplifying Ploynomials
  • From: Daniel Lichtblau <danl>
  • Date: Tue, 7 Jan 1997 11:22:53 -0500
  • Organization: wolfram.com
  • Sender: owner-wri-mathgroup at wolfram.com

Ersek_Ted%PAX1A at mr.nawcad.navy.mil wrote:
> 
> Dear Math Group,
> 
> The two polynomials "messy" and "clean" below are equivalentl.
> 
> messy = c0 + a*c1 - b*c1 + a^2*c2 - 2*a*b*c2 + b^2*c2
> 
> clean = c0 + c1(a-b) + c2(a-b)^2
> 
> If I get a polynomial like the messy one, how can I get Mma
> to convert is to the clean polynimial.
> 
> I don't yet have Version 3..0.
> Using Collect and Factor in version 2.2 does no good.
> Maybe FullSimplify in version 3.0 will work.
> 
> Still I would like to do this without using FullSimplify,
> because it can take a very long time.
> 
> Please Help
>              T.E.


Simplify and FullSimplify both give

In[3]:= Simplify[messy]
Out[3]= c0 + (a - b) (c1 + (a - b) c2)

To get the factorized coefficients in version 3.0, you can use either
the three-argument form of Collect, or else the grossly-underdocumented
MonomialList followed by Factor.


In[8]:= MonomialList[messy, {c0,c1,c2},
CoefficientDomain->RationalFunctions]
                           2            2
Out[8]= {c0, (a - b) c1, (a  - 2 a b + b ) c2}

In[9]:= Apply[Plus, Map[Factor, %]]
                                 2
Out[9]= c0 + (a - b) c1 + (a - b)  c2

In[10]:= Collect[messy, {c0,c1,c2}, Factor]
                                  2
Out[10]= c0 + (a - b) c1 + (a - b)  c2


Daniel Lichtblau
Wolfram Research
danl at wolfram.com


  • Prev by Date: the mathematica journal
  • Next by Date: Re: Data handling in mathematica 2.2 and 3.0
  • Previous by thread: Simplifying Ploynomials
  • Next by thread: Re: Simplifying Ploynomials