Re: Why isn't Expand[] grouping terms by order?

*To*: mathgroup at smc.vnet.net*Subject*: [mg87863] Re: [mg87825] Why isn't Expand[] grouping terms by order?*From*: Bob Hanlon <hanlonr at cox.net>*Date*: Sat, 19 Apr 2008 03:31:46 -0400 (EDT)*Reply-to*: hanlonr at cox.net

You are looking for the command Collect Collect[(1 + a*x)*(1 + b*x), x] a*b*x^2 + (a + b)*x + 1 Bob Hanlon ---- p at dirac.org wrote: > Consider this: > > In[19]:= Expand[ (1+a*x)*(1+b*x), x] > > 2 > Out[19]= 1 + a x + b x + a b x > > > How can I coax Mathematica to give me this, instead: > > 2 > Want[19]= 1 + (a + b) x + a b x > > Why isn't Mathematica reporting the answer in terms of powers of x? > > Thanks! >