Using the Standard Mathematica Packages
If you want to use a function from a particular package, you must first read the package into Mathematica. After you have loaded the package, you can use the function in the same way you use a built-in function.
Reading in Mathematica packages.
This command reads in a Mathematica package that contains various combinatorial functions.
In[1]:= <<DiscreteMath`CombinatorialFunctions`
The Subfactorial function is defined in the package.
In[2]:= Subfactorial[10]
Out[2]=
There are a number of subtleties associated with such issues as conflicts between the names of functions in different packages. These are briefly discussed below and in more detail in The Mathematica Book. One important point to note, however, is that you must not refer to a function that you will read from a package before actually reading in the package. If you do this by mistake, you will have to execute the command Remove["name"] to get rid of the function before you read in the package that defines it. If you do not call Remove, Mathematica will use "your" version of the function, rather than the one from the package.
Clearing and removing symbols in Mathematica.