MathGroup Archive 1997

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

Search the Archive

Re: Re: Problem with collect

  • To: mathgroup at smc.vnet.net
  • Subject: [mg6586] Re: [mg6439] Re: Problem with collect
  • From: Daniel Lichtblau <danl>
  • Date: Fri, 4 Apr 1997 02:11:36 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Hans Steffani wrote:
> ...
> Take
> 
> blah1 vv ss + blah2 vv ss +
> blah3 vv aa + blah4 vv aa +
> blah5 ss aa + blah6 ss aa
> Collect[%,{ss vv,vv aa,ss aa}]
> 
> this produces
> 
> aa blah5 ss + aa blah6 ss + aa blah3 vv + aa blah4 vv +
>   blah1 ss vv + blah2 ss vv
> 
> although I want
> 
> aa vv(blah3+blah4) + ss vv(blah1+blah2) + ss aa(blah5+blah6)
> 
> Collect[%,{ss,vv,aa}]
> 
> produces
> 
> aa (blah3 + blah4) vv + ss
>    (aa (blah5 + blah6) + (blah1 + blah2) vv)
> 
> which is not what I want.
> 
> Hans Friedrich Steffani
> ....


This does what you want in version 3.

In[5]:= $Version
Out[5]= Linux 3.0 (March 30, 1997)

In[6]:= ee = blah1 vv ss + blah2 vv ss +
blah3 vv aa + blah4 vv aa +
blah5 ss aa + blah6 ss aa;

In[7]:= Collect[ee, {ss vv,vv aa,ss aa}]
Out[7]= aa (blah5 + blah6) ss + aa (blah3 + blah4) vv + (blah1 + blah2)
ss vv
                         
Let me note that collecting with respect to "variables" that are
products or powers is a tricky business in general.


Daniel Lichtblau
Wolfram Research
danl at wolfram.com


  • Prev by Date: Re: Re: Solve and Plot
  • Next by Date: Re: Symbols, names, objects: kludge
  • Previous by thread: Nonlinear curve-fitting difficult functions
  • Next by thread: ContourGraphics and Show