Re: re: Accuracy and Precision

*To*: mathgroup at smc.vnet.net*Subject*: [mg37177] Re: re: Accuracy and Precision*From*: "Allan Hayes" <hay at haystack.demon.co.uk>*Date*: Tue, 15 Oct 2002 04:17:53 -0400 (EDT)*References*: <200210110758.DAA01962@smc.vnet.net> <200210120904.FAA11982@smc.vnet.net> <aobg22$hrn$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

"Mark Coleman" <mark at markscoleman.com> wrote in message news:aobg22$hrn$1 at smc.vnet.net... > Greetings, > > I have read with great interest this lively debate on numerical prcesion and > accuracy. As I work in the fields of finance and economics, where we feel > ourselves blessed if we get three digits of accuracy, I'm curious as to what > scientific endeavors require 50+ digits of precision? As I recall there are > some areas, such as high energy physics and some elements of astronomy, that > might require so many digits in some circumstances. Are there others? > > Thanks > > -Mark Mark, There may be occasions when the outcome of a "real" process is so sensitive to changes in input that unless we know very precisely what the input is then we can know very little about the outcome - chaotic processes are of this kind. The difficulty is real and no amount of computer power or clever progamming will do much about it. Another situation is when the the process is not so sensitive but calculating with our formula or programme introduces accumulates significant errors. Here is a very artificial example of the latter (I time the computation and find the MaximumMemory used in the session as we go through the example): ser=Normal[Series[Cos[#],{#,0,200}]]; MaxMemoryUsed[] 1714248 Calculating with machine number does not show much of a pattern ( I have deleted the graphics - please evaluate the code), pts= With[{ss=ser},Table[ {#,ss}&[x], {x,50.,70., .1}]];//Timing ListPlot[pts, PlotJoined->True]; MaxMemoryUsed[] {5.11 Second,Null} 1723840 Using bigfloat inputs with precision 20 shows some pattern: pts= With[{ss=ser},Table[ {#,ss}&[SetPrecision[x,20]], {x,50.,70., .1}]];//Timing ListPlot[pts, PlotJoined->True,PlotRange\[Rule]All]; MaxMemoryUsed[] {17.52 Second,Null} 1759664 Precision 40 does very well: pts= With[{ss=ser},Table[ {#,ss}&[SetPrecision[x,40]], {x,50.,70., .1}]];//Timing ListPlot[pts, PlotJoined->True,PlotRange\[Rule]All]; MaxMemoryUsed[] {19.38 Second,Null} 1797072 Now we might think the correct outcomes are showing up, and use an interpolating function for further , and faster, calculation. f=Interpolation[pts] InterpolatingFunction[{{50.000000,70.00000}},<>] pts= Table[ f[x],{x,50, 70, .1}];//Timing ListPlot[pts, PlotJoined->True,PlotRange\[Rule]All]; MaxMemoryUsed[] {0.33 Second,Null} As a matter of interest, this is what happens if we substitute exact numbers (rationals and integers) for reals-- the computation takes an excessively long time and quite a bit more memory. pts= With[{ss=ser},Table[ {#,ss}&[SetPrecision[x,Infinity]], {x,50.,70., .1}]];//Timing ListPlot[pts, PlotJoined->True,PlotRange\[Rule]All]; MaxMemoryUsed[] {992.28 Second,Null} 2413808 This also shows that we may in fact want to replace exact inputs with bigfloats. I should be interested to hear of other example, really "real" one in particular. I imagine that there are many situations where trends and shapes are more important than specific values. -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565 > > > <snip> > > >

**References**:**re: Accuracy and Precision***From:*Daniel Lichtblau <danl@wolfram.com>