1
  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]
Sektor
  • 3,320
  • 7
  • 27
  • 36
Paul
  • 11
  • 1

1 Answers1

0

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.