We’ve been using the Manipulate function in class a lot. Here are a couple of quick tips and examples.

The basic idea is to take something you Mathematica to do and add a parameter. For example, suppose you want to plot for various values of . The first thing I would do is plot the function with some sample value, such as .

Plot[Cos[2*t], {t, 0, 2 Pi}]

Next we wrap the whole thing in a `Manipulate`

function, with some parameter `w`

.

Manipulate[Plot[Cos[2*t], {t, 0, 2 Pi}], {w, 2, 4}]

Notice that nothing happens, because we haven’t made anything dependent on `w`

.

Now we replace the `2*t`

with `w*t`

:

Manipulate[Plot[Cos[w*t], {t, 0, 2 Pi}], {w, 2, 4}]

Notice that Mathematica often does a lot of automatic formatting, which can lead to deceiving results. Here is a poorly designed Manipulation:

Manipulate[Plot[w*Cos[w*t], {t, 0, 2 Pi}], {w, 2, 4}]

Here is a better version of that same Manipulation. (Why is it better?)

Manipulate[Plot[w*Cos[w*t], {t, 0, 2 Pi}, PlotRange -> 5], {w, 2, 4}]

Here is another poorly designed example:

Manipulate[Plot[Cos[2 t] Cos[(2 - a) t], {t, 0, 10 Pi}], {a, 0, .5}]

What should you do to make it better?

Finally, here is another fun example:

Manipulate[ StreamPlot[{x - x^2 - a*x*y, -y + a*x*y}, {x, -.5, 1.5}, {y, -.5, 1}], {a, 0, 4}]