Manipulate
doesn't always evaluate in the order I expect it to. What is the evaluation sequence for Manipulate
and other functions involved with the front end? I have seen the evaluation sequence for kernel only functions, but that was for a reference for Mathematica 3, and doesn't deal with the front end.
Answer
According to my previous experiences and this post, the sequence goes like this (please feel free to correct me in this post):
From the documentation:
Manipulate
generates aDynamicModule
object, with the variablesu
,v
, etc. specified as local.That is, first Manipulate wraps its result into
DynamicModule
, then...- ...gives unique names to local variables (as it is a scoping construct).
- Next, the body of
Manipulate
is evaluated in standard order. - The output cell is created by evaluating the result of the
DynamicModule
(or theManipulate
). - If there was any
Initialization :> init
insideManipulate
, it is now evaluated "when the result is first displayed in a particular session". - If there is any
Deinitialization :> deinit
insideManipulate
and the dynamic output cannot be displayed any more,deinit
is evaluated.
Contraintuitively, Initialization
is called almost ultimately which caused me some frustration over time.
To understand how to load a package with your dynamic content by Needs
, see my answer here.
Comments
Post a Comment