MathGroup Archive 2006

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

Search the Archive

Re: Re: Getting the small parts right or wrong. Order and Collect

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63640] Re: [mg63621] Re: [mg63607] Getting the small parts right or wrong. Order and Collect
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sun, 8 Jan 2006 03:33:05 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

I think there is Andrzej - if we can use a HoldForm.

expr = (1 + x + y)^3 // Expand;

Fold[Join[#1, List@Cases[expr, #2]] &, {},
      {_?(FreeQ[#, x] & ), a_. x, a_. x^2, a_. x^3}];
Collect[(# /. List -> Plus), x] & /@ %;
(HoldForm @@ {%}) /. List -> Plus

(1 + 3*y + 3*y^2 + y^3) + x*(3 + 6*y + 3*y^2) + x^2*(3 + 3*y) + x^3

We get the sequence in the order of the patterns.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/ 


From: Andrzej Kozlowski [mailto:akoz at mimuw.edu.pl]
To: mathgroup at smc.vnet.net


Of course there is no way to make the powers of x ascend as you  
originally seems to have wanted but then we can't have everything  
even where Mathematica is concerned.

Andrzej Kozlowski




  • Prev by Date: Re: bug in PlotLegend?
  • Next by Date: Re: Can anybody help?
  • Previous by thread: Re: Re: Getting the small parts right or wrong. Order and Collect
  • Next by thread: Re: Getting the small parts right or wrong. Order and Collect