MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Limit to length of lists?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34162] Re: [mg34140] Limit to length of lists?
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Tue, 7 May 2002 03:54:00 -0400 (EDT)
  • References: <B8FC12CF.21B11%nitlion@mindspring.com>
  • Sender: owner-wri-mathgroup at wolfram.com

Bob,
I have tried the sequence of steps that you give below, and everything
behaves correctly with Widows 98, though I must say that I am using a beta
copy of Mathematica 4.2.


> The problem seems to be that you can't define a large list just by listing
> its entries.
>
> Create a table with a lot of entries:
>
>   in:=  tt = Table[1, {40000}]
>   out:= {1,1,...,1}
>
>   in:=  Length[tt]
>   out:= 40000
>
> So far so good.  Now, try to make a new list by cutting and pasting that
> result.
>
>   in:=  ss = {1,1,...,1}
>   out:=                     << no output, which is the first clue
>
>   in:=  Length[ss]
>   out:= 0
>
>   in:=  ss[[1]]
>       Part::partd:
>        Part specification ss[[1]] is longer than depth of object.
>   out:= ss[[1]]


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


----- Original Message -----
From: "Bob Harris" <nitlion at mindspring.com>
To: mathgroup at smc.vnet.net
Hayes" <hay at haystack.demon.co.uk>
Subject: [mg34162] Re: [mg34140] Limit to length of lists?


> I wrote:
> > 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.
>
> The first replies that are coming in show me that I didn't describe my
> problem very well.  Probably because I still had some remnants in there of
> what I was originally trying to do.  At the time I posted that example, I
> thought the size of the numbers within my list mattered;  but I now know
> they don't.
>
> Allan Hayes replied:
> > Below I simulate your process as I understand it - apart from the cut
and
> > pasting, which I don't see the need for. ...
>
> The cut and paste is what causes the problem.  The steps you show work
fine
> on my machine, too.
>
> David Park replied:
> > Unfortunately, you are not telling us exactly what you did. It looks
like ss
> > did not get set to a list. If you feed ss to the kernel what do you get?
> >
> > Anyway, on a Windows98 machine there is no problem in storing a list of
that
> > size. Here I make a 40000 long list of your maximum number size. ...
>
> Yep, those steps work fine on my machine, too.
>
> Let me make may example more specific.
>
> The problem seems to be that you can't define a large list just by listing
> its entries.
>
> Create a table with a lot of entries:
>
>   in:=  tt = Table[1, {40000}]
>   out:= {1,1,...,1}
>
>   in:=  Length[tt]
>   out:= 40000
>
> So far so good.  Now, try to make a new list by cutting and pasting that
> result.
>
>   in:=  ss = {1,1,...,1}
>   out:=                     << no output, which is the first clue
>
>   in:=  Length[ss]
>   out:= 0
>
>   in:=  ss[[1]]
>       Part::partd:
>        Part specification ss[[1]] is longer than depth of object.
>   out:= ss[[1]]
>
> While a cut and paste in this example seems silly, it models what I was
> originally trying to do-- create a large list with some other program, and
> import it into Mathematica.  I've tried a variety of techniques and they
all
> fail in their own ways.  When I got to the point where cut and paste
failed,
> I realized there seems to be something intrinsically wrong in handling
large
> lists, and not in my methods.
>
> The next thing I tried, just to try to understand what's going on, was to
> save the notebook (which takes up 268K as a file), quit mathematica, and
> launch the notebook again.  Before doing anything, I did MemoryInUse[],
and
> it says 998084 bytes are in use for the session.  My OS tells me that
> mathematica is using about 4MBytes (this discrepancy is probably explained
> by the fact that the executable is about 3MBytes).  I've allowed a 20
MByte
> memory partition for mathematica, so it's got 16MBytes to spare.  That
seems
> like plenty of elbow room for a list with 40 thousand entries.
>
> I then tried to assign to ss (the assignment was still in the notebook, so
I
> didn't have to bother with tt), not by cutting and pasting, but by
clicking
> on the assignment and hitting shift-return.  I get the same result-- ss
> didn't seem to get assigned.  MemoryInUse[] now says 1024860 bytes are in
> use.  The attempt to assign to ss seems to have used up about 26KBytes.
>
> Hopefully that's a better description.
>
> Thanks for any help,
> Bob H
>
>



  • Prev by Date: Re: computing nullspace
  • Next by Date: RE: Some questions about plotting.
  • Previous by thread: Re: Limit to length of lists?
  • Next by thread: RE: Re: Limit to length of lists?