Re: Non-deterministic numerical inaccuracies in
- To: mathgroup at smc.vnet.net
- Subject: [mg94952] Re: [mg94908] Non-deterministic numerical inaccuracies in
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Wed, 31 Dec 2008 06:10:40 -0500 (EST)
- Reply-to: hanlonr at cox.net
$Version 7.0 for Mac OS X x86 (64-bit) (November 11, 2008) No problem apparent. Bob Hanlon On Tue, Dec 30, 2008 at 12:26 PM , Sjoerd C. de Vries wrote: > Hi all, > > Last week Budgemano posted an issue which involved numerical > inaccuracies in Mathematica 7. Due to the xmas season it hasn't > received much attention, or so it seems. > > Meanwhile, I've been able to drill the problem down to the following > code: > > myMod := Module[ > {p}, > Dot[{0.5018839897852984567457648, 0.544293499215831476457645674576, > 0.67220312964800834576456745674567}, {-0.5359693986690249`, \ > -0.41257352636613975`, -0.736559494563862`}]*{-0.5359693986690249`, \ > -0.41257352636613975`, -0.736559494563862`} - {0.5579131132707782`, > 0.2715072333003815`, 0.7842300557273234`}] > > For[ii = 1, ii <= 250, ii++, > If[myMod =!= myMod, > Print["Iteration " <> ToString[ii] <> " fails comparison "]];] > > As you can see the module myMod is called twice every iteration. Its > calculations only involve constants, so the results should always be > the same. However, on my system (Mathematica 7.WinXP) the results > differ from one > call to the other at seemingly random times. > > This phenomenon crucially depends on the presence of the local > variable p (that isn't used!). With this variable it's there, without > it isn't. In M6 everything is OK, so this is a bug specific to > Mathematica 7. > > Could you check on the various platforms whether you can reproduce > this? > > Cheers -- Sjoerd