0
$\begingroup$

I'd love to use SparseArrayor List to group a set of parameters together in a function.

params[a] = 5;
params[b] = 6;

AFunction[p_] := p[a] * p[b]

If I however want to create a manipulatable entry in the array, it doesn't work:

Manipulate[params[c], {params[c], 0, 50}]
Manipulate::vsform: "Manipulate argument {params[c],0,50} does not have the correct form for a variable specification."

The same thing for a "normal" value works as intended:

Manipulate[c, {c, 0, 50}]

The Mathematica 10.0 documentation states, that Manipulate should be able to interactively transform any expression.

I also tried it with With, which leads to the same error.

Is this straight not possible, or am I doing something wrong. How do you handle big manipulatable parameter sets?

$\endgroup$
  • 1
    $\begingroup$ {params[c], 0, 50} here param[c] is not a control variable. This sould be a symbol, like x, c, y, etc.. not a function. $\endgroup$ – Nasser Jul 19 '14 at 11:16
1
$\begingroup$

This functions:

params[a] = 5;
params[b] = 6;
Manipulate[params[a] = n, {n, 10, 100, 1}]

In contrast:

c = 1;
Manipulate[c, {c, 10, 100, 1}]

Here, the Manipulate displays the change of the local c. It doesn't change the global c which still has value 1.

$\endgroup$
  • $\begingroup$ Tank you very much, that absolutely makes sense! Great Answer! $\endgroup$ – Thomas Fankhauser Jul 19 '14 at 15:24
  • $\begingroup$ Btw. I'm using Mathematica 10`s assosiactions now, although they also need to be substituted away. $\endgroup$ – Thomas Fankhauser Jul 19 '14 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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