1
$\begingroup$

I would like to create a Manipulate[] with several interdependent variables. E.g. consider this simple example

Manipulate[x = 3*y; {x, y}, {y, 0, 2}, {x, 0, 6}]

The problem is that Manipulate[] only lets me manipulate the variable on the RHS. However, I would like to be able to manipulate both variables. Thanks in advance!

$\endgroup$
  • $\begingroup$ use == not =. $\endgroup$ – zhk Apr 29 '17 at 9:14
  • 1
    $\begingroup$ @zhk: using == doesn't seem to make the two variables interdependent $\endgroup$ – onion Apr 29 '17 at 9:32
  • $\begingroup$ Is this something like what you want? DynamicModule[{x, y}, Column[{ {Dynamic[x], Dynamic[y]}, Slider[Dynamic[y, y = #; x = 3 y; &], {0, 2}], Slider[Dynamic[x, x = #; y = x/3; &], {0, 6}] }] ] The sliders aren't as pretty as in Manipulate, but I don't know how to use the second argument of Dynamic within Manipulate. $\endgroup$ – jjc385 Apr 29 '17 at 9:35
  • 1
    $\begingroup$ Manipulate[{x, y}, {y, 0, 2, TrackingFunction :> ((y = #; x = 3 y) &)}, {x, 0, 6, TrackingFunction :> ((x = #; y = x/3) &)}] $\endgroup$ – Kuba Apr 29 '17 at 9:38
  • $\begingroup$ awesome! this works. thank you kuba for the solution. also thanks jjc385 for a solution that works also :) $\endgroup$ – onion Apr 29 '17 at 9:39

Browse other questions tagged or ask your own question.