Tag Info

New answers tagged


Here's the solution I ended up going with: Manipulate[ With[{f = Table[c[i], {i, n}], controls = Sequence @@ Table[{{c[i], 0}, -1, 1}, {i, n}], randomize = Hold@CompoundExpression @@ Table[Hold[c[i] = RandomReal[{-1, 1}]] /. i -> j, {j, n}]}, Manipulate[Append[f, r], controls, {{r, 0}, -1, 1}, Button["Random", ...


Let's use WReach's method to examine Manipulate: x = "global"; f[] := x Manipulate[{x, f[], Hold[x]}, {x, {"local"}}] {"local", "global", Hold[FE`x$$69]} This is akin to the output of Module. (See the WReach's post.) The value of x is not temporarily changed as with Block, nor are explicit x expressions directly replaced with the local value of x ...


Your first example code actually is wrong, logically speaking. You are not supposed to make assignments to control variables (unless control type is set to None). The control variable is supposed to be modified only using the controls (sliders, buttons etc...), and read only in the Manipulate expression. Otherwise, you can get into an infinite loop. When ...


You need to randomize the control initial value, not the name of the symbol associated to the control. Perhaps this is what you want: Manipulate[ With[{f = Table[c[i], {i, n}], controls = Sequence @@ Table[{{c[i], s[i]}, -1, 1}, {i, n}]}, Manipulate[f, controls, Button["Random", Do[s[i] = RandomReal[{-1, 1}], {i, n}]]]], {n, {3, 4, 5}}, ...


I am not sure if I completely understood your problem, but maybe the following is what you are looking for: myFunction[t_, opts : OptionsPattern[paropts]] := Quiet[With[{x = If[OptionValue[a] =!= a, OptionValue[a]/t, 1/t]}, x + OptionValue[c]]] It works both when the option a is set, either in paropts or in the function call, or not. I also added an ...


Unfortunately your code is too incomplete to test, but the following should do what you want: myFunction[t, opts:OptionsPattern[paropts]]:= With[{x = If[OptionValue[a], a/Optionvalue[b], 1/OptionValue[b]]}, y=x+OptionValue[c]]


There have been reports in version 10.0.1 that the Suggestions Bar (aka Predictive Interface) sometimes mangles output values in notebooks. Try turning off the Suggestions Bar as described in this Wolfram Support Article.

Top 50 recent answers are included