Delta Banner

Mathematics & Science Learning Center
Computer Laboratory


Mathematica Basics—The Environment


The Interface

As you are probably already aware, Mathematica is one of a class of applications called computer algebra systems. With the right input it is capable of doing almost all of the mathematics you have learned in college so far, and much of what you have yet to learn! Its abilities come at a price, both financial, and in the effort you have to put into learning its interface. It is less forgiving than most software when it comes to minor differences in your input. A missing comma or brace can lead to serious, hard to track down errors, so it is essential that you pay careful attention to detail when you enter commands into the program.

When you interact with Mathematica, you do so by typing text commands into its front-end, which then sends these commands off to the core of the program, called the kernel. The kernel then executes the code you have entered, and returns the result to you through the front end-again. As you carry on this conversation with Mathematica's kernel, you will create a document, called a notebook, (file extension .nb) consisting of cells. These cells have two primary types, input cells, and output cells, (though many other cell types, such as text cells and graphic cells also exist.)

Input and output cells are numbered sequentially, usually in pairs, as you carry out your conversation with the kernel. These inputs and outputs are not tied in any way to the specific notebook you have open in front of you. They are tied to the session you have been having with the kernel. You could close a notebook and open a new one, and the numbering would pick up where the old notebook left off, provided the kernel was not terminated in the transition.

Getting Command Help

There are two main ways of obtaining help from Mathematica if you run into any questions about it's built in commands, etc.

  • The ?command: The simplest way to get help assumes that you already know the name of the command that you wish to use, and simply wish to check on its syntax. This can be found by typing a question mark, followed by the command's name, followed by hitting the ENTER key. This same command can be used to check on the current values of the variables that you are using, and the definitions of user defined functions, etc.

  • The Help menu: If you have no idea what the command you are seeking is even called, Mathematica's help menu is extraordinarily rich in information. The entire Mathematica manual is available through this menu, as are examples of using the command you seek. The main information you are looking for can almost certainly be tracked down in the first four choices in the menu, as shown below.

    Mathematica Help Menu

Typing Shortcuts

While using Mathematica it is handy to be aware of a few typing shortcuts. (Note that on the Macintosh the COMMAND key would replace the CONTROL key in the discussion below.)

  • CONTROL-K: This keystroke will attempt to complete the command that you are currently typing. If the there is more than one possible ending to what you have typed so far, Mathematica will generate a little pop-up menu containing the the full list of possible endings. You may select one of the items on this list by either using the mouse, and clicking, or the arrow keys on the keyboard, and hitting RETURN.

  • CONTROL-L: This keystroke retypes in the current cell the full command from the cell immediately above it. The newly produced cell may then be edited to give a new command. This comes in useful when you are doing a sequence of problems where very little changes between consecutive commands.

  • The %-key: The percent key, %, can be used as a direct reference within a new command to the previous answer. This comes in useful when doing a sequence of commands where a new command depends on the result of the previous command. Furthermore, %% refers to the result from two commands earlier, %%% to three commands earlier, etc. %n refers to the result from Out[n] in Mathematica's sequentially numbered cells.

You're now finishing learning the Basics of the Mathematica Interface. You may now go to the first notebook, the Table of Contents for the Mathematica Basics Labs, or the Table of Contents for all of the Differential Equations Labs, or simply quit.


ODE Laboratories: A Sabbatical Project by Christopher A. Barker

©2017 San Joaquin Delta College, 5151 Pacific Ave., Stockton, CA 95207, USA