MathGroup Archive 1991

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

Search the Archive

Problem with Collect


Colin Williams <cwilliam at parc.xerox.com> noticed an unexpected
behavior of Collect[].  I have no explanation for this.  Instead I
want to bring another point to your attention which I found when
experimenting with Collect:

(* the original example *)

In[1]:= t = 2^(n-3) + x

         -3 + n
Out[1]= 2       + x

(* something that should be equivalent to the original example *)

In[2]:= texp = t // ExpandAll

         n
        2
Out[2]= -- + x
        8

In[3]:= t - texp // Simplify

Out[3]= 0

In[4]:= Collect[t,x]

         n
Out[4]= 2  + x

In[5]:= Collect[texp,x]

         n
        2
Out[5]= -- + x
        8

So a temporary cure to the problem seems to be to use
"Collect[ExpandAll[expr],x]" instead of "Collect[expr,x]".

Anyway it is not that unreasonable to expand everything (to "bring the x's
out") before passing it to Collect, although I expected Collect to do 
the expansion automatically. 

MARKUS



  • Prev by Date: bug in raising a Series to a power
  • Next by Date: Solve
  • Previous by thread: bug in raising a Series to a power
  • Next by thread: Solve