MathGroup Archive 2011

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

Search the Archive

f(x)=x: why Plot continues to add new levels of recursion?


Please consider the following example (plotting function f(x)=x):

NumberOfEvals[r_] :=
    Plot[x, {x, -Pi, Pi}, MaxRecursion -> r,
     EvaluationMonitor :> Sow[x]]][[2, 1]]]
data = Table[{r, NumberOfEvals[r]}, {r, 0, 15}];
f = Fit[data, {1, r, r^2}, r] // Factor
Show[ListPlot[data, Axes -> False, Frame -> True,
  FrameLabel -> {"MaxRecursion", "Number  of evaluation  points "},
  PlotLabel -> StandardForm@"Plot[x,{x,-\[Pi],\[Pi]}]"],
 Plot[f, {r, 0, 15}, PlotRange -> All]]

=> (100 + 3 r + r^2)/2
=> <Graphics>

One can see that the number of evaluation points for function f(x)=x
grows as (100 + 3 r + r^2)/2 where 'r' is the value of option

It is clear that in the case of f(x)=x it is not necessary to go
deeper in recursion because the bend angle between successive segments
of the
approximating polyline in this case is always approximately equal to
zero. In Mathematica 5.2 Plot does no recursion in this case:



Why in Mathematica 7 Plot makes these superfluous evaluations? Is it
possible to force it to behave like Plot in version 5.2?

  • Prev by Date: Re: Confusing Result with Series
  • Next by Date: Re: Confusing Result with Series
  • Previous by thread: Re: How to generate report with Mathematica script from command line (no front end)
  • Next by thread: Texture in version 8, fine, but don't export...?