Problem with Collect
- To: mathgroup at yoda.ncsa.uiuc.edu
- Subject: Problem with Collect
- From: Markus Lautenbacher <Markus.Lautenbacher at physik.tu-muenchen.de>
- Date: Fri, 1 Feb 91 23:27:04 -0600
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