2
$\begingroup$

Consider Animate[xs, {xs, {0, 1, 2}}]. By my reading of the documentation,

Animate[expr,{u,{u1,u2,…}}]
makes u take on discrete values u1, u2, ….

my expression should produce an animation that steps from 0 to 1 to 2 and back to 0 in a loop, and, indeed it does:

enter image description here

Now, consider Animate[xs, {xs, {{"A", 0}, {"B", 1}, {"C", 2}}}]. I would expect xs to take on the values {"A", 0}, {"B", 1}, and {"C", 2} in a loop, just as xs took on the values 0, 1, and 2 in a loop. I do not get what I expect. Instead, the display shows only "A", "B", "C" and the slider has a small excursion from 0 to 1 and a large excursion from 1 to 2:

enter image description here

Guessing that the second argument in each list tells Animate how long, relatively, to dwell on each frame, if I turn things around, Animate[xs, {xs, {0, "A"}, {1, "B"}, {2, "C"}}], I get a frozen animator, though with no error message.

Under that hypothesis, I get what I want as follows

enter image description here

or, without the hypothesis, sort-of like this:

enter image description here

Did I miss something in the documentation? Did I misunderstand the documentation? Did I stumble on undocumented (albeit useful) behavior?

$\endgroup$
  • $\begingroup$ nice find! (+++1) $\endgroup$ – kglr Sep 27 '19 at 16:02

Your Answer

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

Browse other questions tagged or ask your own question.