MathGroup Archive 2010

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

Search the Archive

Question about Plot[] algorythm.

  • To: mathgroup at
  • Subject: [mg107554] Question about Plot[] algorythm.
  • From: Alexey <lehin.p at>
  • Date: Wed, 17 Feb 2010 07:01:03 -0500 (EST)

I am wondering that sometimes Plot[] takes a huge number of points
where a function changes very slowly. And it takes less points where
the function changes rapidly! Consider the following:

cache = {};
f[x_?NumericQ] := (AppendTo[cache, x]; 5 Csc[x]);
pl = Plot[f[x], {x, 0, 2}, PlotRange -> {Full, {0, 140}}];
Show[Histogram[cache], pl, PlotRange -> {All, {0, 140}}]
cache // Length

It is easy to see that Plot takes 122 points around x=1.5 - where the
function is nearly constant! But around x=0.3 (where the function
changes rapidly) it takes only 50 points!

Can anyone explain this?

  • Prev by Date: Re: can't get ListVectorPlot3D to work.
  • Next by Date: Date & Time format..
  • Previous by thread: DDFLink
  • Next by thread: Re: Question about Plot[] algorythm.