This is documentation for Mathematica 4, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
Wolfram Research, Inc.

Special Topic: Using a Text-Based InterfaceNotebooks as Documents

1.3.4 Doing Computations in Notebooks

A typical Mathematica notebook containing text, graphics and Mathematica expressions. The brackets on the right indicate the extent of each cell.

Mathematica notebooks are structured interactive documents that are organized into a sequence of cells. Each cell contains material of a definite type—usually text, graphics, sounds or Mathematica expressions. When a notebook is displayed on the screen, the extent of each cell is indicated by a bracket on the right.

The notebook front end for Mathematica provides many ways to enter and edit the material in a notebook. Some of these ways will be standard to whatever computer system or graphical interface you are using. Others are specific to Mathematica.

Doing a computation in a Mathematica notebook.

Once you have prepared the material in a cell, you can send it as input to the Mathematica kernel simply by pressing Shift-Return or Shift-Enter. The kernel will send back whatever output is generated, and the front end will create new cells in your notebook to display this output. Note that on systems where both Return and Enter keys are available, Enter alone is typically equivalent to Shift-Return.

Here is a cell ready to be sent as input to the Mathematica kernel.

The output from the computation is inserted in a new cell.

Most kinds of output that you get in Mathematica notebooks can readily be edited, just like input. Usually Mathematica will make a copy of the output when you first start editing it, so you can keep track of the original output and its edited form.

Once you have done the editing you want, you can typically just press Shift-Return to send what you have created as input to the Mathematica kernel.

Here is a typical computation in a Mathematica notebook.

Mathematica will automatically make a copy if you start editing the output.

After you have edited the output, you can send it back as further input to the Mathematica kernel.

When you do computations in a Mathematica notebook, each line of input is typically labeled with In[n]:=, while each line of output is labeled with the corresponding Out[n]=.

There is no reason, however, that successive lines of input and output should necessarily appear one after the other in your notebook. Often, for example, you will want to go back to an earlier part of your notebook, and re-evaluate some input you gave before.

It is important to realize that wherever a particular expression appears in your notebook, it is the line number given in In[n]:= or Out[n]= which determines when the expression was processed by the Mathematica kernel. Thus, for example, the fact that one expression may appear earlier than another in your notebook does not mean that it will have been evaluated first by the kernel. This will only be the case if it has a lower line number.

Each line of input and output is given a label when it is evaluated by the kernel. It is these labels, not the position of the expression in the notebook, that indicate the ordering of evaluation by the kernel.

If you make a mistake and try to enter input that the Mathematica kernel does not understand, then the front end will produce a beep. In general, you will get a beep whenever something goes wrong in the front end. You can find out the origin of the beep using the Why the Beep? item in the Help menu.

Operations on graphics and sounds.

Special Topic: Using a Text-Based InterfaceNotebooks as Documents