MathGroup Archive 2009

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

Search the Archive

Re: How to find which variable caused the trigger in Manipulate[]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103786] Re: How to find which variable caused the trigger in Manipulate[]
  • From: "Nasser Abbasi" <nma at 12000.org>
  • Date: Tue, 6 Oct 2009 08:00:09 -0400 (EDT)
  • References: <hacmmv$sju$1@smc.vnet.net> <had9pe$ad6$1@smc.vnet.net>

"Albert Retey" <awnl at gmx-topmail.de> wrote in message 
news:had9pe$ad6$1 at smc.vnet.net...

>
> Do you think a manipulate with 10 plots is a good idea after all? If
> these are supposed to fit on one screen they are probably small, and
> then is there really any value in seeing them all at once? Just
> wondering, since I haven't yet met a situation where that would have
> made much sense...
>

Sorry, I meant to say 10 or so different sets of "control variables", i.e. I 
broke the real estate into many small blocks, each contain the 1 or 2 slides 
needed to generate a plot related to these 1 or 2 slides (variables)  that 
just changed value.

I needed to know which slide (or control variable) changed, so I know which 
type of plot to generate. I have a demo which illustrates all of Mathematics 
discrete distributions, and there are 11 such discrete distributions, so 
needed to fit them all. Here is my _draft_, not yet published, have couple 
of problems yet to solve, which are driving me crazy

http://demonstrations.wolfram.com/preview.html?draft/30421/000077/IllustratingAllOfMathematica7DiscreteDistributions

(do not know why I said 10 plots there, must be the long hours)

>>
>> If I can find which variable did the triggering, I can get rid of the 
>> radio
>> buttons and simplify the interface.
>>
>> Thank you,
>> --Nasser
>> ps. I did read the docs from the documentation center on dynamics and
>> Manipulate (they are good), but do not see the solution there.
>

> Have you looked at the section: 'Using Dynamic inside Manipulate'
> within: 'tutorial/AdvancedManipulateFunctionality' ?
>
> I think it does explain exactly what you need. You just need to
> understand that the logic is the other way around: Dynamic will (usually
> automatically) just update those plots which depend on the value you
> just changed. This does work as you probably want:
>
> Manipulate[Grid[{{
>    Dynamic[Plot[Sin[a*x], {x, -Pi, Pi}, PlotLabel -> RandomReal[]]],
>    Dynamic[Plot[Sin[b*x], {x, -Pi, Pi}, PlotLabel -> RandomReal[]]]
>    }}], {a, 0, 1}, {b, 0, 1}]
>
> I have put some random labels so that you can see that indeed only one
> of the plots is regenerated when using one of the sliders...
>
> hth,
>
> albert
>

Thanks Albert! that does work! but I need to try it on my code. I did read 
exactly what you just wrote in the doc, where it talked about putting a 
Dynamic[] around a 'variable' and did not think, or try to do the same idea 
to a function call inside the Manipulate function. (this was the example 
showing the 3D plot with 2 slides on it, and changing the view point).

I hope the above woks with my code, since now I can remove all the extra 
buttons you see on my demo.

Best

--Nasser 



__________ Information from ESET NOD32 Antivirus, version of virus signature database 4481 (20091005) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




  • Prev by Date: Re: Simple Optimization Problem: Using BinCounts within
  • Next by Date: Re: How to find which variable caused the trigger in Manipulate[]
  • Previous by thread: Re: How to find which variable caused the trigger in Manipulate[]
  • Next by thread: Re: How to find which variable caused the trigger in Manipulate[]