I find some strange behaviors of Plot. The code is:
f[x_] := (Print[x]; x);
Plot[f[a], {a, 1, 3}, MaxRecursion -> 0, PlotPoints -> 2,
EvaluationMonitor :> Print[{a, f[a]}]]
And I get the output:
1
a
1.002
1.
1.
{1.,1.}
3.
3.
{3.,3.}
I understand that
1.
1.
{1.,1.}
3.
3.
{3.,3.}
are normal outputs as expected. But what are
1
a
1.002
before that?
EvaluationMonitor, and compare your results withPlot[Evaluate[f[a]], ...]. – Domen Mar 07 '24 at 09:50