3
$\begingroup$

Consider this code

f[x_, y_, t_] := t Sin[2 Pi x] + 2 t Sin[2 Pi y]
Manipulate[
 Plot3D[f[x, y, t], {x, 0, 1}, {y, 0, 1}, PlotRange -> {-5, 5}], {t, 
  1, 2}]

If we change the value of parameter t by clicking on the slider then the plot is evaluated almost instantly. But, if we use the control button to change the value of t, Mathematica needs few moments to draw the surface. This is definitely an anomaly on how Manipulate works. I propose this problem should be addressed as bug so it can be fixed in the future release. I run Mathematica 10.4 Win 10 64bit on Intel i7 with 8GB or RAM. I am sure my machine is powerful enough to plot.

$\endgroup$
  • 1
    $\begingroup$ Interesting observation; I can reproduce it in v. 10.4; however, you can simply set PerformanceGoal -> "Quality" and both methods of changing the parameter will behave the same way. $\endgroup$ – MarcoB Mar 13 '16 at 1:25
  • $\begingroup$ I don't observe the behavior. The performance could be considered slow, but it seems pretty much the same time to respond in either case. (~0.15s on the crappy display, ~0.22s on the Retina display, V10.4, Mac) $\endgroup$ – Michael E2 Mar 13 '16 at 1:52
  • $\begingroup$ Your plot is clipped for the larger values of t because of the specified PlotRange. Recommend that you use PlotRange -> range where range = (#[{f[x, y, t], 0 <= x <= 1, 0 <= y <= 1, 1 <= t <= 2}, {x, y, t}][[1]]& /@ {Minimize, Maximize}); $\endgroup$ – Bob Hanlon Mar 13 '16 at 3:05
1
$\begingroup$

The problem is that Mathematica is continuously trying to draw your 3D plot over-and-over again as you move the slider thumb (what you call the control button) and it can't keep up. To get better behavior, I suggest you add the option ContinuousAction -> False -- like so:

f[x_, y_, t_] := t Sin[2 Pi x] + 2 t Sin[2 Pi y]
Manipulate[
  Plot3D[f[x, y, t], {x, 0, 1}, {y, 0, 1}, PlotRange -> {-5, 5}],
  {t, 1, 2},
  ContinuousAction -> False]

This will make moving the slider thumb work in the same way as clicking in the slider channel by suppressing the plot redraw while the thumb is moving.

$\endgroup$
  • $\begingroup$ By control button I mean the buttons with plus and minus sign. $\endgroup$ – Sukan Mar 14 '16 at 2:42
  • $\begingroup$ Actually MarcoB's solution fixes the issue. $\endgroup$ – Sukan Mar 14 '16 at 2:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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