Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I found a nice bug in Mathematica Could anyone check to reproduce it?

Create a file temp.txt with one line:

Attributes[s$] = {Temporary}

Load it into Mathematica with <<.

Now calculate:

Sum[x^(-n)*y^n, {n, 0, Infinity}]

Mathematica stops responding and the only option is to quit the kernel. You can't interrupt or abort.

Now change s to a or b in the file and repeat the above. It works!

Next put the line

Attributes[s$] = {Temporary}

directly into the notebook and calculate the sum. It works!

What is so special about temporary variable s$ loaded from the file?

I used a temporary variable s$ in one of my functions and then saved the function to the file. Mathematica added the above line to the file. Everything stopped working.

share|improve this question
Mathematica uses renaming to localize variables. In certain situations s will be renamed to s$ to avoid name collisions (though not in Module). You should never use such names in your code or you're risking to break things. – Szabolcs Feb 7 '14 at 0:31
@Vlad This is not a Q/A site, not a place to rant. Please make sure that you ask a clear and answerable question. If your question was, "is this a bug and how do I work around it?", then you got the answer: if you used s$ then it's not a bug, it's user error. If you didn't then maybe. Yet you fail to tell us if you did or didn;t. – Szabolcs Feb 7 '14 at 0:59
@Mr.Wizard I think that, if your use stopped working or happened to eventually break something, it wouldn't be a MMA bug, but a risk you were willing to take – Rojo Feb 7 '14 at 1:41
@Vlad, as to the difference, I think at least in the notebook the line where you set the attributes shouldn't do anything. Because since it is Temporary the symbol should get removed instantly. Perhaps that's not the case if it was defined in the file? I haven't tried – Rojo Feb 7 '14 at 1:46
I filed a bug report for this. Best advice remains: Don't use variables that end with $. Too much chance of confusing the scoping mechanism. – Daniel Lichtblau Feb 7 '14 at 16:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.