Problem with Collect[]

*To*: mathgroup at smc.vnet.net*Subject*: [mg26626] Problem with Collect[]*From*: "Pei Jin" <pei.jin at worldnet.att.net>*Date*: Sat, 13 Jan 2001 22:36:07 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

Hello, I the course of my playing with Mathematica (version 4.0.1.0 for Windows 98) a large expression was generated (Length[rt2]=7470, ByteCount[rt2]=4923096) but rather simple, it is sum of products of 2 functions. When I tried to collect the terms I got No more memory available. Mathematica kernel has shut down. Try quitting other applications and then retry. At first, I tried to follow that advice and I stopped all other programs, but that did not help, I tried to use MemoryConstrained[Collect[rt2, f[__]], 50000000]; but even 50 MB (my PC has 96 MB of RAM) were not enough for this command to finish (with this command I got $Abort). Then I tried to create my version of Collect, but even access to elements of this expression (rt2[[i]]) in a loop creates memory exhaustion. Even Short[rt2, 2] crashes kernel. Some operations have no problem though: z = Cases[rt2, f[__], 2]; Length[z] Can you please tell me is it normal for Mathematica to behave like this, or is something wrong with my version? If you know any workaround that would be great. Thanks P. Jin