1.3.10 Mathematica Packages
One of the most important features of Mathematica is that it is an extensible system. There is a certain amount of mathematical and other functionality that is built into Mathematica. But by using the Mathematica language, it is always possible to add more functionality.
For many kinds of calculations, what is built into the standard version of Mathematica will be quite sufficient. However, if you work in a particular specialized area, you may find that you often need to use certain functions that are not built into Mathematica.
In such cases, you may well be able to find a Mathematica package that contains the functions you need. Mathematica packages are files written in the Mathematica language. They consist of collections of Mathematica definitions which "teach" Mathematica about particular application areas.
Reading in Mathematica packages.
If you want to use functions from a particular package, you must first read the package into Mathematica. The details of how to do this are discussed in Section 1.11. There are various conventions that govern the names you should use to refer to packages.
This command reads in a particular Mathematica package.
In:= << DiscreteMath`CombinatorialFunctions`
The Subfactorial function is defined in the package.
There are a number of subtleties associated with such issues as conflicts between names of functions in different packages. These are discussed in Section 2.6.9. One 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 which defines it. If you do not call Remove, Mathematica will use "your" version of the function, rather than the one from the package.
Making sure that Mathematica uses correct definitions from packages.
The fact that Mathematica can be extended using packages means that the boundary of exactly what is "part of Mathematica" is quite blurred. As far as usage is concerned, there is actually no difference between functions defined in packages and functions that are fundamentally built into Mathematica.
In fact, a fair number of the functions described in this book are actually implemented as Mathematica packages. However, on most Mathematica systems, the necessary packages have been preloaded, so that the functions they define are always present. (On some systems with severe memory limitations, even these packages may be loaded only on request.)
To blur the boundary of what is part of Mathematica even further, Section 2.6.11 describes how you can tell Mathematica automatically to load a particular package if you ever try to use a certain function. If you never use that function, then it will not be present. But as soon as you try to use it, its definition will be read in from a Mathematica package.
As a practical matter, the functions that should be considered "part of Mathematica" are probably those that are present in all Mathematica systems. It is these functions that are primarily discussed in this book.
Nevertheless, most versions of Mathematica come with a standard set of Mathematica packages, which contain definitions for many more functions. Some of these functions are mentioned in this book. But to get them, you must usually read in the necessary packages explicitly.
You can use the Help Browser to get information on standard Mathematica add-on packages.
Of course, it is possible to set your Mathematica system up so that particular packages are pre-loaded, or are automatically loaded when needed. If you do this, then there may be many functions that appear as standard in your version of Mathematica, but which are not documented in this book.
One point that should be mentioned is the relationship between packages and notebooks. Both are stored as files on your computer system, and both can be read into Mathematica. However, a notebook is intended to be displayed, typically with a notebook interface, while a package is intended only to be used as Mathematica input. Many notebooks in fact contain sections that can be considered as packages, and which contain sequences of definitions intended for input to Mathematica.
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER
FOR THE LATEST INFORMATION.