Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

DynamicModule Pure Function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121792] DynamicModule Pure Function
  • From: Don <donabc at comcast.net>
  • Date: Sun, 2 Oct 2011 02:37:19 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

In the Wolfram tutorial "Introduction to Dynamic" (tutorial/IntroductionToDynamic)
there is the following example approximately halfway into the tutorial:

DynamicModule[{x = 0}, {Slider[Dynamic[x]], 
  Slider[Dynamic[1 - x, (x = 1 - #) &]]}]


The explanation that Wolfram gives for why this works (i.e. the second Slider is the inverse function of the first Slider) is unintelligible to me.  Can anyone explain in plain, simple English (no jargon) what is going on here?

For example, when x = 0.25 the second slider has to be at position 0.75.  It can't update 1-x directly since 
1-x cannot be set to a value.  Of course, this
is true, but it doesn't explain why the pure function is the solution.


If x = 0.25, this implies that the # is equal to 0.75 since x = 1 - #.  But, how did the system know that # = 0.75?  Where did the 0.75 come from?


To put it another way, I am use to the # being a placeholder in pure functions that ranges over a
set of values.  For example, in Select[list, # > 0 &], the # ranges over all the elements of list.  What is # in the pure function of the second Dynamic ranging over and how does it come up with 0.75 as a value for #?

Thank you in advance for any clear explanations you can give me.



  • Prev by Date: Simple fractal
  • Next by Date: Re: MakeExpression and color
  • Previous by thread: Re: Simple fractal
  • Next by thread: Re: DynamicModule Pure Function