The notebook is where most of the action takes place. It is in the notebook that you tell Mathematica what you would like it to do and Mathematica gives you the results.

You will notice that when you first begin to use the notebook you have a sideways cursor. Click in the empty notebook to start a new cell. Mathematica organizes the input and output from the notebook into cells. For the purposes of this tutorial, we will not go into depth about cell use, but you can read up on them in the Mathematica Book and the online help.

After you click in the blank notebook it may not appear that you have started a place to type, but you have. Type 1+1. To get Mathematica to tell you the answer, you must press Shift and Enter together. Doing so should give you a result similar to the following:

Notice the brackets on the right hand side of the notebook. The input and output are grouped together by a larger bracket. This larger bracket is the cell. The bracket denotes your input. The bracket denotes that the output of the calculation was text. Later we will see that Mathematica uses different brackets to denote different types of output.

Also note that the input was labeled In[1] and the output was labeled Out[1]. If we wanted to use the output in a later expression, we could do so by typing Out[1]+Out[1], which would give us a result of 4. We can also reference In[1] for later commands. We can also quickly reference the output of the previous command with %, the output of two commands previous with %%, and so on. So if your notebook now looks like:

Then typing %%-% would give the result -2 (2-4) while %-%% would yield 2 (4-2).

Finally, you may have noticed that Mathematica seemed a little sluggish giving us the answer to 1+1. That is because Mathematica's notebook is powered by a kernel that does the calculations. Mathematica does not start the kernel until it needs to, so the first command when you first start Mathematica will seem a bit slow. Rest assured, however, that this is a quick and robust program, and subsequent calculations will be much quicker. Try 1+1 again, or N[Pi,10000], which asks Mathematica to calculate the first ten thousand digits of Pi.

There is one last thing to say about cells. They can be collapsed to save space in your notebook. If you just tried asking Mathematica to give you the first 10000 digits of Pi, you ended up with pages worth of numbers. The entire answer takes 63k as a .gif. The first few lines of it look like this:

and on and on and on. This is rather impressive to look at. Once. It then becomes ponderous to page through while going back and forth from the early results in your notebook to the later results. To help cope with this, you can double click on the far right bracket, the one that contains both the input and output brackets. This will "roll up" the cell and hide the output until you would like to see it again. After hiding the output of the first ten thousand digits of Pi your notebook should look like this:

The outer bracket now has an indicator on the bottom to show that it is hiding the output. Double clicking on it again will reveal the output once more.

Many of the examples and demonstrations in the online help for Mathematica are hidden for neatness of presentation. To view them you must open them in this way.

 

Tutorial Home

Table of Contents

About this Site
Previous: Let's Get Started! Next: Naming conventions and Mathematica's Unifying Idea