Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Dynamically changing 2 interdependent variables.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81478] Re: Dynamically changing 2 interdependent variables.
  • From: dh <dh at metrohm.ch>
  • Date: Wed, 26 Sep 2007 06:25:50 -0400 (EDT)
  • References: <fd57vj$25b$1@smc.vnet.net>


Hi Michael,

I forgot to mention that Manipulate handles "Dynamic" itself, no need to 

do it twice:

oldlam=2Pi; oldk=1;

Manipulate[Print[{lam,k,oldlam,oldk}];If[oldlam!=lam,oldk=k=2Pi/lam;oldlam=lam];If[oldk!=k,oldlam=lam=2Pi/k;oldk=k];Row[{TraditionalForm[(2 

Pi)/lam]," = ",TraditionalForm[2 Pi]/TraditionalForm[(2 

Pi)/k]}],{{k,1},.1,1},{{lam,2 Pi},2 Pi,2 Pi 10}]

Daniel





Michael Knap wrote:

> Ok, I have looked over the Documentation, but I still haven't quite

> figured out how to do exactly what I want to do.

> 

> I am working on a Physics app dealing with waves, so I want to be able

> to input a wave number either expressly, as k, or in terms of lambda.

> 

> This is the relationship:  k = (2 Pi) / lambda .

> 

> I want to be able to change either variable in a Manipulate[] function,

> and have the other update appropriately.

> 

> This is what I have started with:

> 

> Manipulate[

>   Dynamic[

>    Row[{

>      TraditionalForm[k = (2 Pi)/lam],

>      " = ",

>      TraditionalForm[2 Pi]/TraditionalForm[lam = (2 Pi)/k]

>      }]

>    ],

>   {{k, 1}, .00001, 1},

>   {{lam, 2 Pi}, 2 Pi, 100}

>   ]

> 

> Notice how changing the lam slider works as expected. Changing the k

> slider does not.

> 

> Any help is appreciated.

> 




  • Prev by Date: Re: making a list using table but with different increment after
  • Next by Date: Re: making a list using table but with different increment after
  • Previous by thread: Re: Dynamically changing 2 interdependent variables.
  • Next by thread: Re: Dynamically changing 2 interdependent variables.