MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Making a table with unlinked sliders

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115646] Re: Making a table with unlinked sliders
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Mon, 17 Jan 2011 05:39:39 -0500 (EST)
  • References: <iguis5$8ub$1@smc.vnet.net>

Hi,
> 
> I was wondering if anyone could tell me why this code doesn't work. I'm
> trying to make a list of sliders, each of which controls a different
> variable x_i (where i is an indice in a 1D table).
> 
> I thought the code below would work, but it turns out it only half works. It
> makes a list of sliders, but for some reason that I can't discern, all of
> those sliders are linked (they all move together). I can't figure out why
> this is. (Maybe it has to do with the subtle issues that arise from Dynamic
> working in the front-end? )

No, I think it has to do with the subtle details of the evaluation
order. Dynamic
has the attribute HoldFirst which makes all the Dynamics in your table to
effectively only see an unevaluated x_j (that is the same expression for
every of
the 10 Sliders) instead of x_1,...

The following will plug in the evaluated values of j and should work as
expected (note that the With also helps to make the initialization work
in a second try...):

Table[With[{j = j},
  Subscript[x, j] = 0;
  Slider[Dynamic[Subscript[x, j]]]
  ], {j, 1, 10}]

hth,

albert


  • Prev by Date: one more // Re: Apply or Map on some parts of lists - help
  • Next by Date: Re: How to force numeric output
  • Previous by thread: Re: Making a table with unlinked sliders
  • Next by thread: Tooltip in a Plot of a List