5
$\begingroup$

Bug introduced in 10.0 and persisting through 11.0.1 or later


Starting from Mathematica 10, there's a new feature: when you begin editing your input cell, its output becomes faded. A side effect of it is that in certain cases the output is dynamically updated. This results in annoyances like when you e.g. have made a mistake leading to messages being emitted and now try to edit the input cell to fix the mistake.

Here's a simple example:

Manipulate[ListPlot[Table[Sin[a x]/(a x), {x, -10, 10}], Joined -> True], {a, -10, 10}]

(manipulator here)

Power::infy: Infinite expression 1/0 encountered.

Infinity::indet: Indeterminate expression 0 ComplexInfinity encountered.

Now try e.g. to replace Sin[a x]/(a x) with Sinc[a x], and you'll get two more identical messages. In more complicated scenarios the manipulator may spit lots of messages, which you may have stopped by e.g. Alt+.. But once you start editing the input cell, all they will be emitted again.

This does not happen with every input. It happens with Manipulates that contain contain plotting functions in their code (even if the plot output is never displayed).

So my question is: how do I disable this (mis)feature of fading the output on editing input?

$\endgroup$
  • $\begingroup$ Could you not delete the output cell before you begin editing the input cell? $\endgroup$ – Edmund Oct 30 '16 at 12:53
  • $\begingroup$ The output doesn't get re-evaluated. Dynamic updating is triggered for some reason in this Manipulate (but not in general). Perhaps you can update the title and description to avoid any confusion. $\endgroup$ – Szabolcs Oct 30 '16 at 12:56
  • $\begingroup$ I've reported this when it first happened, FWIW. $\endgroup$ – Michael E2 Oct 30 '16 at 12:56
  • $\begingroup$ @MichaelE2 Do you understand what is happening? There's no general re-evaluation (that would be a disaster). Not all Dynamic stuff gets updates (simple examples don't). Manipulate is a bit special in that it doesn't actually evaluate, it just formats in a special way (MakeBoxes). I tested and MakeBoxes are not called a second time when the output is faded. What happens then? $\endgroup$ – Szabolcs Oct 30 '16 at 13:01
  • $\begingroup$ Without the ListPlot it doesn't even happen. Can't reproduce with simpler Manipulates. $\endgroup$ – Szabolcs Oct 30 '16 at 13:05
3
$\begingroup$

Here is a workaround, unless you like plot themes: PlotTheme -> None.

n = 0;
Dynamic[n]

Manipulate[
 1/x; 
 ++n;
 Plot[Sin[n t], {t, 0, Pi}, PlotTheme -> None],
 {x, 0, 1}, TrackedSymbols :> {x}]

I reported this in October, 2014 (CASE:1866485). One of the developers said he thought it had to do with a dependency related to plot themes being set that shouldn't be. That gave me the idea for the workaround above.


One can also set $PlotTheme = None as a workaround. If the Manipulate has already been executed, a new $PlotTheme will not take effect until after the next time Manipulate updates the plot.

$PlotTheme = None;  (* execute after Manipulate to see it work after the fact *)

Manipulate[1/x;
 ListPlot@Table[Sin[(1 + x) t]^2, {t, 0, 10}],
 {x, 0, 1}, TrackedSymbols :> {x}]
$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.