4
$\begingroup$

I have to do an activity with students in a laboratory where only Mathematica 5.2 is available .

I would to do some animations, but in 5.2, from what I understand, I should select the series of graphics produced by Animation, or by some other means, and type Ctrl-Y.

Is there some way to automate this process to obtain an animation similar to what is available in later versions of Mathematica?

$\endgroup$
  • 1
    $\begingroup$ one way would be to upgrade Mathematica in laboratory. $\endgroup$ – garej Mar 30 '16 at 20:23
  • $\begingroup$ I am thinking of something like Animate[g[ω], {ω, 1, 2}] SelectionMove[EvaluationNotebook[], All, GeneratedCell] SelectionAnimate[EvaluationNotebook[]] $\endgroup$ – enzotib Mar 30 '16 at 20:27
  • $\begingroup$ @garej: would be nice, but it's out of my control. $\endgroup$ – enzotib Mar 30 '16 at 20:30
  • 2
    $\begingroup$ I'm truly impressed at the number of people who have copies of V5.2 around to test the answers. $\endgroup$ – Brett Champion Mar 31 '16 at 5:02
  • 1
    $\begingroup$ @Brett, the old versions have their charms. ;) $\endgroup$ – J. M. is away Mar 31 '16 at 11:25
8
$\begingroup$

I don't have version 5.2, and this type of animation no longer works properly in version 9, which is the oldest version I have installed. So what I show below is only an untested starting point for something more robust. I hope it will be helpful.

animate[frames_] := Module[{},
  Scan[Show, frames];
  SelectionMove[EvaluationNotebook[], Previous, CellGroup];
  FrontEndTokenExecute["OpenCloseGroup"];
  FrontEndTokenExecute["SelectionAnimate"]
]

frames must be a list of graphics, e.g.

frames = Table[
   Graphics[{Circle[{0, 0}, 1], Circle[{Cos[x], Sin[x]}, 1]}, 
    PlotRange -> {{-2, 2}, {-2, 2}}, AspectRatio -> 1], {x, 0, 2 Pi, 2 Pi/20}];

animate[frames]

As I remember in v5.2 Show caused the graphics to be rendered into a new cell, but I may be wrong ... in v6 and later this would be Print, which I used to test this (sort of, my notebook display gets corrupted when I try it in v9/v10 ...)

$\endgroup$
  • $\begingroup$ I added small corrections to make it run correctly (Circle apparently doesn't use defaults in version 5.2). $\endgroup$ – Jens Mar 30 '16 at 21:43
  • $\begingroup$ Tested it on 5.2; works well. $\endgroup$ – J. M. is away Apr 1 '16 at 2:50
5
$\begingroup$

What I did back in the day instead of explicitly loading Graphics`Animation`​ was to use either of Table[] or Do[], depending on whether I was interested in further exporting the animation to a GIF or not. Since graphics in old Mathematica was a side effect (hence the need for the old DisplayFunction gymnastics), one merely collapsed the set of pictures thus produced, and then double-clicked on the cell group if one wants to see the animation.

Thankfully, this machine I'm using has 5.2, so I can show an example:

an animation in 5.2

Notice the six tiny buttons in the lower left? Those controls show up after double-clicking the group of graphics cells. Most people now might not be able to guess what the second button did: it allowed one to run the animation forwards first, as usual, and then backwards. Nowadays one now has to do something like ListAnimate[Join[#, Reverse[Most[#]]] & @ list] for this.

$\endgroup$
  • 1
    $\begingroup$ There's a button on an Animator to toggle play direction. Clicking it three times gives for "forwards-then-backwards" if I remember it correctly. Presumably that corresponds to an Animate option. $\endgroup$ – b3m2a1 Aug 29 '17 at 0:06
1
$\begingroup$

In his book "The Mathematica Guidebook for Graphics", which was written at the time of Mathematica 5, Michael Trott gives a lot of examples of animations. His technique was to create a separate notebook for each animation and to launch the notebook with :

FrontEndExecute[{
      FrontEnd`NotebookLocate[
   FrontEnd`FileName[{"Animations"}, "2_1_TreeOfPythagoras.nb"]]}]

This assumes that the target notebook is "./Animations/2_1_TreeOfPythagoras.nb"

This code of Trott his hided in the style of the some buttons that permit to a user to launch the animation.

I have not tested this code

$\endgroup$

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.