Mathematica collect function,

*To*: mathgroup at smc.vnet.net*Subject*: [mg121189] Mathematica collect function,*From*: HOANG <hoangnhuy83 at yahoo.com>*Date*: Sat, 3 Sep 2011 08:05:24 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com

Hi all, I would like to use the collect function for this: (1 + 2 Z + Z Z.U)^2 + (1 + 2 Z + Z Z.U) (Z (1 + Z) + Z.U (Z + Z Z.U)) + (1 + Z + Z.U + (Z.U)^2) (Z (1 + Z) + Z.U (Z + Z Z.U)) + (Z (1 + Z) + Z.U (Z + Z Z.U)) (Z (1 + Z.U) + Z.U (Z + (Z.U)^2)) This is what I tried in Mathematica: Collect[(1 + 2*Z + Z* Z*U)^2 + (1 + 2*Z + Z* Z*U)* (Z* (1 + Z) + Z*U* (Z + Z* Z*U)) + (1 + Z + Z*U + (Z*U)^2)* (Z *(1 + Z) + Z*U (Z + Z *Z*U)) + (Z* (1 + Z) + Z*U* (Z + Z* Z*U)) *(Z* (1 + Z*U) + Z*U *(Z + (Z*U)^2), Z] But it does not work However, it works when I tried this one: Collect[(1 + Z)^2 + (1 + Z)*(Z + Z*Z*U) + (1 + Z*U)* (Z + Z*Z*U) + (Z +Z*Z*U)*(Z +(Z*U)^2) + Z *((1 + Z)^2 + (1 + Z*U)* (Z + Z* Z*U)) + Z*U *((1 + Z)* (Z + Z*Z*U) + (Z + Z* Z*U)* (Z + (Z*U)^2)), Z] Someone knows why? thanks for your answer