Dynamic[RandomReal[], TrackedSymbols:>{x}]

I expected that both dynamics would update when I move the slider, but only the first one does. Refresh inside the second Dynamic does not help.

I have the vague feeling that I have seen this before, but at the moment I have no idea why the second dynamic does not update. Can someone help me?

  • $\begingroup$ I think I’ve seen this before too, but am on a phone and can’t conveniently search. Basically it’s because the last Dynamic[] has no dependency on x and TrackedSymbols does not create a dependency but will restrict it. Look up DynamicExpression[] maybe $\endgroup$ – Michael E2 Apr 28 '19 at 20:17
  • 1
    $\begingroup$ Just insert x; to force it to track with TrackedSymbols. It’s got to do with how Internal`TrackExpression or whatever that one is called operates. TrackedSymbols can basically only restrict is how I think about it. $\endgroup$ – b3m2a1 Apr 28 '19 at 20:59
  • $\begingroup$ Column[{Slider[Dynamic[x]], Dynamic[x; RandomReal[]],Dynamic[x; RandomReal[]]}] $\endgroup$ – MelaGo Apr 28 '19 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.