Re: Dynamic
- To: mathgroup at smc.vnet.net
- Subject: [mg87463] Re: Dynamic
- From: dh <dh at metrohm.ch>
- Date: Fri, 11 Apr 2008 01:43:43 -0400 (EDT)
- References: <ftfeji$bue$1@smc.vnet.net>
Hi Gianluca,
whow, what stamina!
I can not explain all quircks, but what matters is:
- if you have an expression that you want dynamically updated, you must
wrap it with Dynamic. p+1 is not updated. Dynamic[p]+1 only updates p
not the sum. Therefore, you need: Dynamic[p+1].
- FullForm sort of creates an inactive print form (sorry can not explain
it better)
hop this helps, Daniel
Gianluca Gorni wrote:
> Hi!
>
> I am trying to learn how the new Dynamic features work.
>
> The following two Manipulate expressions give outputs that
> make perfect intuitive sense to me:
>
> Manipulate[q = p + 1;
> q,
> {p, 0, 1}]
>
> Manipulate[q = p + 1;
> FullForm@q,
> {p, 0, 1}]
>
> (don't keep both outputs active at the same time
> if you are short on battery power!)
>
> When I try to reproduce similar effects with
> DynamicModule, I get all sorts of different behaviours.
> Compare the following:
>
> DynamicModule[{p = 0, q},
> q = p + 1;
> {Slider[Dynamic@p], q}]
>
> DynamicModule[{p = 0, q},
> q = p + 1;
> {Slider[Dynamic@p], Dynamic@q}]
>
> DynamicModule[{p = 0, q},
> q = Dynamic[p] + 1;
> {Slider[Dynamic@p], q}]
>
> DynamicModule[{p = 0, q},
> q = Dynamic[p] + 1;
> {Slider[Dynamic@p], FullForm@q}]
>
> DynamicModule[{p = 0, q},
> q = Dynamic[p] + 1;
> {Slider[Dynamic@p], FullForm@Dynamic@q}]
>
> DynamicModule[{p = 0, q},
> q = Dynamic[p] + 1;
> {Slider[Dynamic@p], Dynamic@FullForm@q}]
>
> DynamicModule[{p = 0, q},
> q = Dynamic[p + 1];
> {Slider[Dynamic@p], q}]
>
> DynamicModule[{p = 0, q},
> q = Dynamic[p + 1];
> {Slider[Dynamic@p], q[[1, 1]]}]
>
> DynamicModule[{p = 0, q},
> q = Dynamic[p + 1];
> {Slider[Dynamic@p], q[[1, 2]]}]
>
> DynamicModule[{p = 0, q},
> q = Dynamic[p + 1];
> {Slider[Dynamic@p], Dynamic@q}]
>
> DynamicModule[{p = 0, q},
> q = Dynamic[p + 1];
> {Slider[Dynamic@p], Dynamic[q[[1, 1]]]}]
>
> DynamicModule[{p = 0, q},
> q = Dynamic[p + 1];
> {Slider[Dynamic@p], Dynamic[q[[1, 2]]]}]
>
> DynamicModule[{p = 0, q},
> q = Dynamic[p + 1];
> {Slider[Dynamic@p], FullForm@q}]
>
> DynamicModule[{p = 0, q},
> q = Dynamic[p + 1];
> {Slider[Dynamic@p], Dynamic@FullForm@q}]
>
> DynamicModule[{p = 0, q},
> q = Dynamic[p + 1];
> {Slider[Dynamic@p], FullForm@Dynamic@q}]
>
> Right now all I need is a few kind words of encouragement
> from somebody who has already mastered dynamic interactivity...
>
> Gianluca
>
>