Bug introduced in 11.1 or earlier and persisting through 11.3.0 or later
CASE:4024964
Here's a weird one. Starting with a fresh kernel, the first time I plot a function of \[FormalX]
, I get an error and a blank graph:
Plot[\[FormalX], {\[FormalX], 0, 1}]
(* SetDelayed::wrsym: Symbol \[FormalX] is Protected. *)
Then if I rerun the same code, it works fine:
Plot[\[FormalX], {\[FormalX], 0, 1}]
I've tried a few other formal variables. Plotting with \[FormalY]
and \[FormalZ]
both work from the start, and even prevent the same error with \[FormalX]
when used afterwards.
Does anyone else have this problem? I'm using Mathematica 11.2 on MacOS 10.13.3. Any idea what the cause is?
Addendum (June 3, 2018)
I've run into the same problem with ContourPlot
. As per Szabolcs' comment, I had fixed my problem with Plot
by placing Plot[0, {x, 0, 1}];
at the top of the package I'm writing to be silently run when loaded. However this does not prevent the same error from occuring with ContourPlot
. However, adding ContourPlot[0,{x,0,1},{y,0,1}];
does fix it.
Plot
,Table
,Do
, etc. (These functions can set a value to protected symbol, even a locked one;Block
cannot if the symbol is locked, though. $\endgroup$Plot
runs for the first time, it triggers the auto-loading of the same file that sets FormalX to be Protected. EvaluatingPlot
alone is not enough to trigger it. It is necessary to use proper syntax, e.g.Plot[x,{x,0,1}]
. Thus it is not the loading of thePlot
symbol itself that triggers this. It's something else used internally byPlot
. $\endgroup$