Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16905

LeafCount and ByteCount Lie in Mathematica

From Richard Fateman <fateman@cs.berkeley.edu>
Newsgroups comp.soft-sys.math.mathematica
Subject LeafCount and ByteCount Lie in Mathematica
Date 2014-05-04 06:28 +0000
Message-ID <lk4mn7$g5s$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


Mathematica 9.0 .. on a 32 bit windows machine.

f[n_] := Block[{k = f[n - 1]}, {k, k}]
f[0]=x

  LeafCount[f[k]]  for particular small integers k
returns  the number 2^(k+1)-1.   e.g. for k=3, it returns 15.

But it returns the same answer for k=30, 31, ....
  It returns 2147483647,  which, probably not coincidentally, is 2^31-1.

ByteCount has a similar problem in running out of bits in
its counter.

Anyway, ByteCount also lies in a different way...
  because it doesn't take into account the
sharing that (say) f[70] has.  Without the sharing
implicit in the formula above, I could not compute that --
it has 2.36 X 10^21 leaves. They are just not different leaves.

I would expect that a 64-bit system might work for k=31,
but would conk out somewhere else.

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar


Thread

LeafCount and ByteCount Lie in Mathematica Richard Fateman <fateman@cs.berkeley.edu> - 2014-05-04 06:28 +0000

csiph-web