Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
    
I'm not sure if I understand you, but does the fixed step help? For example {a, 1, 10, .01}? –  Kuba Oct 28 '13 at 20:50
    
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. –  Tyler Durden Oct 28 '13 at 21:17
    
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? –  Kuba Oct 28 '13 at 21:18
    
The example is from a new notebook after Mathematica is first opened. Nothing else is in the notebook. –  Tyler Durden Oct 28 '13 at 21:29
1  
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. –  m_goldberg Oct 29 '13 at 0:08

3 Answers 3

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.

share|improve this answer
    
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. –  Tyler Durden Oct 29 '13 at 16:31

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

share|improve this answer
    
This isn't an animated gif, for obvious reasons...:) –  cormullion Oct 29 '13 at 8:33
up vote 1 down vote accepted

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.

share|improve this answer
    
It might be an idea to specify Mathematica versions, OS configurations, memory, etc. somewhere (in the question, perhaps) - it's an interesting result! –  cormullion Oct 29 '13 at 19:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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