Path: news.mathworks.com!not-for-mail
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$1@fred.mathworks.com>
References: <hpp13j$o1i$1@fred.mathworks.com> <hpp78k$ef6$1@fred.mathworks.com> <hpp8ip$2cs$1@fred.mathworks.com> <hppeh1$jdo$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1270919228 6294 172.30.248.35 (10 Apr 2010 17:07:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 10 Apr 2010 17:07:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 872154
Xref: news.mathworks.com comp.soft-sys.matlab:625390

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <hppeh1$jdo$1@fred.mathworks.com>...
> "Uriah Stephenson-Ward" <uriah+spam@urijah.org> wrote in message <hpp8ip$2cs$1@fred.mathworks.com>...
> > ........
> > 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?