Message Boards Message Boards

GROUPS:

Why the appended simple Manipulate makes Windows 10 crash sometimes ?

Posted 1 month ago
595 Views
|
10 Replies
|
7 Total Likes
|

My Mathematica version is 12.0. The simple code results from an attempt to understand the various problems encountered in dynamical simulations of many body systems. The observed malfunctions in the present system are: 1. unpredictable spontaneous stops (the point no longer moves). 2. The Session window sometimes disappears if the mouse comes close the window boundaries. 3. The Mathematica icon on the task bar sometimes shows a yellow dot at the right lower corner. I would be extremely grateful for hints to potential reasons for malfunctions in this simple 'freely running Manipulate' !!!!

Attachments:
10 Replies
Posted 1 month ago

In this case, Animate might be a better choice than Manipulate

Animate[
    Graphics[{
        PointSize@Large, Red, Point[{Cos@a, Sin@a}],
        Blue, Point[{0, 0}],
        Opacity[0.25, Gray], Rectangle[{-1.1, -1.1}, {1.1, 1.1}]
    }],
    {a, 0, Infinity, 0.1},
    AnimationRunning -> False
 ]

... makes Windows 10 crash sometimes ?

I cannot detect any "malfunctions" on my system (12.0.0 for Linux x86 (64-bit) (April 7, 2019)). It might not be very helpful in this particular case, but my general advocacy is to use a good and reliable operation system ...

Posted 1 month ago

Your example runs fine on my system. Windows 10 Home.

I will say that I get more smooth display with the following:

Manipulate[
  DynamicModule[{gr},
  Dynamic[
   If[run, \[Phi] += d\[Phi]]; x = Cos[\[Phi]]; y = Sin[\[Phi]]; 
   gr = Graphics[{Red, Point[{x, y}], Blue, Point[{0., 0.}], 
      Opacity[0.25, Gray], Rectangle[{-1.1, -1.1}, {1.1, 1.1}]}, 
     PlotRange -> 1];
   Show[gr]
   ]
  ], {run, {False, True}},
 {{d\[Phi], 0.1}, 0., 0.2},
 {x, ControlType -> None}, 
 {y, ControlType -> None},
 {{\[Phi], 0.}, ControlType -> None}
 ]

Dear Hans, unfortunately I really need Manipulate since I need reaction of my dynamical system (for which the moving red point is a simplistic example) on controls (for which my dphi-slider, again, is a simplistic example).

Thank you for your observation.

Dear Henrik, please tell me whether on your system the cell braked right to the running graphics shows unsteady flickering as it does on mine? This flickering seems to result from busy communication between front end and kernel and could be an indicate the problem that the program is causing on my system.

Thanks for your help.

Dear Ulrich, yes, with your original code I do see the cell bracket flickering. If I only include the compound expression of Manipulate in a Dynamic[] like so

Manipulate[ 
 Dynamic[If[run, \[Phi] += d\[Phi]]; x = Cos[\[Phi]]; y = Sin[\[Phi]];
   Graphics[{Red, Point[{x, y}], Blue, Point[{0., 0.}], 
    Opacity[0.25, Gray], 
    Rectangle[{-1.1, -1.1}, {1.1, 1.1}]}]], {run, {False, True}},
 {{d\[Phi], 0.1}, 0., 0.2},
 {x, ControlType -> None}, 
 {y, ControlType -> None},
 {{\[Phi], 0.}, ControlType -> None}
 ]

as already suggested by @David G - the flickering disappears and everything runs smoothly.

Beste Gruesse -- Henrik

Dear David, your proposal runs perfectly on my system. Trying to understand where this calm behavior comes from I stripped it down and ended up with the minimal version that behaves equally well. Unfortunately I don't yet understand what 'Dynamic' does here. Please find the minimal version appended as studyManipulate5a.nb. Another minimal working version is studyManipulate2a.nb which is also appended.

Thanks for your fruitful suggestion.

Dear Henrik, do you understand you understand the role of this additional Dynamic? The Documentation says a bit about Dynamic within Manipulate and explains that parts of the first argument of Manipulate that are not included by the additional Dynamic are not automatically revaluated. But if everything is within the additional Dynamic there should be the same behavior as without the additional Dynamic. Seems to be a difficult matter on which the Documentation could be a bit more explicit. As I mention in my reply to David, a final addition SynchronousUpdating ->True has the same beneficial effect as the additional Dynamic.

Best Regards, Ulrich

Posted 1 month ago

Ulrich,

I think your use of SynchronousUpdating->True is a more desirable solution and it makes more sense to me from the documentation (ie, the Frontend blocks other tasks during evaluation when set to True) . Using Dynamic has a similar effect, but the reason appears to be more subtle. But based on its documentation, I think the use of Dynamic forces the expression within Manipulate to evaluate whenever any dependent variables change values, not just when a control variable changes. I'm not an expert on Dynamic, however.

... But if everything is within the additional Dynamic there should be the same behavior as without the additional Dynamic.

Dear Ulrich,

I found and read the documentation on

"Advanced Manipulate Functionality / Using Dynamic inside Manipulate"

you are obviously referring to - and see it the same way. It stays somewhat empirical. And in fact there is stated that

Explaining the full range of what is possible by using Dynamic explicitly inside Manipulate is beyond the scope of this document, ...

Best regards -- Henrik

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

Group Abstract Group Abstract