Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

Re: High precision numbers and Plot[] ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg13685] Re: High precision numbers and Plot[] ?
  • From: "Allan Hayes" <hay at haystack.demon.cc.uk>
  • Date: Sat, 15 Aug 1998 04:39:16 -0400
  • References: <6qp3b3$ajn@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

a_kowald wrote in message <6qp3b3$ajn at smc.vnet.net>...
>Hello,
>
>I try to plot a function where I have to use high precision numbers.
>That means to get the correct answer I have to use N[f,50]. I set the
>Compiled option of plot to false and tried:
>
>Plot[N[f,50], {i, start, end}, Compiled -> False]
>
>However, this doesn't work. The result is the same as:
>Plot[f,{i,start,end}]
>

Axel

We need to set all inexact numbers to high precision *before* any
calculation, so that the calculation is performed with high precision.
But due to the internal algorithms the following does not owork

Plot[Sin[SetPrecision[1.3,50] i], {i, SetPrecision[.00,50],
SetPrecision[7.0, 50]}, Compiled ->False]

We can see this via
Take[Cases[%, Line[pts_]:>pts, Infinity][[1]],5]
            -7            -7
{{2.91667 10  , 3.79167 10  }, {0.283969, 0.360832},

  {0.431771, 0.532289}, {0.593662, 0.697398},

  {0.745955, 0.824739}}

Precision[%]
16

However we can use Table and ListPlot

Unevaluated[
Table[{i,Sin[1.3 i]},
{i, .0, 7.0, .05}]
]/. n_?NumericQ :> SetPrecision[n, 50];

Unevaluated lets  us set the precision before computing the table.

ListPlot[%, PlotJoined ->True]

Check on the precision

Take[Cases[%, Line[pts_]:>pts, Infinity][[1]],5] {{0, 0},
{0.050000000000000002775557561562891351059079170227\

    05, 0.06495423883478260695996976817219933988821274148865}

   , {0.10000000000000000555111512312578270211815834045410,

   0.12963414261969487110018168051065145187609336196651},

  {0.15000000000000000832667268468867405317723751068115,

   0.1937665349624219448451946176788366530822718717143},

  {0.20000000000000001110223024625156540423631668090820,

   0.2570805518921551198844649586959233781992040676361}} Precision[%]
50

Allan
------------------------------------------------------------- Allan
Hayes
Training and Consulting
Leicester UK
http://www.haystack.demon.co.uk
hay at haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44(0)116 271 8642



  • Prev by Date: .nb and .m MIME types?
  • Next by Date: Question for using complex variables
  • Previous by thread: RE: High precision numbers and Plot[] ?
  • Next by thread: Re: High precision numbers and Plot[] ?