Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

This question already has an answer here:

I often digress to test some others’ code when working on my own problems. Usually, I have to check if there are conflict variables. Of course, it is not a wise way. By contrast, all the variables in Mathematica documentation center are parallel to the user’s opened notebook, even if they share the “same” name, that’s because they are in different context.

So, how to make the context of a new notebook different from the working one at the time they are opened?If this can be done, I won’t bother to restart Mathematica or clear all my variables to test them.

What’ more, is it possible to prevent the code from crushing the working kernel and front-end, even if there are serious bugs?

I guess that if the notebook can be opened in different kernels and different front-ends at the same time, all the irritating problem will be solved. But I don’t know how to do that.

share|improve this question

marked as duplicate by rcollyer, ruebenko, Yves Klett, István Zachar, whuber Mar 25 '13 at 13:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

The first answer tells you how to set it up to automatically do this. – rcollyer Mar 25 '13 at 12:53
@rcollyer Thanks a lot. I will check that. – luyuwuli Mar 25 '13 at 13:00

This command creates a new context every time it's run, (from second to second):-

 CellContext -> StringJoin["context$",



share|improve this answer
Thanks. Well, just as rcollyer said, the problem is duplicate of [link]Is there a way to separate variables between multiple notebooks?(…) – luyuwuli Mar 25 '13 at 13:21

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