Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: LeafCount and ByteCount Lie in Mathematica
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Richard Fateman

Posts: 1,406
Registered: 12/7/04
LeafCount and ByteCount Lie in Mathematica
Posted: May 4, 2014 2:28 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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.




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.