The interface Manipulate supports to display different scenes as parameter changed dynamically.

eg: Manipulate[Plot[Sin[a*x], {x, 0, 10}], {a, 1, 5, 1}]

 

If there is no step for variable a, it can vary continuously.

Manipulate[Plot[x^a, {x, 0, 10}], {a, 1, 5}]


It also lets us set up any number of controls.

eg: Manipulate[Plot[a*x^2 + b*x + c, {x, -10, 10}], {a, 0, 5, 1}, {b, 1, 5, 1}, {c, 0, 5, 1}]


We can tell Manipulate a list of possible values for function control, it lets the user choose between these possible values.
Lets create a red sphere firstly, Graphics3D[Style[Sphere[{0, 0, 0}], Red]]

Then we construct a color collection and choose the relevant parameter in it.

Manipulate[Graphics3D[Style[Sphere[{0, 0, 0}], Color]], {Color, {Red, Green, Blue}}]


Exercises:
Make a Manipulate to show a disk with red, green and blue color components varying from 0 to 1.

Manipulate[Graphics[Style[Disk[], RGBColor[RColor, GColor, BColor]]], {RColor, 0, 1}, {GColor, 0, 1}, {BColor, 0, 1}]


Categories: Math

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

You cannot copy content of this page