This question already has an answer here:
- How do I clear all user defined symbols? 6 answers
- 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.
- 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:= y' = a + b*y
Out= a + b y
In:= Clear[y] ClearAll[y] Clear["Global'*"] In:= Clear[y']
And getting an error
In:= Clear::ssym: y^[Prime] is not a symbol or a string. >>
During evaluation of In:= Information::ssym: y^[Prime] is not a symbol or a valid string pattern. >>
During evaluation of In:= Information::nomatch: No symbol matching y' found. >>
(* Looks like there is no trace of my assignment from line 1. And yet ... *) In:= y'
Out= a + b y
During evaluation of In:= Remove::ssym: y^[Prime] is not a symbol. >>
In:= Remove[y] In:= y'