MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Run initialization cells before dynamic cells

  • To: mathgroup at smc.vnet.net
  • Subject: [mg94354] Re: Run initialization cells before dynamic cells
  • From: Damon <damonwischik at gmail.com>
  • Date: Thu, 11 Dec 2008 03:43:18 -0500 (EST)
  • References: <ghnfih$nl3$1@smc.vnet.net>

> Its is not clear why you have problems. Are there some reasons forcing yo=
u to keep
> a special cell structure of your notebook?

No, I need no special cell structure. But I wanted to have just a
single notebook with
definitions and demonstrations.

> If this is the case, just put definitions of expressions necessary for de=
monstrations before
> the definition of the first demonstration that uses it. Of coarse you nee=
d to be careful,
> but that=B4s all.
> There is a better solution. In this situation I placed all the preliminar=
y definitions into
> one, very first cell of the notebook. This cell was executed first. After=
 that I placed
> cells with demonstrations.

I don't understand. You say "before" -- but the whole point of Dynamic
and Manipulate is that
they set up a different order of execution. If I have a Dynamic cell
in my notebook then I find it
is executed (i.e. refreshed) as soon as it is viewed, regardless of
its sequence in the notebook.
Can you please show me an example, in which you have a Dynamic or
Manipulate cell which
is guaranteed to be executed only _after_ the very first cell?

> Finally, you could place both preliminarily definitions as well as defini=
tions of demos
> into the first notebook, so that their execution will open a second noteb=
ook and
> the demos will be shown there.
> If the last idea is of any help for you, find a simple example below. Put=
 it into one
> or two cells (this is not important), and execute.

Thank you for your example. I hadn't thought of splitting my notebook
into two separate
parts. I notice that in your example, if I save the demonstration
notebook and then load
it into a new Mathematica session, then the demonstrations do not
work. The reason they
do not work is because they rely on outside definitions, and those
outside definitions are
not stored with the demonstration notebook.

So, your example works fine if I'm happy with creating a second
notebook whenever I
want to display the demo. I'd rather not do this. Can you suggest how
I could get round
the problem?

Note: I am using Dynamic rather than Manipulate, therefore I cannot
use the SaveDefinitions
option.

Damon.


  • Prev by Date: Re: NonlinearFit of an "implicit" function
  • Next by Date: Re: FiniteGroupData[]
  • Previous by thread: Re: Run initialization cells before dynamic cells
  • Next by thread: AstronomicalData