Re: Dynamic changing of variables
- To: mathgroup at smc.vnet.net
- Subject: [mg96335] Re: Dynamic changing of variables
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Thu, 12 Feb 2009 06:32:27 -0500 (EST)
- References: <gmu8rl$gn3$1@smc.vnet.net>
Hi,
DynamicModule[{a = 0, b = 0},
Column[{Dynamic[a + 1],
Slider[Dynamic[b, (a = Sin[#]; b = #) &], {0, 2*Pi}]}]]
??
Regards
Jens
Patrick Scheibe wrote:
> Hi,
>
> assume the following code lines:
>
> DynamicModule[{a, b = 0},
> a = Dynamic[Sin[b]];
> Column[{
> Dynamic[a],
> Slider[Dynamic[b], {0, 2*Pi}]
> }]
> ]
>
> In order to update "a" with the actual value of Sin[b] I need
> Dynamic around it. Unfortunately, now the variable "a" is invisibly
> wrapped and completely useless for further calculations. I'm not able to
> calculate even a+1 inside the DynamicModule.
>
> DynamicModule[{a, b = 0},
> a = Dynamic[Sin[b]];
> Column[{
> Dynamic[a+1],
> Slider[Dynamic[b], {0, 2*Pi}]
> }]
> ]
>
> If I'm not just too stupid and this behaviour is intended, then I'm
> wondering whether this doesn't lead to problems when you have more
> complex constructs with several dynamic variables.
>
> Cheers
> Patrick
>
> PS: I was just pointed by another person on this and I found a way
> around it. So cannot provide a real problem I'm having. Nevertheless, I
> would be glad to know what you think since I couldn't really find the
> point in the documentation where this is explained.
>
>