Collatz_use.nb is a notebook which demonstrates how a Mathematica package can be used.

In this case, a package named "Collatz.m" has been written, and placed in the appropriate place.  The appropriate place is the "Applications" or "Autoload" subdirectories of the UserBaseDirectory, as defined by Mathematica. 

Modified:  18 September 2005

Author: John Burkardt

Our first task is to find out the name of the directory where the file should have been stored.

$UserBaseDirectory

Before we change directories (just to have a look), we save the location of our current home directory so we can get back!

home = Directory[]

Now we jump over to the UserBaseDirectory.

SetDirectory[$UserBaseDirectory]

From here it is easy to move down a level, to the directory where we expect the package file to be stored.

SetDirectory["Applications"]

Now we can ask for a listing of the contents of this directory.  The file "Collatz.m" should show up.

FileNames[]

Now let's go home.

SetDirectory[home]

And now we can load the package, and issue some commands.

<<Collatz.m

Collatz[1]

Collatz[10]

Collatz[131]

StoppingTime[131]

FindMaxima[1]