From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Generating a huge array.
Date: Sat, 10 Apr 2010 17:07:08 +0000 (UTC)
Organization: Magma Geosciences Inc.
Lines: 12
Message-ID: <hpqb7s$64m$>
References: <hpp13j$o1i$> <hpp78k$ef6$> <hpp8ip$2cs$> <hppeh1$jdo$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1270919228 6294 (10 Apr 2010 17:07:08 GMT)
NNTP-Posting-Date: Sat, 10 Apr 2010 17:07:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 872154
Xref: comp.soft-sys.matlab:625390

"Roger Stafford" <> wrote in message <hppeh1$jdo$>...
> "Uriah Stephenson-Ward" <> wrote in message <hpp8ip$2cs$>...
> > ........
> > Interestingly, the Mathematica script creates an array <174504x4 double> and this script creates an array <176851x4 double>, I'm wondering if Mathematica was dropping some possible values, or vice a versa.
> > 
> > Thanks.
>   Offhand I would guess that Mathematica suffered from some improper round offs with the decimal fractions you gave it.  With your inequality x < 0, you may have thrown away some combinations whose x was just a tiny round off amount below zero and that therefore ought to have been saved.  Perhaps if you had said x < -0.00000001, it might have worked properly.  Remember, on a binary machine (which we all have nowadays) the fractions 0.001 and 0.01 and most other decimal fractions cannot be exactly represented as binary fractions and this can cause mischief.  That is no fault of Mathemetica, but rather the algorithm and the machine used.  With n equal to 100 you should have gotten precisely 101*102*103/6 = 176851, as James has said.  It is something that can be proved with mathematical rigor.
> Roger Stafford

This is an interesting discussion, in particular since Wolfram promotes Mathematica on the strength of its symbolic mathematics capabilities (not sniping at Wolfram here, just stating the obvious). If you change the sum to 100 and the step size to 1 does Mathematica still return the incorrect answer?