Re: Limit to length of lists?
- To: mathgroup at smc.vnet.net
- Subject: [mg34153] Re: Limit to length of lists?
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Tue, 7 May 2002 03:53:46 -0400 (EDT)
- References: <ab5hs1$jh4$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Bob, Below I simulate your process as I understand it - apart from the cut and pasting, which I don't see the need for. Everything works OK and the calculation of ss takes 1.75 second on my old 233 MHz machine. You might like to try what you are doing using a short list with symbolic entries, for example {a,b,c,d,e} for s -- this is often a good way of following what is going on. s= Table[Random[Integer,{1,2^32/40000}], {40000}]; ss=FoldList[Plus,0, Drop[s,-1]]; Length[ss] 40000 OrderedQ[ss] True ss[[34]] 1982666 With s = {a,b,c,d,e} we get FoldList[Plus,0, Drop[{a,b,c,d,e},-1]] {0, a, a + b, a + b + c, a + b + c + d} -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565 "Bob Harris" <nitlion at mindspring.com> wrote in message news:ab5hs1$jh4$1 at smc.vnet.net... > Howdy, > > I'm running into a problem where it seems like you just aren't allowed to > assign a list of 40 thousand integers to a variable. > > I've narrowed the failure down to the steps shown below. Originally I was > trying to import a large list, but when that failed I started trying to see > just what worked and what didn't, and found that the problem has nothing to > do with importing. The computation in the following will seem strange, but > it creates a list that similar to one that I couldn't import. The > computation is probably not related to the problem either. > > (1) In mathematica, I create a 40,000 entry list of numbers in the range > 1..2^32/40000, and assign it to the variable tt. > > (2) Then I change the list so that each entry is the sum of the previous > entries. This results in a sorted list where the numbers range from about 1 > to about 2^32. > > (3) Then I display that list, and cut and paste the whole list into an > assignment to a variable named ss. ss has not been previously used. The > asignment doesn't generate any complaints from Mathematica. The assingment > looks like this: > ss = {44672, ... , 2142701433}; > where the ... stands for 39,998 elements that I've left out of this mail > message. > > (4) I then ask for Length[ss] and am told that it is zero. This is > surprising, since the original list (which was created using Mathematica > functions rather than just a big assignment) had the desired length (i.e. > Length[tt] is 40000. > > (5) Attempts to index into ss also fail. For example, ss[[1]] gives me the > messages > Part::partd: > Part specification ss[[1]] is longer than depth of object. > > (6) After quitting and relaunching Mathematica, I've tried doing steps 3, 4, > and 5 by themselves. The failure is the same. > > Anyone have any idea what's goin on here? And how I can correct it? I've > wandered so far away from what I was originally trying to do, I'm starting > to get pretty frustrated. Is there some artificial limit imposed on the > length of lists? Is there some way I can control it? > > I'm using Mathematica 4.0.1.0 on a G3 Mac running OS 9.0.4. I've got it set > up to provide 20 MB for Mathematica and 30 MB for MathKernel. > > Thanks for any help, > Bob H > >