6
$\begingroup$

When making a plot,

PlotPoints

or

MaxRecursion

options are used to specify the accuracy or the extent of how detailed the result will be.

Ff either of them do the similar job, I think only one option of the two is enough for the purpose.

Then, why the two are used in Mathematica? What is the fundamental difference between them?

$\endgroup$
2
  • 5
    $\begingroup$ FYI the documentation for Plot states it fairly clearly - "Plot initially evaluates f at a number of equally spaced sample points specified by PlotPoints. Then it uses an adaptive algorithm to choose additional sample points, subdividing a given interval at most MaxRecursion times. " $\endgroup$ Commented Jan 26, 2016 at 19:26
  • $\begingroup$ The practical issue is which of the two to use when, in order to improve quality (and perhaps fidelity) of a given plot. $\endgroup$
    – murray
    Commented Jan 26, 2016 at 23:15

1 Answer 1

14
$\begingroup$

PlotPoints guarantees a number of points that will be plotted. MaxRecursion states the maximum recursion, which might not be needed or used in a given plot. If I'm plotting a large number of functions—some simple, some complex—then I use MaxRecursion so as to speed the plotting of "simple" graphs.

Moreover, PlotPoints generally places the points equally spaced while MaxRecursion effectively places the extra detail in positions of the plot with rapidly changing function, as is evident in the small-$x$ values in the graph: Plot[Sin[1/x], {x, 0, 1}].

$\endgroup$
3
  • $\begingroup$ Thank you for the answer. If I may ask, what do you mean by "with large oscillations" in "MaxRecursion effectively places the extra detail in positions of the plot with large oscillations."? $\endgroup$ Commented Jan 27, 2016 at 18:49
  • 1
    $\begingroup$ @SmartHumanism: Look at Plot[Sin[1/x], {x, 0, 1}]. For values to the right, the curve is smooth, so you might need points at values such as $x = .9, .91, .92, ...$. Look at the left of the graph. The function varies so rapidly that you must use points such as $x = .1, .1000001, .1000002, .1000003, ...$. $\endgroup$ Commented Oct 12, 2018 at 16:21
  • $\begingroup$ Thank you very much. $\endgroup$ Commented Oct 13, 2018 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.