Differential Equations - Manipulate

A Theoretical Introduction to Manipulate

I.

The single command Manipulate lets you create an astonishing range of interactive applications with just a few lines of input.

Manipulate is designed to be used by anyone who is comfortable using basic commands such as Table and Plot: it does not require learning any complicated new concepts, nor any understanding of user interface programming ideas.

The output you get from evaluating a Manipulate command is an interactive object containing one or more controls (sliders, etc.) that you can use to vary the value of one or more parameters. The output is very much like a small applet or widget: it is not just a static result, it is a running program you can interact with.

At its most basic, the syntax of Manipulate is identical to that of the humble function Table. Consider this Table command, which produces a list of numbers from one to twenty.

In[1]:=      Table[n, {n, 1, 20}]

Out[1]=   {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}

Simply replace the word Table with the word Manipulate, and you get an interactive application that lets you explore values of n with a slider.

In[2]:=     Manipulate[n, {n, 1, 20}]

     

In both Table and Manipulate, the form {variable, min, max} is used to specify an "iterator", giving the name of the variable and the range over which to vary it. Of course the whole point of Manipulate (and Table for that matter) is that you can put any expression you like in the first argument, not just a simple variable name. Moving the slider in this very simple output already starts to give an idea of the power of Manipulate.

     

Note that the slider has an extra icon next to it which, when clicked, opens a small panel of additional controls. Here, the panel from the previous example is opened.

       

The panel allows you to see the numerical value of the variable, as well as set it in motion using the animation controls.

Just like Table, Manipulate allows you to give more than one variable range specification.

  

Now practice the above scripts: 

Manipulate1Wolfram Technology at Howard University | Howard University ...

II.

Let's look at other types of controls.

a) Buttons

Manipulate[Plot[Sin[10 x], {x, 0, 2 Pi}, Filling -> filling,  PlotRange -> 2], {n, 1, 20}, {filling, {None, Axis, Top, Bottom}}]

b)  Popup menu

Manipulate[Plot[Sin[10 x], {x, 0, 2 Pi}, Filling -> filling,  PlotRange -> 2], {n, 1, 20}, {filling, {None, Axis, Top, Bottom, Automatic, 1, 0.5, 0, -0.5, -1}}]

c) Checkbox

Manipulate[Plot[Sin[10 x], {x, 0, 2 Pi}, Frame-> frame,  PlotRange -> 2], {n, 1, 20}, {frame, {True, False}}]

Now practice the above scripts: 

Manipulate2Wolfram Technology at Howard University | Howard University ...