I would like to write a procedure with the signature:
Foo[vars, params]
which produces a Manipulate
object. The procedure will dress up the vars
into sliders of the form:
{{a, a0, "DisplayName"}, min, max, Appearance->"Labeled"}
and will produce a Plot
, depending on both the params
and vars
. (The default value a0
and the other slider properties are generated in a particular manner from a
.)
The issue I'm running into is that Manipulate
requires all of its vars
to be explicitly listed. I looked at the related question Proper way to handle free variables in manipulate/plot? to no avail (I couldn't get With
to do what I want).
So how does one procedurally generate the commands of Manipulate
? I am constrained to use Manipulate
as opposed to Dynamic
or other more advanced features.
Concrete Example:
Manipulate[
Plot[
c0 + c1 x + c2 x^2,
{x,0,1}
],
{{c0, 0},-1, 1},
{{c1, 1}, 0, 2},
{{c2, 2}, 1, 3},
]
Then the goal would be to replace the 2 with an n, i.e. to write a function Poly[n]
which returns a manipulatable polynomial with coefficients c_i
centered around i.
With
to help reduce duplicate code. Please see injecting-list-of-controls-into-manipulate which is pretty much asking the same thing, and the discussion and links there. $\endgroup$