MathGroup Archive 2000

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

Search the Archive

Re: RE: Re: User problem

  • To: mathgroup at
  • Subject: [mg24079] Re: [mg24023] RE: [mg23997] Re: [mg23971] User problem
  • From: john.tanner at
  • Date: Fri, 23 Jun 2000 02:26:46 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

The "Magic Number" coincides with the point where Table starts to
produce PackedArrays: 

In[1]:= Developer`PackedArrayQ[Table[i, {i, 249}]]
Out[1]:= False

In[2]:= Developer`PackedArrayQ[Table[i, {i, 250}]]
Out[2]:= True

This break point of 250 seems to be for the total number of index
entries in the Table, thus a multi-dimensional Table has a break point
at (e.g.) Table[{i,j}, {i, 5},{j, 50}].  I cannot find a reference to
this in the documentation, but I appreciate there should be such a
break point even if I would like some control over it!

This sometimes has implications for expressions which are tested at a
small number of points and then used with a larger number: it is wise
to check with different Table sizes if you suspect the behaviour would
change.  PackedArrays are extremely useful, and their near-seamless
incorporation into Mathematica is a real joy, but they do behave
differently in some circumstances even in "legal" code.  It is
interesting, but not surprising given the output is in a different
form, to note this difference in "illegal" code.

hwolf (hwolf at at MSMR02) writes:
>Notwithstanding the original code being illegal, 250 appears as a
>magic number. Compare:
>In[2]:= Table[i = i + 1, {i, 249}]
>In[3]:= Table[i = i + 1, {i, 250}]
>-- Hartmut
>> -----Original Message-----
>> From:	BobHanlon at [SMTP:BobHanlon at]
To: mathgroup at
>To: mathgroup at
>> Sent:	Monday, June 19, 2000 7:46 AM
>> To:	mathgroup at
>> Subject:	[mg23997] Re: [mg23971] User problem
>> In a message dated 6/18/2000 3:39:33 AM, joseph468 at
>> writes:
>> >I am trying to contstruct a table of random integers
>> >between 1 and 4. I'd like to vary the number of
>> >elements in the table from time to time. The
>> >contruction that I use in Mathematica is as follows:
>> >
>> >genome = Table[i = Random[Integer, {1, 4}], {i, 249}]
>> >
>> >The problem with this is as follows: the above
  >> >generates tables of varying length up to and including
>> >249 elements.  However, when I try to generate any
>> >table containing more than 249 elements, I get the
>> >following error message on my screen:
>> >
>> >This program has performed an illegal operation and
>> >will be shut down.  If the problem persists please
>> >contact the vendor.
>> >
>> >I have version 4 of Mathematica, and am running it on
>> >a Windows98 platform (Dell NoteBook)
>> >
>> genome = Table[Random[Integer, {1, 4}], {249}];
>> Bob Hanlon

  • Prev by Date: Re: Mean of Geometric and Negative Binomial distributions
  • Next by Date: Re: Re: Conversion of Orderless functions to non Orderless one
  • Previous by thread: Re: User problem
  • Next by thread: AW: Re: Integrate returns 0