MathGroup Archive 1997

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

Search the Archive

Re: problems with precision

> I am a french student doing a trainee on mathematica. There is another
> team having the same project as I have but it's working with Maple.
> We had to calculate with high accuracy (more than 20 digits) the solution
> of a 2 dimensional non-linear system. The problem to solve was very easy.
> But Maple and Mathematica agreed only on the 15 first digits. I used the
> function SetPrecision. Is there another function to set calculus precision
> ?
> Here is the listing of my routine in Mathematica :
> rr=Table[FindRoot[{x+Cos[y]*Sinh[x]==0,y+Sin[y]*Cosh[x]==0},{x,N[Abs[Cos[(2*p-1)*Pi+Pi/4]]Sqrt[((2*p-1)*Pi+Pi/4/Sin[(2*p-1)*Pi+Pi/4]^2)-1]]},{y,(2*p-1)*Pi+Pi/4}]
> , {p, 1, 20, 1}]
> rr=SetPrecision[rr,20]
> ListPlot[{x, y} /. rr]
> r={x, y} /. rr;

Here is an input that will give 20 digits of accuracy.

            {x,Abs[Cos[(2*p-1)*Pi+Pi/4]] *
              AccuracyGoal -> 20, WorkingPrecision -> 26],
                  {p, 1, 20, 1}]

The SetPrecision function simply sets the number of significant digits
to the specified value, without doing any additional calculations.  In
your program, the initial calculation is done using machine precision,
which is about 16 digits, so SetPrecision[rr, 20] artificially raises the
precision to 20, by padding the results with (effectively) random numbers.  
That is probably not what you wanted.

Although there are important computational reasons to use SetPrecision
(or SetAccuracy) to either raise or lower the number of significant
digits in a result, it is rarely if ever mathematically useful to raise
the precision of the result.  To get a mathematically meaningful
high-precision result, it is necessary to use high-precision inputs,
and do a high-precision calculation.

Dave Withoff
Wolfram Research

  • Prev by Date: RE: problems with precision
  • Next by Date: Re: Algebra Problem
  • Previous by thread: RE: problems with precision
  • Next by thread: Patterns