Suppose I need to create sliders associated with variables from a given list:
ClearAll[a, b, c, d];
vars = {a, b, c, d};
Slider[Dynamic@#, {0, 1}] & /@ vars
Dynamic@vars
Unfortunately it works only for variables which don't have values:
ClearAll[a, b, c, d];
vars = {a, b, c, d};
a = 1;
Slider[Dynamic@#, {0, 1}] & /@ vars
Dynamic@vars
As you can see now the first slider is not working because Mma attempts to assign values to raw object 1 instead of a. Nevertheless simple
Slider[Dynamic@a, {0, 1}]
Dynamic@a
produces the desired result.
So, what is the right way to do such things?
