Manipulate
Manipulate[expr_, {u_Symbol, min_, max_}..]
Manipulate[expr_, {{u_Symbol, initial_}, min_, max_}..]
Manipulate[expr_, {{u_Symbol, initial_}, min_, max_, step_}..]
Manipulate[expr_, {{u_Symbol, initial_, label_String}, min_, max_, step_}..]
generates a version of expr
with controls added to allow interactive reevaluation
Manipulate[expr_, {{u_Symbol}, values_List}..]
Manipulate[expr_, {{u_Symbol, initial_}, values_List}..]
Manipulate[expr_, {{u_Symbol, initial_, label_String}, values_List}..]
Options
"UpdateFunction"
Allows to alter the expression, prevent default actions or cause side-effects upon update. The following return values are expected
Function[input,
(* side effects *)
(* RETURN *)
True <- accept change
False <- prevent default
_String <- will be written instead
]
One can completely bypass the default reevaluation and use side-effects only
Module[{r},
Manipulate[Graphics[Disk[{0,0}, r//Offload]],
{{radius, 1}, 0,1},
"UpdateFunction" -> Function[value,
r = value;
False (* always reject *)
]
]
]
However, we do recommend to use InputRange directly instead of Manipulate
for such cases.
Examples
Manipulate Series
Manipulate[Series[Sinc[x], {x, 0, n}], {n, 1, 5, 1}]
Manipulate[Plot3D[Sin[n x] Cos[n y], {x,-1,1}, {y,-1,1}], {n, 1, 5, 1}]
Manipulate
reevaluates the whole expression similar to Refresh, which is a huge overhead for the system. Please, consider to use ManipulatePlot, AnimatePlot, ManipulateParametricPlot or general dynamics using Offload (see Dynamics) for any plots, rapidly changing data and smooth transitions instead of Manipulate
.
Manipulate
is caching all results by the default.
Example with mixed symbolics and graphics