I want to create a way to enumerate teal color coded variables in my Manipulate function. Specifically, I would like the user to input a number so that my function takes this number and produces a teal color coded variable with respect to the given numerical value.

For example, if I were to input 1 into the function, I want to produce the teal colored variable xInt1. If the user inputs 2, the teal colored variable should be xInt2. So on. The variables xInt1 and xInt2 both live in the Manipulate function.

Is this possible? If so, how? Thank you!

EDIT: Here is a very basic example:

q[n_] := Manipulate[Plot[Sin[x (1 + a x)], {x, 0, 6}], {a, 0, 2}]

Currently, the above function is not defined with respect to n. However, I am interested in enumerating a so that when the user inputs a numerical value (for example 1) for n, the Manipulate function is defined over "a"<>"n" (in example, a1). Thank you!

  • $\begingroup$ I supplied a very basic example explaining my question. Thank you! $\endgroup$
    – Wilson
    Commented Nov 15, 2016 at 19:48

1 Answer 1

q[n_] := Manipulate[
   Plot[Sin[x (1 + # x)], {x, 0, 6}], {#, 0, 2}
] & @@ ToExpression["xInt" <> ToString[n], StandardForm, Unevaluated]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.