Re: Re: big integer for Range

*To*: mathgroup at smc.vnet.net*Subject*: [mg61351] Re: [mg61299] Re: big integer for Range*From*: Murray Eisenberg <murray at math.umass.edu>*Date*: Sun, 16 Oct 2005 00:18:04 -0400 (EDT)*Organization*: Mathematics & Statistics, Univ. of Mass./Amherst*References*: <diktip$515$1@smc.vnet.net> <200510150222.WAA17251@smc.vnet.net>*Reply-to*: murray at math.umass.edu*Sender*: owner-wri-mathgroup at wolfram.com

Aside from the particular design of Mathematica, there's no particular reason that available (physical RAM + VM) need limit the length of a list: a program could write out parts of a list that's too long to a file, then retrieve parts of it as needed -- all transparent to the user. Evidently Mathematica does not do this. Scout wrote: > "Murray Eisenberg" <murray at math.umass.edu> ha scritto > news:diktip$515$1 at smc.vnet.net... > >>Mathematica 5.2 under Windows XP on a 32-bit machine complains if I ask >>it to form Range[10^9]. The error is Range::range: Range specification >>in Range[10000000000] is not a machine-size integer. >> >>Is there a built-in Mathematica function that tells what the machine's >>maximum machine-size integer is? (And if not, shouldn't there be?) >> >>-- >>Murray Eisenberg murray at math.umass.edu >>Mathematics & Statistics Dept. >>Lederle Graduate Research Tower phone 413 549-1020 (H) >>University of Massachusetts 413 545-2859 (W) >>710 North Pleasant Street fax 413 545-1801 >>Amherst, MA 01003-9305 >> > > > Hi Murray, > that's a very critical question! > First of all, memory is the primary resource which limits the size of > computations you can do. > The amount of memory is equal to the physical number of bytes of RAM in the > computer. But there is also a certain amount of "virtual memory", managed by > the O.S. (or by yourself !). > > Now, $MaxMachineInteger gives the maximum integer that is represented > internally on your computer; typically on an n-bit system is 2^(n-1) - 1. > On 32-bit PC, each integer is represented by 4 bytes (which can differ > substantially from one system to another!). > To store n integers, that is the case of the Range[n] command (skipping the > few bytes necessary to the structure) we need the amount of > > f[n_]:=(4*n)/2^20; > MBytes of ram. > > startMem = MemoryInUse[]/(1024*1024); > this gives the number of MBytes of memory currently being used by > Mathematica. > > Well, now keep in mind the dimension of the virtual memory used by Windows > as you can see in the advanced properties of your system; let's say VM its > dimension; > Also let's say RAM the dimension of r.a.m. of your system (in MBytes) and > PROGRAMS the dimension of all the processes running on the system at that > time (obviously in MBytes). > > Now, solving the below equation you get the max integer that you can use > with Range[] : > > Solve[f[n] == VM + RAM - PROGRAMS - startMem , n]; > > Please, note that this solution is qualitative but useful to extract a > superior limitation. > > Regards, > ~Scout~ > > -- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305

**References**:**Re: big integer for Range***From:*"Scout" <mathem@tica.org>