Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #12872
| From | Ulrich Arndt <ulrich.arndt@data2knowledge.de> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Programmatically specifying parameters in "Manipulate" command |
| Date | 2012-12-19 09:55 +0000 |
| Message-ID | <kas2u5$chf$1@smc.vnet.net> (permalink) |
| References | <20121218073641.946E968F9@smc.vnet.net> |
| Organization | Time-Warner Telecom |
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
>
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: Programmatically specifying parameters in "Manipulate" command Ulrich Arndt <ulrich.arndt@data2knowledge.de> - 2012-12-19 09:55 +0000
csiph-web