## Animating Plots in Mathematica

A friend asked me how to animate a polar plot graphing in Mathematica. It’s really easy. The Animate and Manipulate commands added in version 6 are a huge step in interactive mathematical visualizations. The easiest way to visualize it is to have the upper plot range vary from a 0+ϵ to 2π.

```
Animate[
PolarPlot[2 Cos[4 x], {x, 0, y},
PlotRange -> {{-2, 2}, {-2, 2}}],
{y, 0.001, 2}
]
```

But, I thought this would be a good opportunity to try out Wolfram’s recently introduced Computable Document Format which makes Mathematica files interactive in the web browser. Instead of having to buy an expensive Mathematica license to play with interactive Mathematica tools, CDFs are accessible right from the browser. If you haven’t already, you’ll have to install the CDF Player (free from Wolfram) to view my animation^{1}. Try clicking the different functions to see their polar plots drawn.

Here’s code which you should be able to copy and paste right into Mathematica.

```
Manipulate[
PolarPlot[f[\\[Theta]], {\\[Theta], 0, \\[Mu]},
PlotRange -> {{-2, 2}, {-2, 2}}
],
{{f, 2 Cos[4 #] &, "Function"},
{
Sin -> "r=Sin[\\[Theta]]",
2 Cos[4 #] & -> "r=2 Cos[4\\[Theta]]",
2 Cos[16 #] & -> "r=2 Cos[16\\[Theta]]"
}, ControlType -> SetterBar},
{\\[Mu], 0.001, 2 \\[Pi]},
ControlType -> Animator,
AppearanceElements -> None
]
```

- Wolfram has recently made their massive collection of Demonstrations interactive through the CDF format. This is a great feature for math teacher and students.
^{[return]}