MathGroup Archive 2003

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

Search the Archive

Re: Numerical precision problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43104] Re: Numerical precision problem
  • From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
  • Date: Tue, 12 Aug 2003 04:43:14 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Daniel Lichtblau suggested forcing the use of high precision arithmatic with
the following.

fhighprecision[r_,{t1_,t2_},{d1_,d2_},prec_]:= With[
  {bigr=Rationalize[r,0], bigt1=Rationalize[t1,0], 
  bigt2=Rationalize[t2,0], bigd1=Rationlize[d1,0], 
  bigd2=Rationalize[d2,0]},
  N[f[bigr,{bigt1,bigt2},{bigd1,bigd2}],prec]
]

---------------------------
I suggest that instead of 
    Rationalize[x, 0]
one use 
    SetPrecision[x, Infinity]
since SetPrecision is about 26 times faster using Mathematic 4.1.  
In other cases you don't want to use SetPrecision because it typically
returns a rational number with many more digits in the numerator and
denominator.  However the excessive digits in the rational approximation are
of no concern in this case.

--------------------
Regards,
Ted Ersek

Download Mathematica tips, tricks from
http://www.verbeia.com/mathematica/tips/Tricks.html


  • Prev by Date: Re: Locating errors
  • Next by Date: Re: NDSolve
  • Previous by thread: Re: Numerical precision problem
  • Next by thread: Working and Printout environments