I am trying to use a notebook written by someone else, and I observe that in order to correctly repeat
the notebook evaluation I have to exit the notebook, re-load the MATHEMATICA, and read the notebook again. Otherwise the calculations are not reproduced. I presume this behaviour may be caused by un-cleared variables. I made a search for how to use Clear[] and ClearAll[] but I don’t feel any wiser. I certainly don’t want to put all numerous symbols present in the notebook into a Clear command, but I also don’t want to unconsciously Clear something important that is defined outside the notebook. Is there no single command that would make all my runs of the notebook identically prepared, with no left-overs from previous runs?
I would be happy to understand how this works. My questions:
where the information about the context is stored? In notebooks?
depending on (1), what will be the effect of the above command if I make a batch mode run, using as input the MATHEMATICA code in the ordinary text format (exported from a notebook, so that I don’t expect the info about the context to be there)?
What is the purpose of “Evaluate” in the above command?
What is the intended meaning of “*” in the above command? A wildcard?
(I don’t find this info in online help)
Each notebook has an option CellContext. The option value is stored within each notebook.
While preparing this post I have seen that the Evaluate[Context … syntax is no longer needed. Probably oldfashioned, something I have been using for years. One can just use:
Clear[“`*”]
Same as in the Global context.
For the role of “*” see the documentation for Clear, under Details.