0
$\begingroup$

I would like to use a Manipulate environment with a large number of manipulable (?) variables, say {x1,0,1},{x2,0,1},{x3,0,3},etc. Rather than define them all directly in the Manipulate[], I'd like to define them ahead of a time, in a different cell.

How do I do this? The obvious solution, to make a list of ranges:

ranges={{x1,0,1},{x2,0,1},{x3,0,3}};
Manipulate[f(x1,x2,x3), ranges]

doesn't work, presumably because of the outer braces. But there appears to be no way to pull out the contents of the list without putting them in a new list; for instance ranges[[All]] returns ranges itself rather than its contents. But ranges[[1]] works just fine, that's not a list with one element but rather the element itself. Is there a way to get all of the elements out of ranges for use inside a Manipulate?

$\endgroup$
6
  • $\begingroup$ Manipulate[f[x1, x2, x3], Sequence @@ ranges // Evaluate] $\endgroup$
    – march
    Oct 3, 2017 at 20:52
  • $\begingroup$ @march: Fine answer. I suggest you post it so it can be accepted and others not be drawn to this (solved) question. $\endgroup$ Oct 3, 2017 at 22:22
  • $\begingroup$ @DavidG.Stork. Except, I'm almost certain that this is a duplicate question, I just can't find it. $\endgroup$
    – march
    Oct 3, 2017 at 22:23
  • $\begingroup$ @DavidG.Stork. Well, maybe this one in the Related sidebar (although it's a little more complicated). $\endgroup$
    – march
    Oct 3, 2017 at 22:25
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – Michael E2
    Oct 3, 2017 at 22:31

0

Browse other questions tagged or ask your own question.