This note describes making a simple package in Mathematica. An example package that contains one function is made showing how to save it and load it into Mathematica and to update it again by adding a second function to it.
Each time a new function is added to the package, the package has to be reloaded.
This note is not meant by any means to be comprehensive, but only to give someone who is new at using Mathematica the minimal set of commands to make a basic package.
More details about packages are found in Mathematica help pages.
A pop-up menu will now ask you about an AUTO SAVE choice, this will happen just before the save is completed, there will be two choices, select the LEFT option by clicking on it.
Now that package is saved. You can close the file foo.nb
Notice the name used above, it is foo.m and not foo.nb, and notice that the path has two slashes in it.
Now, the package is loaded and you can call the function defined inside the package as follows f. The function can also be called by explicitly pre-appending the package name to the function as follows foo`f.
Now save the file foo.nb. Notice that now Mathematica will not ask again about the Auto Save option. This question is only asked the first time.
I’d like to thank Bill Rowe and Istvan Zachar on the Math newsgroup for helpfull suggestions while working on this note.