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

MathGroup Archive 2009

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

Search the Archive

DynamicModule causing problems with Manipulate setter bar

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102748] DynamicModule causing problems with Manipulate setter bar
  • From: Porscha Louise McRobbie <pmcrobbi at umich.edu>
  • Date: Wed, 26 Aug 2009 07:42:06 -0400 (EDT)

Hello,

I often have multiple Manipulate commands in a single file, and to 
avoid them interfering I always wrap them with a DynamicModule.

The following Manipulate is the basic idea of what I want:

Manipulate[
  Plot[ffun[y, m1], {y, -1, 1}, Filling -> Axis,
   PlotRange -> {{-1, 1}, {-1.1, 1.1}}],

  {{ffun, f1,
    "\!\(\*SubscriptBox[\"f\", \"m\"]\)(x)"}, {f1 ->
     TraditionalForm[Sin[m Pi x]], f2 -> TraditionalForm[Cos[m Pi x]]}},
  {{m1, 0, "m"}, 0, 3, 1},

  Initialization :> { (f1[yy_, mm_] := Sin[mm Pi yy]), (f2[yy_, mm_] :=
       Cos[mm Pi yy])}]

However, I've noticed the following two problems when trying to wrap 
the above with DynamicModule:

1. If I place {f1,f2} inside DynamicModule, the graph seems fine but 
the blue highlighter color on the setter bar for fm(x) has disappeared.

DynamicModule[{f1, f2},

  Manipulate[
   Plot[ffun[y, m1], {y, -1, 1}, Filling -> Axis,
    PlotRange -> {{-1, 1}, {-1.1, 1.1}}],

   {{ffun, f1,
     "\!\(\*SubscriptBox[\"f\", \"m\"]\)(x)"}, {f1 ->
      TraditionalForm[Sin[m Pi x]],
     f2 -> TraditionalForm[Cos[m Pi x]]}},
   {{m1, 0, "m"}, 0, 3, 1},

   Initialization :> { (f1[yy_, mm_] := Sin[mm Pi yy]), (f2[yy_, mm_] :=
        Cos[mm Pi yy])}]]

2. If I place {f1,f2,m,x} inside DynamicModule, the graph seems fine 
but now the labels for "m" and "x" read "$$m" and "$$x" (in addition 
to the blue highlighting being gone).

DynamicModule[{f1, f2, m, x},

  Manipulate[
   Plot[ffun[y, m1], {y, -1, 1}, Filling -> Axis,
    PlotRange -> {{-1, 1}, {-1.1, 1.1}}],

   {{ffun, f1,
     "\!\(\*SubscriptBox[\"f\", \"m\"]\)(x)"}, {f1 ->
      TraditionalForm[Sin[m Pi x]],
     f2 -> TraditionalForm[Cos[m Pi x]]}},
   {{m1, 0, "m"}, 0, 3, 1},

   Initialization :> { (f1[yy_, mm_] := Sin[mm Pi yy]), (f2[yy_, mm_] :=
        Cos[mm Pi yy])}]]

How can I localize the variables f1,f2,m,x but still have the labels 
look how I want them to?

Many thanks!
Porscha




  • Prev by Date: Problems with Evaluate[Symbol[xxx]]
  • Next by Date: Problem with a 1st order IV ODE (nonlinear)
  • Previous by thread: Re: Problems with Evaluate[Symbol[xxx]]
  • Next by thread: Re: DynamicModule causing problems with Manipulate setter bar