# How to be sure I've cleaned up all prior definitions and assignments [duplicate]

1. Is there any general way besides restarting the kernel to make sure that nothing I've done earlier in a session will affect code I want to run now?

One book suggested running Clear["Global'*"] but this did not protect me from the problem illustrated below.

1. To verify whether I need to do something like restart the kernel, is there a way to get a list of all user definitions or assignments that are still in effect?

Background: I ran into a problem because I set y' equal to a+b*y, tried to clear y, found that y' was not a symbol, and mistakenly thought that this assignment was no longer in effect even though it was. Eventually, I discovered that I had to use Remove[y] to undo this assignment.

In[1]:= y' = a + b*y

Out[1]= a + b y

In[2]:= Clear[y]
ClearAll[y]
Clear["Global'*"]

In[5]:= Clear[y']


And getting an error

In[5]:= Clear::ssym: y^[Prime] is not a symbol or a string. >>

In[6]:= Information[y']


During evaluation of In[6]:= Information::ssym: y^[Prime] is not a symbol or a valid string pattern. >>

Out[6]= Information[Derivative[1][y]]

In[7]:= ?y'


During evaluation of In[7]:= Information::nomatch: No symbol matching y' found. >>

(* Looks like there is no trace of my assignment from line 1. And yet ... *)

In[8]:= y'

Out[8]= a + b y

In[9]:= Remove[y']


During evaluation of In[9]:= Remove::ssym: y^[Prime] is not a symbol. >>

In[10]:= Remove[y]

In[11]:= y'

Out[11]= Derivative[1][y]

• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – user9660 Dec 15 '14 at 16:09
• @Lou, please edit the link. it is giving the current question. – Algohi Dec 15 '14 at 16:23
• Have you seen this How to Clear variables with apostrophe? – user9660 Dec 15 '14 at 16:25
• @Algohi, thanks for the hint, very thoughtful of you. – user9660 Dec 15 '14 at 16:26
• @Mr.Wizard even that may not be enough. Remember that Manipulates with the SaveDefinition option set to true may inject definitions into a session as soon as the Manipulates come into view. – Sjoerd C. de Vries Dec 15 '14 at 21:40

Remove["Global *"]
`