Re: Simplifying Ploynomials
- To: mathgroup at smc.vnet.net
- Subject: [mg5672] Re: Simplifying Ploynomials
- From: hanson at physics.auburn.edu (James D Hanson)
- Date: Tue, 7 Jan 1997 11:22:47 -0500
- Organization: Auburn University Physics
- Sender: owner-wri-mathgroup at wolfram.com
In article <5ap4ni$kv2 at dragonfly.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. It is not very elegant, but it works. In[1]:= messy = c0 + a*c1 - b*c1 + a^2*c2 - 2*a*b*c2 + b^2*c2 Out[1]= 2 2 c0 + a c1 - b c1 + a c2 - 2 a b c2 + b c2 In[2]:= clean = Expand[messy /. a -> x + b] /. x -> a - b Out[2]= 2 c0 + (a - b) c1 + (a - b) c2 -- James D. Hanson ph. (334) 844-5044 Department of Physics fax (334) 844-4613 206 Allison Laboratory Auburn University, AL 36849-5311 hanson at physics.auburn.edu