1
$\begingroup$

This question already has an answer here:

  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]
$\endgroup$

marked as duplicate by Karsten 7., Yves Klett, gpap, Mr.Wizard Dec 16 '14 at 19:28

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.

  • $\begingroup$ 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! $\endgroup$ – user9660 Dec 15 '14 at 16:09
  • $\begingroup$ @Lou, please edit the link. it is giving the current question. $\endgroup$ – Algohi Dec 15 '14 at 16:23
  • 1
    $\begingroup$ Have you seen this How to Clear variables with apostrophe? $\endgroup$ – user9660 Dec 15 '14 at 16:25
  • $\begingroup$ @Algohi, thanks for the hint, very thoughtful of you. $\endgroup$ – user9660 Dec 15 '14 at 16:26
  • 2
    $\begingroup$ @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. $\endgroup$ – Sjoerd C. de Vries Dec 15 '14 at 21:40
0
$\begingroup$

I'm not sure if this will help, but I use

Remove["Global `*"]

(note that the first quotation is the left quotation mark associated with the tilde key, U.S. keyboard, not the single quote associated with the double quotation key.

$\endgroup$

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