LESSON 1
First Look at 
MATHEMATICA

Author's notice

This tutorial was written by 

Fred Goodman
Department of Mathematics
University of Iowa
Iowa City, IA 52242
goodman@math.uiowa.edu

This material may be freely copied and used for non-commercial purposes. Please retain this author's notice, and do not distribute any altered version of this material without the author's permission  (unless  the material is altered beyond recognition).

Mathematica Notebooks

The Mathematica program has two parts: a "front end" which is used to edit input and display output, and a "kernel" which does actual computations. 
Mathematica documents  are called notebooks; this document is a Mathematica notebook.  Familiar operations for opening, editing, and saving documents also can be used with  Mathematica notebooks.  

 Mathematica notebooks have an additional structure which you have probably noticed already in this notebook:  Notebooks are divided into segments called "cells."    Cells are  delimited by brackets on the right side of the document.
 Cells are of different types; this is a "text cell," which is used for explanation and documentation.  You can "select" a cell by clicking once on its bracket.  The usual   editing operations (cut, copy, paste) can also be applied to  whole cells.

Input for computation is typed in an "input cell,"  and the output is returned in an "output cell".  Here is an example:

Cos[π]

Cells are frequently nested, i.e. one cell can be contained in another. For example the input and ouput cells above are grouped together in another  cell.  Whenever cells are grouped, it is possible to "close" the group,  displaying only a heading for the whole group, by double clicking on the outside bracket delimiting the group.  Conversely, closed groups can be opened by double clicking on the group bracket.  Try closing  and opening the group of two cells above by double clicking on the bracket.
When the group is closed you should see this:

Cos[π]

Often when you open a Mathematica notebook,  you will see only what looks like a table of contents.  You can open the sections  of the notebook by double clicking on the bounding brackets, and you  can close them again when you are done with them.  
Open the next section of this notebook to  continue with this tutorial.

Doing computations.

Input for computation must be entered into an input cell.  You can start a new cell by placing the I-beam cursor in an area between cells, clicking once and starting to type.  Such a new cell is always an input cell.
  Here is another example of an input cell:

Plot[Sin[x],{x,-10,10}]

To send your input to the Mathematica kernel for evaluation,  chose the input cell by clicking its bracket or anywhere inside the cell, and the press Enter (Enter--not Return)  or Command-Return or Shift-Return. Here is what you should get when you do this with the input cell above:

Plot[Sin[x],{x,-10,10}]

Try doing this yourself now.  Click in the input cell above and then press enter.  Congratulations on your first Mathematica computation.

Here is another exciting exercise  for you:  Try opening a new input cell just after this one, typing some simple addition  like 
35+71
and then evaluating it.

You can change the type of a cell (for example if you open a new cell, necessarily an input cell, and then want to change it to a text cell) as follows:
Choose "Cell Style" in the style menu, and then "text" (or whatever) in the cell style submenu.  I find it easier, however to work in a notebook with the "ruler" showing.  The ruler is showing in this notebook and you see  a box containg a menu on the top left of the screen where you can choose a cell type.  If the ruler is not showing in a notebook, you can make it appear by choosing "show ruler" in the style menu.

Now that you know how to handle cells,  and send input to the kernel for evaluation, you can look at the next lesson to learn what you can compute.