[an error occurred while processing this directive]
$ContextPath is a global variable that gives a list of contexts, after $Context, to search in trying to find a symbol that has been entered.
Each context is specified by a string of the form "
The elements of $ContextPath are tested in order to try and find a context containing a particular symbol.
$ContextPath is modified by Begin, BeginPackage, End and EndPackage.
$ContextPath is a rough analog for Mathematica symbols of the "search path" for files in many operating systems.
See the Mathematica book: Section 2.6.8.
When you refer to a symbol (function or variable) by its short namethat is, without specifying its contextMathematica must decide what context it belongs to. First it looks for that symbol in the current context, specified by $Context, and then successively in each of the elements of the context search path, which is stored in $ContextPath.
Here is the context path when you start Mathematica. "System`" contains predefined symbols, and "Global`" is where the symbols you define go by default.
If you remove "System`" from the context path, predefined symbols can no longer be referred to by their short names. In this example, the system function for the logarithm is no longer accessed under Log.
In:= $ContextPath="Global`"; Log
It is still accessible under the full name, like any other symbol.
Here we restore the context path to its initial value.
Usually the context search path is changed not by means of an assignment to $ContextPath, but rather indirectly, as part of the action of a package. See the Further Examples for BeginPackage.