2
$\begingroup$

I have a function that I would like to construct the Manipulate parameter list with Sequence. This is a simpler example but it has the same behaviour.

x[a_, b_, c_] := a + b + c
parmsForSlider = {{#, 5. *10^6}, 1.*10^6, 20.*10^6, 0.5*10^6} & /@ {a, b, c} ;

parmsForSlider has the list for items I need for Manipulate. I can get the sequence in a fake function.

f[q, Sequence @@ parmsForSlider]

However, if I try this in manipulate it does not separate out paramsForSlider as it does for f.

Manipulate[AccountingForm[x[a, b, c], DigitBlock -> 3], Sequence @@ parmsForSlider]

Instead it gives the error:

Manipulate::vsform: "Manipulate argument Sequence@@parmsForSlider does not have the correct form for a variable specification."

However, if I type in the parameters and ranges it will work.

Manipulate[
  AccountingForm[x[a, b, c], DigitBlock -> 3], 
  {{a, 5. * 10^6}, 1. * 10^6, 20 * 10^6, 0.5 * 10^6}, 
  {{b, 5. * 10^6}, 1. * 10^6, 20 * 10^6, 0.5 * 10^6}, 
  {{c, 5. * 10^6}, 1. * 10^6, 20 * 10^6, 0.5 * 10^6}
]

Have I done something incorrectly? I'm using 10.0.2 in Windows 8.1 64bit.

$\endgroup$
  • 1
    $\begingroup$ Try with Evaluate[Sequence[...]]. Looking for duplicate... $\endgroup$ – Kuba Mar 9 '15 at 23:12
  • $\begingroup$ @kuba, I did not see your comment before my answer. sorry $\endgroup$ – Algohi Mar 9 '15 at 23:18
  • $\begingroup$ @Algohi No need to, I failed to find proper duplicate anyway. $\endgroup$ – Kuba Mar 9 '15 at 23:19
4
$\begingroup$

Manipulate has Attributes HoldAll.

Try this:

Manipulate[AccountingForm[x[a, b, c], DigitBlock -> 3], 
 Evaluate[Sequence @@ parmsForSlider]]
$\endgroup$

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.