I am a new Mathematica user. I have a simple question: Every time I open a new Mathematica notebook the input entry number does not start from In[1] but follows from the number of the last input in the last Mathematica notebook I work. It follows each variable I assign in one notebook will pass automatically to the other notebook. Does anyone know I can start from In[1] each time I open a new Mathematica notebook, and how to clear all the variables I assigned from the previous notebooks? Thank you very much.
The kernel state (variables, definitions, etc) is not local to a notebook. It is shared between all notebooks. Thus k
in In[k]
refers to the k
th input in the current session not in the current notebook.
It is possible to make the state appear local to notebook by setting Evaluation -> Notebook's Default Context -> Unique to This Notebook. This won't isolate notebooks completely, as there is still only a single kernel running. But for most common use cases it is adequate. An x
variable in the first notebook will appear distinct from x
in the second notebook.