Re: Caution! Reuse of variables within Manipulate
- To: mathgroup at smc.vnet.net
- Subject: [mg89064] Re: Caution! Reuse of variables within Manipulate
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Sun, 25 May 2008 03:19:16 -0400 (EDT)
- References: <g18hts$kkp$1@smc.vnet.net>
Hi, > Is this surprising, or has this been mentioned in the Documentation? AFAIK it is not mentioned in the Documentation, that you are surprised. Regards Jens Frank Iannarilli wrote: > Hi, > > > Here's a cautionary note about (re)use of dynamic variables inside > Manipulate[]. > > To wit, here's code to demonstrate the issue. Note the reuse of the > variable d, and Pause[]: > > Manipulate[ > d = b; > Pause[1.]; > d = Max[Sin[b], Sin[a]]; > Plot[a Sin[b t], {t, 0, 10}, PlotRange -> {All, {-10, 10}}], > {{a, 1, "a"}, 0, 10, Appearance -> "Labeled"}, > {{b, 1, "b"}, 0, 10, Appearance -> "Labeled"}, > Item[Row[{Style["Goofy: ", Blue], Dynamic[d]}, Spacer[2]], > Alignment -> Left] > ] > > As one plays with the controls, the display of Dynamic[d] (labeled by > "Goofy") will flicker, showing that indeed the variable d is dynamic > *every point through* the body of Manipulate. I had naively assumed > that one's code within Manipulate would run through from top to bottom > before the display would be updated. > > Is this surprising, or has this been mentioned in the Documentation? > > Regards, > Frank >