A package is a special Mathematica file that contains definitions for commands beyond those supplied in the basic software distribution. The idea is to allow the user to extend his or her system to include commands that will be used often. A package must be loaded before the commands in it may be used. The package is a simple ascii file that can be emailed to others. Packages provide an excellent vehicle for sharing Mathematica programs with others. Many packages are included in the standard Mathematica installation. In the Help Browser, click the Add Ons button and browse under Standard Packages to see what is available. Information can also be had here on loading packages.
Below are links to the Randolph-Macon College Mathematica packages. These packages provide commands that are intended for use in an educational setting, and are available for free download. You may download the entire set of RMC Packages as a single zip archive, or you may download any individual package file.
To download the whole shebang, click here. When the archive is unstuffed on your computer, you will have a folder named RMCPackages. Simply place it in the AddOns/Autoload directory of your Mathematica installation and you are ready to go. You may also place the folder in the AddOns/Applications directory, but if you do this you will have to load individual packages with the Needs command, as outlined below.
To download an individual package, first find (or create if necessary) the directory AddOns/Applications/RMCPackages within the main Mathematica directory. Now click the download link for the package you wish to load. Depending on your browser, either an ascii version of the package will be displayed in your browser, or it will be downloaded directly to your computer. If your browser displays the file, use your browser's Save As command to save the file with the suffix .m (eg BasicRegression.m). Once you have the file downloaded, place it in the AddOns/Applications/RMCPackages directory mentioned above. Finally, from within Mathematica, load the package with a command such as:
After entering this cell, the commands in the BasicRegression package may be called.
It is possible to set up your Mathematica installation so that a certain package will be loaded automatically at the moment you call a command defined in that package. If you use a package often, this eliminates the need to load the package with the Needs command. The mechanism works as follows: a tiny initialization file is loaded when Mathematica is launched. This file holds the names of all commands in the package (or for an entire directory of packages). When the user calls one of these commands, the appropriate package is then loaded.
To accomplish this for the RMCPackages (or for any directory containing one or more packages), do the following: Create a directory called 'Kernel' within the RMCPackages directory. Download the following file, and save it as 'init.m' within the Kernel directory you created. Download init.m here. Now move the entire RMCPackages directory from the Applications directory to the Autoload directory (Applications and Autoload share the same parent directory), and you are done. You will need to re-start Mathematica before the autoload feature will work.
This process may be used on any package. The standard packages that ship with Mathematica have the init.m file and the Kernel directory already in place, so for these packages, simply move their directory to the Autoload directory. If you create your own package, you will need to create your own init.m file; simply copy the one above and edit as needed so that it will work with your package. The init.m file is always placed in a directory called Kernel residing in the directory containing the package.
Last Updated: October 19, 2004