Re: weird Manipulate/Animate
- To: mathgroup at smc.vnet.net
- Subject: [mg76693] Re: [mg76682] weird Manipulate/Animate
- From: "Lev Bishop" <lev.bishop at gmail.com>
- Date: Sat, 26 May 2007 04:22:31 -0400 (EDT)
- References: <200705251050.GAA08454@smc.vnet.net>
On 5/25/07, mire <virgiliub at yahoo.com> wrote: > does anyone know why this code works > > graph = Table[Plot[Sin[x + i], {x, 0, \[Pi]}], {i, 3}]; > ListAnimate[graph] > > and this one doesn't > > n = 3; graph = Table[0, {n}]; > For[i = 1, i <= n, i++, > graph[[i]] = Show[Plot[Sin[x + i], {x, 0, \[Pi]}]]]; > ListAnimate[Evaluate[graph]] Heh. Because even WRI can't remember mathematica's bizarre and confusing scoping rules? A more succinct example of the problem: i=1; ListAnimate[{"a","b","c"}] Ie, the problem is that ListAnimate gets tripped up by Global`i. Somewhere in the definition of ListAnimate is this: Manipulate`Dump`res=With[{Manipulate`Dump`i=Symbol[i],....] , which almost makes it look as though this is on purpose, but I can't see why. Anyway, for now, just don't use the variable i in any situation where you might use ListAnimate. Lev
- References:
- weird Manipulate/Animate
- From: mire <virgiliub@yahoo.com>
- weird Manipulate/Animate