Documentation
Mathematica Notebook
Documentation table of contents.
Introduction
Mathematica is a mathematical application package that supports symbolic and numeric computations, as well as graphics. You can use it interactively by issuing commands at a simple command line prompt, or as a scientific programming language. Mathematica is available on UBUnix.
Mathematica Notebook
A Mathematica notebook is a complete interactive document that can contain ordinary text, hyperlinks, and graphics, as well as Mathematica input and output. A notebook file is platform independent and can be used on any computer system that supports Mathematica. Within a notebook, you have access to full online documentation, including The Mathematica Book. To take advantage of the notebook front end, you must be using an environment that supports the graphical user interface (GUI).
Note
If you are working in an environment that does not support GUI, you may interact with the kernel directly using a text-based interface. For more information, please refer to the CIT document Mathematica Kernel.
A Mathematica notebook consists of two parts: the kernel and the front end. The kernel is does the calculations, and the front end handles notebooks and interaction with the user.
Starting and Quitting Mathematica
To start Mathematica, enter the following at your UNIX prompt:
mathematica &
This opens the notebook front end and a palette. To load the kernel, enter a simple expression (such as 2+2) and then hold down the Shift key and press Return, or press Enter on the numeric keypad. These keystrokes tell Mathematica to evaluate your input. Pressing Return by itself gives you a new line.
Note
The first calculation will take longer than subsequent ones due to the kernel's startup time.
To exit Mathematica, select Quit from the File menu.
Notebook and Cells
Mathematica documents are called notebooks. The basic unit in a notebook is called a cell, which is analogous to a paragraph in ordinary text. Each cell can contain explanatory text, mathematical formulas, or graphics, but no combinations of these items.
The cell bracket is a small rectangular-shaped object at the right edge of the notebook window. A cell bracket indicates the extent of a cell. As you enter more lines of text in a cell, the cell bracket will expand.
Each cell appears similar to the example below:

You can select a whole cell by clicking on the cell bracket, enabling you to move it to other parts of your notebook, or to other notebooks. You can also group cells together into sections or chapters to help organize your calculations and routines.
The format of a cell is determined by its style. Styles include input, output, text, title, subtitle, section, subsection, etc. By default, new cells are input cells.
To insert text into a cell, click once in the blank section of the notebook to get a cell insertion bar, choose Text from the Style submenu of the Format menu, and start typing.
To change the style of an existing cell, select the cell by clicking on its bracket, and choose the desired style from the Style submenu of the Format menu.
For more information on the notebook and cell, please refer to the online help by clicking Help, then selecting Help.
Command Syntax
Mathematica input is case-sensitive, so it must be exact. Functions begin with capital letters. They can also contain uppercase letters within the function name itself. Input is also sensitive to spaces. In the absence of an operator, a blank space denotes multiplication.
Mathematica accepts input at its prompt (In[x]:=
where x is the input statement
number). The number is identified with a specific input and output pair,
which can be retrieved later by the symbol %
and the number. The following example demonstrates how Mathematica performs
numeric calculations:
In[1]:= 49-46^4*4
Out[1]:= -17909775
In[2]:= (23+430*(457/3)^2)/2
Out[2]:=89805277/18
In the second output, the result is given as a rational number. Mathematica
converts its output to real numbers with the addition of //N
to the input. For example:
In[3]:= %2 //N
Out[3]:= 4.9819 10^6
The symbol % and the number 2 recall the second output and re-evaluate it with the addition of //N.
Palettes
Palettes allow you to input special characters and mathematical notations. They are like extensions to your keyboard. Some palettes also do evaluations. If the Basic Input palette is not open, you can open it from the Palettes submenu of the the File menu.
Here is an example of buttons from the Basic Input palette.

To use a button from the palette — in this case, the integral button — click once in the blank section of the notebook, and then click the integral button on the palette. This will highlight the first placeholder box, indicating the area in which text will be placed. Enter the integrand (the expression you wish to integrate, e.g., Tan[x]), then press Tab to move to the next box and fill in the variable of integration x. Hold Shift and press Return to have Mathematica evaluate the integral.
File Conventions
Mathematica expects certain file extensions when some commands are executed.
Here is a list of typically expected file extensions:
| File Contents | Extension |
|---|---|
| Mathematica source file | .m |
| Mathematica notebook | .nb |
Packages
Packages are .m files that contain programs for specific applications. Mathematica offers a large collection of packages, ranging from mathematical calculations to animations of graphical images. The directory /util/math/AddOns contains subdirectories of StandardPackages and ExtraPackages.
Standard packages are divided into several subdirectories, each corresponding to a different topic (Algebra, Calculus, Graphics, etc.). Mathematica reads packages in a manner similar to that in which files are read using directory and filenames.
To read the package VectorAnalysis
in the directory Calculus for example,
enter the following from your UBUnix prompt:
In[1]:=<<Calculus'VectorAnalysis'
The ' character is the backquote, used as a context mark in Mathematica. This mark is equivalent to a backslash (/) in a file system.
For more information on packages or context marks, please refer to the Add-Ons section of the online help.
Saving Your Work
The File menu contains three options for saving Mathematica notebooks. The Save option writes the new notebook over the previous version. Save As brings up a file dialog box that allows you to select a new directory and name for your notebook. Finally, the Save As Special option allows you to save your Mathematica notebook in a variety of formats. This option will bring up a submenu, from which you can select text, HTML, TEX, and other formats.
Printing
You can print a notebook to either a PostScript (.ps)
file or a PostScript printer. Select Print
from the File menu.
To print to a PostScript printer, click the Print
button and enter the following print command into the text field:
lpr -Pprinter
printer is the name of a PostScript printer such as bell, capen, or dfn. After you have entered this command, click OK.
You can change the appearance of your printed notebook by selecting File, then Printing Options, and modifying the options presented.
Additional Information
Selecting Help from the Help menu gives you access to Mathematica's online documentation, including Built-in Functions, Add-Ons, The Mathematica Book, Getting Started, Demos, Other Information, and the Master Index.
For a complete description of Mathematica, please
refer to the following books, published by Wolfram Research:
Getting Started with Mathematica Under UNIX and X
The Mathematica Book
Mathematica Standard Add-On Packages
You can also access these books online from the Help menu within a notebook.

