Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: re: Accuracy and Precision

  • To: mathgroup at
  • Subject: [mg37177] Re: re: Accuracy and Precision
  • From: "Allan Hayes" <hay at>
  • Date: Tue, 15 Oct 2002 04:17:53 -0400 (EDT)
  • References: <> <> <aobg22$hrn$>
  • Sender: owner-wri-mathgroup at

"Mark Coleman" <mark at> wrote in message
news:aobg22$hrn$1 at
> Greetings,
> I have read with great interest this lively debate on numerical prcesion
> 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
> scientific endeavors require 50+ digits of precision? As I recall there
> some areas, such as high energy physics and some elements of astronomy,
> might require so many digits in some circumstances. Are there others?
> Thanks
> -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

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):




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];

        {5.11 Second,Null}


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];

        {17.52 Second,Null}


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];

        {19.38 Second,Null}


Now we might think the correct outcomes are showing up, and use an
interpolating function for further , and faster, calculation.



    pts= Table[ f[x],{x,50, 70, .1}];//Timing
    ListPlot[pts, PlotJoined->True,PlotRange\[Rule]All];

        {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];

        {992.28 Second,Null}


This also shows that we may in fact want to replace exact inputs with

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 Hayes
Mathematica Training and Consulting
Leicester UK
hay at
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

> <snip>

  • Prev by Date: Re: defining a function with D
  • Next by Date: Re: Newbie mathematica question
  • Previous by thread: Re: Re: re: Accuracy and Precision
  • Next by thread: Re: re: Accuracy and Precision