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

I first thought that doing Quit[] in a cell, or Evaluation->Quit kernel, is supposed to remove all Global variables, but I have a case where this is not happening, then I read that there is a command Quit from the menu to also shut down the front end, so I wanted to try that to see if that will clear those variables, which I suppose are saved by the front end. (I know I can ofcourse just type Remove["Globals`*"], but was looking looking at what seems like a symbols leakage problem with Manipulate.

Any one knows how to close the front end please?

I can't find this Quit command from the menu, which is supposed to be different from the Quit[] for the kernel? I only see Quit kernel in the menu. But when I try that, these variables are not cleared!

enter image description here

Again, the reason I wanted to do the above is because not all variables are cleared when I restart the kernel (either by Quit[] or by stopping the kernel from the menu:

enter image description here

Btw, according to this answer here Quit[] the kernel is supposed to clear all variables ! but this is not the case with me here. ps. I never even knew before there was a Quit command for the front end.

ps. I will be happy to post the code that generates this if needed.

thanks

edit(1)

According to help message above, it said there is Quit menu item to close the from end, but on windows, V 8.04, I only see Quit kernel, which is the same as Quit[] typed in the notebook.

enter image description here

share|improve this question
1  
Related: the comments on stackoverflow.com/a/8260394/695132 – Szabolcs Jan 25 '12 at 10:21
You are right, I forgot I even asked you about this once :), so I guess this is a case where Quit[] does not clear everything! – Nasser Jan 25 '12 at 10:41

2 Answers

up vote 10 down vote accepted

From your description you seem to have an open window containing Dynamic content, which is what prevents some variables being cleared by simply quitting the kernel (or rather they get redefined again).

So why don't you just close all windows containing any Manipulates or Dynamic and then use Quit[] (or Quit Kernel from the Evaluation menu) ?

The only menu command to quit the Front End is the "Quit Mathematica" menu item in the Mathematica menu, which will indeed work (in a rather radical way) until you reopen the same notebooks that caused the problem to start with.

share|improve this answer
Thank you. Just to be clear, are you saying that one should close all open notebooks windows before doing Quit[] (but then I would need at least one window open to type the Quit[] command on?, may be that should be a fresh empty notebook opened just for this command after I closed everything), to make sure that all Global variables are removed? and I do not see this "Quit Mathematica" menu item on my V 8.04 on windows. I only see "Quit kernel". But the help said there is a Quit front end menu item. PLease see edit (1) for screen shot of my setup. thanks – Nasser Jan 25 '12 at 10:26
And btw, this happens when I have ONLY one notebook open, with ONE cell, and ONE manipulate in that cell. I simply SHIFT-ENTER the cell to evaluate the Manipulate, then I type Quit[], and see that not all global variables are cleared. I just verified it again. Started M and did it again, same thing. Quit[] is not removing all Global variables, and yes, you are correct, there is a Dynamic in that one cell. But I always thought Quit[] was supposed to clear all Global variables. I was wrong. Now I will type Remove["Global`*"] to be sure. Thanks. – Nasser Jan 25 '12 at 10:39
1  
No @NasserM.Abbasi. Andrzej means that you should close the window(s) containing the actual Manipulate, since those are the source of your problem. Then you just use Quit[] in a (newly) open window – magma Jan 25 '12 at 10:48
I see, thanks. So I guess it is the Dynamic that was causing this issue. I understand now. – Nasser Jan 25 '12 at 11:08
It might look pedantic, but I feel you really want to understand this: I think the important remark of Andrzej ia that the restart of the Kernel of course always removes the global symbols - it's the Manipulate/Dynamic which recreates them during it's initialization. – Albert Retey Jan 25 '12 at 15:42

I cannot reproduce your problem, but the command to close a front end is FrontEndTokenExecute["Close"]. If you want to terminate the complete front end process (including all running notebooks), you use FrontEndTokenExecute["FrontEndQuit"]. There's also a middle-ground which closes all notebooks, but doesn't terminate the process: FrontEndTokenExecute["CloseAll"].

share|improve this answer

Your Answer

 
discard

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

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