关于触发和更新Manipulate表达式的问题

Nas*_*ser 4 wolfram-mathematica

专家介绍,

我无法弄清楚为什么每次点击作为Trigger控件一部分的'StepRightButton'时,Manipulate表达式被评估2次.

当我点击"+"按钮时,我看到计数器按预期上升了一次,但表达式被评估了2次,而不是按预期计算.这是一个小例子

Manipulate[

Show[
Graphics@Text@Row[{currentTime,"   ",Date[]}],
Plot[Sin[x],{x,-Pi,Pi}]
],

Control[{{currentTime,0,Style["run",10]},0,100,0.1,
      ControlType->Trigger,DisplayAllSteps->True,ImageSize->Tiny,
      AnimationRate->Automatic,AnimationRepetitions->0,
      AppearanceElements->{"PlayButton","PauseButton","StepRightButton","ResetButton"}}
],

ContinuousAction->False,
SynchronousUpdating->False

]
Run Code Online (Sandbox Code Playgroud)

再次,单击"+"表示'currentTime'变量正在增加正确的数量(在本例中为0.1).但我的问题是,为什么表达式被评估两次,因为每次点击"+"按钮时可以看到打印的Date []增加2次.

这导致我的问题,因为我假设表达式将每'tick'评估一次.

这是一种确保每次单击"+"一次评估表达式的方法吗?

谢谢,

Sjo*_*ies 8

这可以通过向函数添加选项PerformanceGoal -> "Quality"来解决Plot.

在显示被操纵的项目期间,可以根据PerformanceGoal设置显示对象的较低保真度样本.如有必要,在操作结束时绘制更高保真度的版本.这是后来的重绘,这似乎导致了这里的问题.

  • @Nasser ...并且不要忘记`PerformanceGoal`和`$ PerformanceGoal`的文档页面.在后者你会发现:*$ PerformanceGoal的典型默认值是ControlActive ["速度","质量"].* (2认同)