Mathematica Tutorial

After opening Mathematica, you can check which directory  you're working in by evaluating


Which will probably return something like /home/username. (Remember, to evaluate an expression press Shift+Enter. Enter alone will not evaluate an expression). To work in a different directory evaluate

        SetDirectory["<directory name>"]

Make sure you put quotes around the directory name. SetDirectory reads in string variables, which are written between quotes.

A couple other useful things to know are how to see all the current variables and functions in your workspace, and how to clear them. To see what variables and functions you are working with, evaluate


(Note: The ` symbol is the grave accent, not the apostrophe '. The ` is found on the same key as ~, typically right next to the 1 key on the upper-left side of the keyboard.) To remove all the variables use



The following files provide example of how to use basic built-in functions, how to manipulate matrices, functions, and differential equations tools. The matrix example also shows you how to export and import data. The functions example shows how to run a script written in a text file from the Mathematica front end.

All the example files can be downloaded at once in this zipped tarball, including a script with examples of loops in Mathematica.

Remote Access to Mathematica

To access the Math Department's computers from  home use the instructions found at these links: Windows, Mac.

Other Links and Packages

  • A Mathematica Package with computational tools for Knot Theory can be found here.
  • A plane curves package can be found here.
  • This page has helpful guides.