Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Programmatically specifying parameters in "Manipulate" command

  • To: mathgroup at smc.vnet.net
  • Subject: [mg129171] Re: Programmatically specifying parameters in "Manipulate" command
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Wed, 19 Dec 2012 04:59:12 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <20121218073641.946E968F9@smc.vnet.net>

parameters = {{a, 1, 4}, {b, 0, 10}};

Manipulate[Plot[Sin[a x + b], {x, 0, 6}],
 Evaluate[Sequence @@ parameters]]

parameters =
  Append[#, Appearance -> "Labeled"] & /@
   {{a, 1, 4}, {b, 0, 10}};

Manipulate[Plot[Sin[a x + b], {x, 0, 6}],
 Evaluate[Sequence @@ parameters]]


Bob Hanlon


On Tue, Dec 18, 2012 at 2:36 AM,  <abed.alnaif at gmail.com> wrote:
> Hello,
> Is there a way to specify the parameters for the "Manipulate" command as =
a string or list? I'd like to do this since I am trying to build a "framewo=
rk" that makes use of the Manipulate command, and which can be used with se=
veral different types of parameters. Using one of the examples from the doc=
umentation to illustrate my point:
>
> This works, and illustrates what I'm trying to do:
> Manipulate[Plot[Sin[a x + b], {x, 0, 6}], {a, 1, 4}, {b, 0, 10}]
>
> However, I'd like the parameters to be a variable:
> This doesn't work:
>
> parameters = "{a,1,4},{b,0,10}";
> Manipulate[Plot[Sin[a x + b], {x, 0, 6}], ToExpression[parameters]]
>
> And neither does this:
>
> parameters = {{a, 1, 4}, {b, 0, 10}};
> Manipulate[Plot[Sin[a x + b], {x, 0, 6}], parameters]
>
> Is there a way to specify the parameters as a variable in the Manipulate =
command?
>
> Thank you,
>
> Abed
>



  • Prev by Date: Re: Terrible unit trouble in Mathematic 9
  • Next by Date: Re: Terrible unit trouble in Mathematic 9
  • Previous by thread: Re: Programmatically specifying parameters in "Manipulate" command
  • Next by thread: SendMail - HTML/XML rathar that Plain Text