Mathematica/Getting Started

InstallationEdit

If you have just obtained a copy of Mathematica, you will need to install it on your system. To do this, you should follow the instructions that come with your copy.

Interfacing with MathematicaEdit

Mathematica runs as a "kernel" which performs the calculations and the "front-end" with which it communicates with the user by input and output. Mathematica can be used either through interactive "notebook" files or through a command prompt-style text interface.

Notebook InterfaceEdit

The notebook style interface can be started by clicking a Mathematica icon or a Mathematica entry on the start menu. When this is done, a blank notebook is opened.

You can then input commands into the notebook inteface. Pressing Shift-Enter executes the command and produces the output you desire.

When a command is executed, it is labeled automatically by In[n]:=, where "n" is a unique identifier (for that session) for your input. The corresponding output is labeled Out[n]:=. For example, consider the following command where you add 2 and 3. You simply type "2+3 and press Shift-Enter. The notebook will then display the following:

 In[1]:=  2+3
 Out[1]=  5

QuittingEdit

To quit the notebook, you may click the "X" in the top-right of the notebook window, or press Ctrl-F4 or select the Close menu item in the File menu. This will prompt you to save if the notebook has been edited since the last save. To close the whole of Mathematica, click the "X" in the top right of the Mathematica window, or select the Exit option on the File menu.

Text InterfaceEdit

The text interface can be started in a terminal (command “math”). Input is entered as usual but it's only necessary to press “enter” to execute commands (some characters though cannot be entered — greek letters, integrals, etc. — but equivalent commands will exist). Because of the terminal's limitations, the output is formatted differently from the graphical interface: when possible formulae are rendered with 2D constructs mimicking fractions, exponents, etc., while plots are not shown (a string “-Graphics-” appears instead).

To quit the text interface, one can use the “Quit[]” command or type an “end of file” character (Unix: Ctrl-D).

The text interface is most suitable to the batch execution of code or remote development when desktop sharing isn't an option (either because the bandwidth doesn't allow it or when there are restrictions preventing one from resorting to the notebook interface). This can be done by writing the code in a file and tell Mathematica to run it. This would typically be run as follows:

math < code.m