Re: Troubling Bug involving RandomReal, NestList, and Table
- To: mathgroup at smc.vnet.net
- Subject: [mg86261] Re: Troubling Bug involving RandomReal, NestList, and Table
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 7 Mar 2008 02:27:21 -0500 (EST)
- References: <fqo8tn$t2o$1@smc.vnet.net>
Hi, this is a bug when Mathematica "Compile" the expression in Table[] try opts = "CompileOptions" /. SystemOptions[]; opts = opts /. ( "TableCompileLength" -> _) :> ( "TableCompileLength" -> Infinity); SetSystemOptions["CompileOptions" -> opts]; and the bug disappear. Regards Jens jwmerrill at gmail.com wrote: > When making tables of 250 or more directions, Mathematica seems to > forget how to do arithmetic. I realize these "random" directions are > not properly uniform, but that's beside the point. > > $Version >> "6.0 for Mac OS X x86 (32-bit) (April 20, 2007)" > > randomDirection3[] := > NestList[Sqrt[1 - #^2] &, RandomReal[], 1] > > ListPlot[Table[randomDirection3[], {249}], AspectRatio -> Automatic] > ListPlot[Table[randomDirection3[], {250}], AspectRatio -> Automatic] > >> [Graphs you'll need to generate for yourself] > > Variance[Table[Norm[randomDirection3[]], {249}]] > Variance[Table[Norm[randomDirection3[]], {250}]] > >> 1.49104*10^-33 >> 0.0513843 > > What!?! > > Jason Merrill >