MathGroup Archive 2006

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63620] Re: [mg63607] Getting the small parts right or wrong. Order and Collect
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Sat, 7 Jan 2006 04:59:29 -0500 (EST)
  • References: <dpg11e$pm4$1@smc.vnet.net> <dplhq9$em8$1@smc.vnet.net> <200601070729.CAA06924@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 7 Jan 2006, at 16:29, Richard Fateman wrote:

> This example comes from the on-line help.
>
> Collect[(1 + x + y)^3, x]
>
> is supposed to collect the terms in the expression by powers of x. I
> expected the answer to look something like
>
> (.....)*x^0  + (......)*x^1 +(....)*x^2 + .....   etc.
>
> with some simplifications like x^0 -> 1, x^1 -> x  in place, and  
> perhaps the
> whole thing ordered in reverse.
>
> But the result is
>
> 1 + x^3 + 3*y + 3*y^2 + y^3 + x^2*(3 + 3*y) + x*(3 + 6*y + 3*y^2)
>
> Yes I can explain why this answer is ordered this way, but it is not a
> property of computer algebra systems that is reflected by this, just a
> property of Mathematica. This is a poke to get it right.
>
> I even know I can do this..
>
> Replace[%21, {Plus :> List}, 1, Heads -> True]
>
> and make a list of the terms; I can then try sorting them some  
> other way, as
> long as I don't add them together.  Oh, I can also rename the  
> variables;
> Collect [(1+x+y)^3, y] works much better.
>
> RJF
>
>
>


There is one very simple thing you can do, which I think completely  
deals with your problem.
You can convert the output to TraditionalForm.

Andrzej Kozlowski


  • Prev by Date: Re: Odd answer from Mathematica
  • Next by Date: Re: Getting the small parts right or wrong. Order and Collect
  • Previous by thread: Getting the small parts right or wrong. Order and Collect
  • Next by thread: Re: Getting the small parts right or wrong. Order and Collect