Path: news.mathworks.com!not-for-mail From: "John D'Errico" <woodchips@rochester.rr.com> Newsgroups: comp.soft-sys.matlab Subject: Re: where is the mistake Date: Sun, 27 Feb 2011 21:02:05 +0000 (UTC) Organization: John D'Errico (1-3LEW5R) Lines: 37 Message-ID: <ikee4d$b8c$1@fred.mathworks.com> References: <ikbqin$4gr$1@fred.mathworks.com> <ikdnp4$4i$1@fred.mathworks.com> <ikdrci$jch$1@fred.mathworks.com> <ikdt79$bdd$1@speranza.aioe.org> <ikedib$582$1@fred.mathworks.com> Reply-To: "John D'Errico" <woodchips@rochester.rr.com> NNTP-Posting-Host: www-00-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1298840525 11532 172.30.248.45 (27 Feb 2011 21:02:05 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Sun, 27 Feb 2011 21:02:05 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 869215 Xref: news.mathworks.com comp.soft-sys.matlab:712748 "Roger Stafford" wrote in message <ikedib$582$1@fred.mathworks.com>... > "Nasser M. Abbasi" <nma@12000.org> wrote in message <ikdt79$bdd$1@speranza.aioe.org>... > > On 2/27/2011 7:42 AM, John D'Errico wrote: > > > ....... > > > I could not resist trying out my new toolbox in MATLAB. > > > > > > FPF is a class that allows you to work in floating point > > > arithmetic with a user specified precision. So here, with > > > 50 digits of precision in all computations... > > >....... > > ...... > > Fyi, here is the result from Mathematica using 50 digits > > precision, it matches your results. Note, while comparing, > > Mathematica has 50 digits after the decimal point, the above > > output has 49 digits after the decimal. > > ...... > - - - - - - - - - - > I used the direct formula p(n) = (-1)^n * (!n * exp(1) - n!) with the symbolic toolbox set at a precision of 100 to compute p(17:20) accurately for comparison purposes and noticed a curious phenomenon. By n = 20 John's value has lost about 20 decimal places of accuracy from the original 50, which one would more or less expect from the intrinsic nature of the iteration. However Nassar's answers apparently remain accurate to the full 50 digits which is very surprising since he is using the same iteration. How did you manage that using only 50 digits precision, Nassar? Possibly you are getting more precision than you realize with Mathematica. > > Here are our respective results for n = 20: > > John 0.1238038307625699486913961699581691307326964474879 > Nassar 0.12380383076256994869139616995822245119978530814180 > Roger .123803830762569948691396169958222451199785308141796375457917 > > The significance of this as far as John's results are concerned is that if we were to continue the same iteration up to, say, n = 100, doing everything with only 50 decimal digit precision, the results would surely have deteriorated catastrophically. Nassar's results remain a puzzle to me but presumably for a sufficiently large n his results would also begin to show a rapid decline in accuracy using this algorithm. > > Roger Stafford Yes, but then nothing stops me from using as many extra digits as I need. I'm not saying this is a good solution, as it is not. It is rarely a good idea to substitute the brute force of high precision for the finesse of good numerical analysis. John