MathGroup Archive 1998

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

Search the Archive

Re: PlotPoints Question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg13487] Re: PlotPoints Question
  • From: "Allan Hayes" <hay at haystack.demon.cc.uk>
  • Date: Sun, 26 Jul 1998 02:33:45 -0400
  • References: <6p98ec$b82@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Kevin J. McCann wrote in message <6p98ec$b82 at smc.vnet.net>...
>I wrote a routine the other day to display the points that Plot actually
>uses. Much to my surprise, when I set PlotPoints to some number like 5,
>I found that more than this number were actually used.
>
>For example, try this
>
>p1 = Plot[x^2, {x, 0, 2}, PlotPoints ->5, PlotRange ->All];
>
>and then to
>
>p1//FullForm
>
>You will see that 19 points are actually used. Given all that, what does
>the PlotPoints option really do?
>
>Kevin
>
>

Kevin,

Plot[expr,{x,a,b}] and
ParametricPlot[expr,{x,a,b}]  functions are both adaptive and have the
following control options for the user

PlotPoints -> (pp, say)number of initial sample points MaxBend -> the
max "normalized bend" in degrees between segments to allow before
considering whether to add extra sample points PlotDivision ->
(pd,say)prevents extra sample points between consecutive sample points
closer than about (b-a)/((pp pd)

It looks as if the following, if not something simpler, should give only
5 points in the output.

p1 = Plot[x^2, {x, 0, 2}, PlotPoints ->5, PlotRange ->All,
PlotDivision->1,
MaxBend -> 200]

but in fact it gives 6 points:

Cases[%, Line[pts_]:> pts, Infinity][[1]]
       -7        -13
{{5. 10  , 2.5 10   }, {0.4868038988749894, 0.2369780359598908},

  {1.017705598312484, 1.035724684836571},

  {1.516312396062462, 2.299203282452687},

  {1.995820893249937, 3.983301037932975},

  {1.999999499999999, 3.999998000000248}}

Length[%]

6

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: Re: new user help
  • Next by Date: Re: Re: Re: Is this a bug?
  • Previous by thread: PlotPoints Question
  • Next by thread: Re: PlotPoints Question