Re: Manipulate
- To: mathgroup at smc.vnet.net
- Subject: [mg86294] Re: Manipulate
- From: m.r at inbox.ru
- Date: Fri, 7 Mar 2008 02:33:33 -0500 (EST)
- References: <fqlmn4$jcj$1@smc.vnet.net>
On Mar 5, 2:47am, N K <nk200... at yahoo.com> wrote:
> Hi,
> I just have started using Mathematica and was working on the Manipulate function. I have the following piece of code:
>
> Manipulate[
> Print[value],
> {value, 1, 10, 1, ControlType -> Animator}
> ]
> which seems to work just fine. However, if I add the following line to it, it does not quite work.
>
> lst = {};
> Manipulate[
> lst = Append[lst, value];
> Print[value],
> {value, 1, 10, 1, ControlType -> Animator}
> ]
>
> The values that are being printed for "value" are really weird and incorrect.
> Any suggestions on what I have done wrong?
>
> Thanks very much,
The problem here is that a dynamic update is triggered every time lst
is modified and you need to monitor only the changes of Manipulate
variables. In 6.0.2 you can use
lst = {};
Manipulate[AppendTo[lst, value],
{value, 1, 10, 1, Animator},
TrackedSymbols :> {value}]
or, equivalently, TrackedSymbols -> Manipulate.
Maxim Rytin
m.r at inbox.ru