Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Programmatically specifying parameters in "Manipulate" command
Replies: 2   Last Post: Dec 19, 2012 4:55 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Ulrich Arndt

Posts: 53
Registered: 10/1/09
Re: Programmatically specifying parameters in "Manipulate" command
Posted: Dec 19, 2012 4:55 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi,

create a string with the whole expression before you call ToExpression.

parameters = "{a,-1,4},{b,0,20}";
exp = "Manipulate[Plot[Sin[a x+b],{x,0,6}]," <> parameters <> "]";
ToExpression[exp]

Ulrich

Am 18.12.2012 um 08:36 schrieb abed.alnaif@gmail.com:

> 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
"framework" that makes use of the Manipulate command, and which can be
used with several different types of parameters. Using one of the
examples from the documentation 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
>






Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.