The Virtues of Collect[--]

*To*: mathgroup at smc.vnet.net*Subject*: [mg35239] The Virtues of Collect[--]*From*: AES <siegman at stanford.edu>*Date*: Wed, 3 Jul 2002 05:14:55 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

Appended below is an example of what Collect[expr, h, Simplify] just did for me. Thanks to David Park and Andrzej Kozlowski for teaching me about this. I wish Collect[--] was mentioned as one of the "See Also"'s under the Series Help message -- and I wonder a bit why Mathematica doesn't do this kind of elementary simplification of the Series coefficients automatically. In[30]:= fS[d_,h_] = Series[ f[d, h], {h,0,2} ] // Normal Out[30]= ((((2 + d)*(d - d^2))/(-d + d^2) + (1/2)*(-d + d^2)*((4*d)/(-d + d^2)^2 + (2*(2 + d))/(-d + d^2)))*h)/(2*d) + (-(((-1 - d)*(((2 + d)*(d - d^2))/(-d + d^2) + (1/2)*(-d + d^2)* ((4*d)/(-d + d^2)^2 + (2*(2 + d))/(-d + d^2))))/(2*d^2)) + ((-d + d^2)*((4*(-1 - d))/(-d + d^2)^2 + (2 + d)^2/(-d + d^2)^2 - (1/4)*((4*d)/(-d + d^2)^2 + (2*(2 + d))/(-d + d^2))^2))/(4*d))*h^2 In[32]:= Collect[ fS[d, h], h, Simplify ] Out[32]= (1 / (-d + d^2)) * h - ((-1 + d + d^2) / (-1 + d)^3*d^2)) * h^2