MathGroup Archive 2013

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

Search the Archive

Re: Setting parameters via Manipulate?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg129631] Re: Setting parameters via Manipulate?
  • From: Peter Äendula <cendos at gmail.com>
  • Date: Thu, 31 Jan 2013 20:47:01 -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: <j6joq3$m9g$1@smc.vnet.net> <keaou9$agu$1@smc.vnet.net>

Thanks Bob, this is a solution using nested two Manipulate constructs. When I implemented it in my more complicated case, the nesting of Manipulate make the UI unresponsive.

Do you have another approach in mind with just single Manipulate?

Peter

On Wednesday, January 30, 2013 10:25:29 AM UTC+1, Bob Hanlon wrote:
> If I understand what you want, this is one approach:
>
>
>
> initialSettings = {
>
>    {a -> a1, b -> b1, c -> c1, d -> d1},
>
>    {a -> a2, b -> b2, c -> c2, d -> d2},
>
>    {a -> a3, b -> b3, c -> c3, d -> d3},
>
>    {a -> a4, b -> b4, c -> c4, d -> d4},
>
>    {a -> a5, b -> b5, c -> c5, d -> d5}};
>
>
>
> m = Length[initialSettings];
>
>
>
> Manipulate[
>
>  is = {a, b, c, d} /. initialSettings[[parameterSet]];
>
>  Manipulate[
>
>   Column[{
>
>     StringForm[
>
>      "a = `1`, b = `2`, c = `3`, d = `4`",
>
>       a, b, c, d],
>
>     "\n",
>
>     f[a, b, c, d]}],
>
>   Row[{
>
>     Control[{{a, is[[1]], "Set a"},
>
>       initialSettings[[All, 1, -1]],
>
>       ControlType -> PopupMenu}],
>
>     Spacer[10],
>
>     Control[{{b, is[[2]], "Set b"},
>
>       initialSettings[[All, 2, -1]],
>
>       ControlType -> PopupMenu}],
>
>     Spacer[10],
>
>     Control[{{c, is[[3]], "Set c"},
>
>       initialSettings[[All, 3, -1]],
>
>       ControlType -> PopupMenu}],
>
>     Spacer[10],
>
>     Control[{{d, is[[4]], "Set d"},
>
>       initialSettings[[All, 4, -1]],
>
>       ControlType -> PopupMenu}]}]],
>
>  {{parameterSet, 1, "Select\ninitial values"},
>
>   Thread[Range[m] -> initialSettings],
>
>   ControlType -> PopupMenu}]
>
>
>
>
>
> Bob Hanlon
>
>
>
>
>
> On Tue, Jan 29, 2013 at 2:42 AM, Peter =C4=8Cendula wrote:
>
> > Thanks Bob, this show possible solution when "fixedSettings" influence ONLY parameters a,b,c,d and NOT parameters e,g. What I'm interested is how to set also initial values of a,b,c,d through ParameterSet, so something like|(which yields Part::pspec message):
>
> >
>
> >
>
> > {{a, a /. fixedSettings[[ParameterSet]], "set a"},
>
> >  Thread[Range[5] -> {a1, a2, a3, a4, a5}], ControlType -> PopupMenu}
>
> >
>
> > Also when I change ParameterSet through PopupMenu, value of "a" should be set appropriately.
>
> >
>
> > Thanks in advance
>
> > Peter
>
> > On Saturday, January 26, 2013 10:58:42 PM UTC+1, Bob Hanlon wrote:
>
> >> fixedSettings = {
>
> >>
>
> >>    {a -> a1, b -> b1, c -> c1, d -> d1},
>
> >>
>
> >>    {a -> a2, b -> b2, c -> c2, d -> d2},
>
> >>
>
> >>    {a -> a3, b -> b3, c -> c3, d -> d3},
>
> >>
>
> >>    {a -> a4, b -> b4, c -> c4, d -> d4},
>
> >>
>
> >>    {a -> a5, b -> b5, c -> c5, d -> d5}};
>
> >>
>
> >>
>
> >>
>
> >> Manipulate[
>
> >>
>
> >>  Column[{
>
> >>
>
> >>     StringForm[
>
> >>
>
> >>      "a = `1`, b = `2`, c = `3`,
>
> >>
>
> >>      d = `4`, e = `5`, g = `6`",
>
> >>
>
> >>      a, b, c, d, e, g],
>
> >>
>
> >>     "\n",
>
> >>
>
> >>     f[a, b, c, d, e, g]
>
> >>
>
> >>     }] /.
>
> >>
>
> >>   fixedSettings[[ParameterSet]],
>
> >>
>
> >>  Control[
>
> >>
>
> >>   {{ParameterSet, 1, "Select\nParameter Set"},
>
> >>
>
> >>    Thread[Range[5] -> fixedSettings],
>
> >>
>
> >>    ControlType -> PopupMenu}],
>
> >>
>
> >>  Control[
>
> >>
>
> >>   {{e, Pi/2, "Select e"}, Range[-Pi, Pi, Pi/4],
>
> >>
>
> >>    ControlType -> PopupMenu}],
>
> >>
>
> >>  {{g, 0, "Set g"}, -5, 5, 1,
>
> >>
>
> >>   Appearance -> "Labeled"}]
>
> >>
>
> >>
>
> >>
>
> >>
>
> >>
>
> >> Bob Hanlon
>
> >>
>
> >>
>
> >>
>
> >>
>
> >>
>
> >> On Sat, Jan 26, 2013 at 1:41 AM, Peter =C4=8Cendula wrote:
>
> >>
>
> >> > Hi Tamas, I have exactly the same problem. Did you come to solution =
in the meantime?
>
> >>
>
> >> >
>
> >>
>
> >> > Thanks
>
> >>
>
> >> > Peter
>
> >>
>
> >> >
>
> >>
>
> >> > On Thursday, October 6, 2011 10:27:47 AM UTC+2, Lengyel Tamas wrote:
>
> >>
>
> >> >> Dear Community,
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >> I am facing a rather hard to learn problem in Mathematica: setting
>
> >>
>
> >> >>
>
> >>
>
> >> >> multiple parameters simultaneously.
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >> The basic problem is as follows: I have a set of parameters that de=
fine a
>
> >>
>
> >> >>
>
> >>
>
> >> >> physical element (in my case an optical fiber). There are some stan=
dard
>
> >>
>
> >> >>
>
> >>
>
> >> >> fibers with fixed parameters.
>
> >>
>
> >> >>
>
> >>
>
> >> >> I wish to have a drop down menu (PopUpMenu in Math 8.0 I believe) t=
hat
>
> >>
>
> >> >>
>
> >>
>
> >> >> sets these parameters to fixed values and have a few other paramete=
rs that
>
> >>
>
> >> >>
>
> >>
>
> >> >> are adjustable in my simulation.
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >> Ideally I wish to have all parameters to be able to be set using
>
> >>
>
> >> >>
>
> >>
>
> >> >> Manipulate or some other sort of way (input string) and have drop d=
own
>
> >>
>
> >> >>
>
> >>
>
> >> >> menus that make these variables "jump" to the defined value.
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >> My questions are:
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >> -how can I implement this selection-type menu with fixed parameter =
sets and
>
> >>
>
> >> >>
>
> >>
>
> >> >> -how can I have those parameters be adjustable alongside the above =
met hod?
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >> Thank you in advance.
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >>
>
> >>
>
> >> >> Tam=E1s Lengyel
>
> >>
>
> >> >
>
> >>
>
> >> >
>
> >
>
> >




  • Prev by Date: sphericalplot3d colorfunction
  • Next by Date: Re: List manipulation question - 2013
  • Previous by thread: Re: Setting parameters via Manipulate?
  • Next by thread: Mathematica 9 IsotopeData is no longer self-consistent