4
$\begingroup$

When I do the following simple animation (from the book Mathematica Navigator, p. 316) the slider control changes the image smoothly, but when I play the animation it is jerky. Is there anything that can be done to make the animation smooth?

enter image description here

The code for the plot is as follows:

Manipulate[Plot[Cos[a x], {x, 0, 3 \[Pi]}], {a, 1, 10, 0.3}]

UPDATE: Changing the step value does not help; also, sometimes the animation stops completely, just gets stuck. Something appears to be seriously wrong with the animate function.

The main problem, the jerkiness, appears to be caused by Windows "User Account Control" (UAC) (see answer below). This "security" feature is present in Windows 7, 8 and Windows Vista. It can be avoided by either running Mathematica as Administrator or by turning off Windows UAC altogether.

$\endgroup$
5
  • $\begingroup$ I'm not sure if I understand you, but does the fixed step help? For example {a, 1, 10, .01}? $\endgroup$
    – Kuba
    Commented Oct 28, 2013 at 20:50
  • $\begingroup$ It does not help very much. There is still a lot of jerkiness, meaning that the animation does not play smoothly, but stops at random places and then resumes after a random delay. $\endgroup$ Commented Oct 28, 2013 at 21:17
  • $\begingroup$ Maybe there is a lot of other dynamic cells around which can slow it down? Have you tried on new notebook after reseting the kernel? $\endgroup$
    – Kuba
    Commented Oct 28, 2013 at 21:18
  • $\begingroup$ The example is from a new notebook after Mathematica is first opened. Nothing else is in the notebook. $\endgroup$ Commented Oct 28, 2013 at 21:29
  • 1
    $\begingroup$ Please do not put code into questions as an image. People don't like having to type your code into Mathematica, when with a little consideration on your part, you can provide your code in text which can be copied from the site and pasted into Mathematica. $\endgroup$
    – m_goldberg
    Commented Oct 29, 2013 at 0:08

3 Answers 3

3
$\begingroup$

Seems to be an artifact of high speed updating of the plot. On my system, V9.0.1 running on OS X, the animation becomes smooth when a has an increment of 0.2 or larger. That is

Manipulate[Plot[Cos[a x], {x, 0., 3. \[Pi]}],
  {a, 1., 10., 0.2}]

looks smooth on my system. I think this because the problem becomes more noticeable as the value of a increases, and further, reducing the update speed with the Slower button when the animation is running will smooth it out.

$\endgroup$
1
  • $\begingroup$ Changing the step to 0.2 or 0.3 does not help in my case. Still jerky. Also, sometimes it stops entirely and just gets stuck. $\endgroup$ Commented Oct 29, 2013 at 16:31
2
$\begingroup$

Perhaps generating the frames in advance would help create a smoother animation - but to my eyes there's not a huge difference - and there's a big wait at the beginning - it depends on what your use case is...

ListAnimate[
 Table[
  Plot[Cos[a x], {x, 0., 3. \[Pi]},
   PerformanceGoal -> "Quality",
   PlotRange -> {-1, 1}], {a, 1, 10, .01}]]

listanimate

$\endgroup$
1
  • $\begingroup$ This isn't an animated gif, for obvious reasons...:) $\endgroup$
    – cormullion
    Commented Oct 29, 2013 at 8:33
1
$\begingroup$

Further investigation showed this to be a problem when running Mathematica as a user under Windows 7. Under Windows XP and other environments the animation runs smoothly.

A workaround is to run Mathematica as Administrator on Windows 7 in which case there no UI pauses or animation pauses. Why running as an administrator makes a difference, I don't know.

Even running as administrator does not prevent the animation from stopping entirely at random points, but this appears to be from some different cause.

$\endgroup$
1
  • $\begingroup$ It might be an idea to specify Mathematica versions, OS configurations, memory, etc. somewhere (in the question, perhaps) - it's an interesting result! $\endgroup$
    – cormullion
    Commented Oct 29, 2013 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.