Group Abstract Group Abstract

Message Boards Message Boards

Strange (updating) behaviour of dynamic sliders deployed to the cloud

Posted 10 years ago
POSTED BY: Dominik Niedenzu
2 Replies

Dear Sean,

Thanks for answering and forwarding!

Awsome, if I got it right, you perhaps found another pecularity in the vicinity of slider ranges... It might be connected to what I meant - at least in terms of the underlying Mathematica code - but I am not sure... :)

Perhaps I have to render my description of the problem more precisely:

1) Copy my code-block gui[]:=DynamicModule[ ... ] from above and paste it into a fresh Mathematica Notebook 2) Evaluate it 3) Write and evaluate: gui[] 4) Move the last slider (must be moved first, else you see nothing) - the plot is dynamically updated 5) Now move any other slider - the plot then is dynamically updated too

Try the same procedure but instead of 3) you write and evaluate: CloudConnect[] CloudDeploy[gui[]] and instead of checkinging out anything in the Notebook check out the example in the webbrowser with the www-address given by the deploy command - you then (hopefully) will see, that 4) is still true whereas 5) is not.

In other words, the plot then is just updated when the (last) slider connected to the variable d is moved. Moving the other sliders does not have any effect on the plot. That means: the (updating) behaviour in a Notebook is another than that in a Webbrowser / Cloud. That's what I meant and what drove me crazy said night...

I do not have any insight in the underlying Mathematica code but my first guess would be that this behaviour might be due to: + the code for updating in connection with Dynamic does not run in the kernel and it expects an integer (=> b, c fails...) + the constant Pi is available just in the kernel, so that evaluating the expression 2 * Pi (=> d) somehow might trigger a communication between kernel and GUI leading to triggering the update of the plot too - or alike...???

Regards from the other side of the atlantic pond Dominik

POSTED BY: Dominik Niedenzu

That is strange. The behavior is wrong, but it's the same both in Mathematica and in the Cloud.

Fortunately, you can easily solve the problem by either

  • Initializing the value of the variables in the module
  • Giving your Slider's range in floating point instead of symbolic numbers.

To do that letter, wrap N[] around 2 Pi.

I've forwarded a simple example of the issue to the developers so that they can take a look at it:

DynamicModule[{x}, {Slider[Dynamic[x, 2 Pi]], Dynamic[x]}]

As you can see in this example, the value of x isn't initialized to 0. The problem only seems to happen when the slider's range is a symbolic number containing some operation.

POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard