Mathematica (Version 11.0 & 10.4.1 & 10.3. & 10.2 & 10.1. & 10.0 & 9.0.1 & 8.0.4 & 7.0 & 6.0 & 5.2)

The Help Browser
Getting Started
Some Mathematica Conventions
Initialization Files and Resources
Mathematica Version 5.2

Mathematica is the world's only fully integrated environment for technical computing. First released in 1988, it has had a profound effect on the way computers are used in many technical and other fields.

Mathematica contains a vast array of novel algorithms and important technical innovations. Among these innovations is the concept of platform independent interactive documents known as notebooks. Notebooks have already become the standard for many kinds of courseware and reports, and with the new capabilities added in Mathematica 3.0 they are poised to emerge as a general standard for publishing technical documents on the web and elsewhere.

Mathematica 5 delivers impressive speed gains, especially in numerical calculation. Mathematica has always been a powerful environment for prototyping, and with its fast new numeric algorithms you can now perform extensive simulations within Mathematica itself.

Mathematica is made of two parts: a Kernel and a Front End. The kernel is the part that does calculations. The front end is the part that handles notebooks and interaction with the user. The front end and kernel programs are called Mathematica and MathKernel, respectively.


The Documentation subdirectory of the main Mathematica directory is the location of all on-line documentation used with the Mathematica program. The only subdirectory within Documentation is the name of a language, i.e. English.

All the elements of the Documentation directory can be accessed through the Help Browser in the Front End. BrowserCategories files in each subdirectory set up the categories used in the Help Browser. BrowserIndex files provide data for the master index.

Typical subdirectories of the "Documentation/English" directory are:

RefGuide Reference guide and examples for built�in functions
MainBook The complete text of The Mathematica Book
AddOns Documentation for packages and other add�ons
GettingStarted Introductory documentation for specific systems
OtherInformation Additional Mathematica information

Further information:

The Help Browser

The Help Browser is the main way to find help with Mathematica. Choosing Help... from the Help menu you access to Mathematica's on-line documentation.

The information in the Help Browser is divided into six categories.

  • Built-in Functions. Information on the built-in functions in the Mathematica kernel.
  • Add-ons. Information on add-ons installed in your Mathematica system, including MathLink.
  • The Mathematica Book. The complete text of The Mathematica Book.
  • Getting Started/Demos. The Mathematica on-line document, along with notebooks and palettes that demonstrate the versatility and power of Mathematica.
  • Other Information. Information about other resources associated with Mathematica.
  • Master Index. An index of all items in the Help Browser.

There are three ways to find information in the Help Browser.

  • Browse. Click a radio button and then browse the hierarchy of topics.
  • Search the master index. Click the Master Index radio button, then start typing some text. Press <RETURN> or click an item to get an index listing. Follow the hyperlinks from the listing to get to information.
  • Search by keyword. Click a radio button, then type a keyword and click Go To.
    Radio button Keyword
    Built-in Functions function name
    (e.g., Integrate)
    Add-ons package name
    (e.g., Graphics `Legend`)
    The Mathematica Book section number
    (e.g., 3.2.1 or A.8)


  • You can magnify text in the Help Browser with the Format » Magnification submenu
  • You can evaluate examples directly in the Help Browser, and copy the results to save them.
  • If Mathematica beeps, you can find out why using the Why The Beep? item from the Help menu.

Getting Started

Running the Kernel from the Unix Shell

You can access the kernel directly without running the front end.

  1. Type MathKernel or math in a running shell.
  2. A small amount of startup information appears. The type of graphic support is also listed.
    % math
    Mathematica 6.0 for Linux x86 (32-bit)
    Copyright 1988-2007 Wolfram Research, Inc.


  3. All commands to the kernel must be typed after the In[1]:= prompt. After each evaluation, the number in the prompt changes.
    To evaluate input, press <RETURN>.
    % math
    Mathematica 6.0 for Linux
    x86 (32-bit)
    Copyright 1988-2007 Wolfram Research, Inc.

    In[1]:= Expand[(a+b)^5]

    Out[1]= a5 + 5 a4 b + 10 a3 b2 + 10 a2 b3 + 5 a b4 + b5


    Batch files

    When doing very large calculations, you may find it convenient to run Mathematica in batch mode. You can prepare a file called infile with many lines of Mathematica input, read it into Mathematica, and save the result to another file called outfile using the command:

    % math < infile > outfile

    It is sometimes useful to make the first line in the file AppendTo[$Echo, "stdout"] so that input lines will also be included in the output file.


    Graphics may be manipulated by the kernel separately from the front end. If you are running X and the startup information specifies that Motif or Athena graphics are initialized, you may also view graphics. Each graphic will appear in a separate window.

    To close a graphic window, choose Quit from the File menu in the graphic.

    % math
    Mathematica 6.0 for Linux
    x86 (32-bit)
    Copyright 1988-2007 Wolfram Research, Inc.  

    In[1]:= Expand[(a+b)^5]

    Out[1]= a5 + 5 a4 b + 10 a3 b2 + 10 a2 b3 + 5 a b4 + b5

    In[2]:=Plot[Sin[1/x^2] Exp[-x], {x, -2, 2}]

    Out[2]= -Graphics-
  4. To quit, type Quit and press <RETURN>.

Starting the Mathematica Front End

In a shell, type

% Mathematica


% mathematica

Initialization information should appear in the lower left corner the screen, andthen two windows should appear. The window with the menu is the Mathematica notebook. The other is a palette for entering special input. Type your Mathematica commands in the notebook window and then press <SHIFT> + <RETURN> (hold down the SHIFT key and press RETURN) to tell Mathematica to evaluate your input.

There are command-line arguments to the front end. To get a list of the front end command-line options type

% mathematica -help

Note: Your first calculation will take longer than subsequent calculations because the Mathematica kernel has to start up.

Running the Front End Remotely

In order to run the X front end on a remote machine and display to a local machine:

  1. Run the xhostcommand to give the remote machine privileges to display to the local machine.

    % xhost remotehost

  2. Add the Mathematica fonts, located in SystemFiles/Fonts in the main Mathematicadirectory, to the font path if they have not already been added. Load the X fonts first.

    % xset fp+ X
    % xset fp+ Type1
    % xset fp rehash

  3. Log in to the remote machine.
  4. Set the DISPLAY environment variable to the local machine and the appropriate monitor (i.e. for csh or tcsh).

    % setenv DISPLAY localhost:0

    If using the name and domain of the machine does not work, you may also use the IP address of the machine in place of localhost.
  5. Start the front end.

    % mathematica &

Using "mcc"

Note: The script mcc that preprocesses and compiles your MathLink source files has been renamed to math_mcc. It will preprocess MathLink templates in any file whose name ends with .tm, and then call cc on the resulting C source code. math_mcc will pass command-line options and other files directly to cc.

Some Mathematica Conventions

Built-in functions are capitalized. Arguments to functions are wrapped with square brackets.

Each of these represents multiplication:
a*b a b a(b+1)
2x means 2*x

These are standard arithmetic operations:
2+3 2-3 2/3 2^3

Upper-case and lower-case letters are recognized as different. Lists are wrapped with curly brackets.
{a, b, B}

Built-in symbols are capitalized. Commas are used to separate arguments. A semicolon prevents output, but the command is still evaluated.
N[Pi, 50];

Variables are usually in lower case letters. Entire words can be used.
x = 5
xvalue = 3

Integrate is one of Mathematica's several thousand built-in functions.

Plot3D produces a three-dimensional plot. Graphics appear directly in your notebook.

The Built-in Functions section of the Help Browser has lots of examples for most Mathematica functions.

Initialization Files and Resources

Front End Initialization

The file FrontEnd/init.m stores preferences for the front end. There are two paths searched to locate this file, both listed in Format » Options Inspector » Global Options. In order, they are:

  • ConfigurationPath. By default this is set to the Configuration/FrontEnd directory.
  • PreferencesPath. The Preferences Path is set to first look in ~/.Mathematica/[4.1/]FrontEnd. This is the folder where user-defined preferences are stored. The folders Configuration/FrontEnd and SystemFiles/FrontEnd are also listed.

Any init.m file on either path is read. If a setting is listed in more than one file, the last setting is used. This allows users with site licenses or with multiple copies of Mathematica to set up configuration information for all the copies of Mathematica in use at their site and yet still allow users to set up local preferences.

There are also caches stored in ~/.Mathematica/FrontEnd/7.0_Caches (or in ~/.Mathematica/4.1/FrontEnd/Caches for Mathematica version 4.1), which set up the locations and names of all system resources and text resources used by the front end. If the caches are missing, they will be rebuilt automatically.

If any folder in the AddOns/Autoload directory contains a file called FrontEnd/init.m, this file is loaded automatically.

Front End Resources

The standard X resources that control colors, fonts, sizes, and so on are supported by the X front end. For a list of such resources, see the X Window System User's Guide from O'Reilly & Associates.

The X front end also has the following specialized resources:

  • *applicationDepth. This sets the color depth for the front end.
  • *backgroundTaskDelay. Typically set to 200 milliseconds, this is the time the front end will wait for background events (such as typing) until doing tasks like PostScript rendering. When running the front end over a network, this number may need to be increased to a figure such as 300 or 400.
  • *cleanStart. If specified, this tells the front end to ignore caches stored in the user's home directory.
  • *mod1KeySym. Specify which key will represent Mod1.
  • *mod2KeySym. Specify which key will represent Mod2.
  • *preferencesDirectory. Specify the location where preferences are stored. By default this is set to ~/.Mathematica[/4.1].
  • *printCommand. Give the command that will send the file to the printer, such as lpr or lp. This command will appear in the Print dialog box.
  • *pureKeys. When set to TRUE, the front end prevents manufacturer keycodes from being modified by anything except the <SHIFT> key. For example, some systems may have <CTRL> + [6] map to the onequarter keysym, and this will not work with the X front end.
  • *singleLaunch. This resources takes values TRUE, FALSE, and QUERY. It allows only one copy of the front end to exist per DISPLAY setting if set to TRUE, and allows multiple front ends to run if set to FALSE. Setting this resource to QUERY will cause the front end to ask if you wish to have each file opened by a separate front end.
  • *standardColormap. This defines what colormap should be used.
  • *tileWidth. If lines appear in dithered graphics, try setting this to 8 or 16.
  • *usePrivateColormap. If set to TRUE, this will cause a private colormap to be established.
  • *useStandardColormaps. This gives control over colormaps. If this is set to TRUE, then the front end will use a standard colormap if available. If the *standardColormap resource is set, it will try to use that one first. Otherwise, for color visuals it searches for (in order): RGB_DEFAULT_MAP, RGB_BEST_MAP, RGB_GRAY_MAP. For grayscale visuals it searches for (in order): RGB_GRAY_MAP and RGB_DEFAULT_MAP.
  • *visualClass. This should be set to one of the following: PseudoColor, TrueColor, DirectColor, StaticColor, StaticGray, GrayScale.
  • *visualID. This allows the selection of a specific visualID on a Display connection.

Kernel Initialization

The file Kernel/init.m stores stores Mathematica commands which are read at startup. Two files are read:

  • Configuration/Kernel/init.m. Site-specific code should be placed here.
  • The first init.m file located on $Path. The first directory listed in $Path is ~/.Mathematica/[4.1/]Kernel, which allows each individual machine to have a local kernel initialization file.

If any folder in the AddOns/Autoload directory contains a file called Kernel/init.m, this file is loaded automatically.



There are three directories in ~/.Mathematica[/4.1] that store your preferences: FrontEnd, Kernel, and Licensing. The most convenient way to reset the front end to the default values is by using the command ./Mathematica -cleanStart. This will remove all the caches located in the FrontEnd directory and rebuild them automatically.

A corrupt preference file cache may cause the following problems: the front end may quit immediately on startup; the Help Browser may not open; or the list of menus may be different or corrupted. If any of these occur, you should reset the front end using the -cleanStart option.

If the front end initialization file becomes corrupted: the listing of files in the File » Notebooks submenu may be incorrect; the Find command may not work; the listing of palettes may be incorrect; or the front end may quit immediately on startup. If any of these things happen, move the init.m file in the FrontEnd directory to a different name, such as init.m.old. Restart the front end. This file will also be rebuilt automatically.


If the front end crashes, the kernel may be left running in the background. To stop the kernel:

  1. Find the process ID of the kernel:

    % ps -c

  2. Using that process ID, issue a killcommand.

    % kill pid

Keyboard Settings

If you are having trouble with the Mod1 or Mod2 key, go to Help » X Environment Information and click Find Keys and modifiers. You can find out which keys represent Mod1 and Mod2 as well as reset the key assignment.

Display Errors

If you see the error message XMathematica: can't open display, you need to make sure that you have the DISPLAY environment variable set correctly.

If you are running the front end remotely, you must give permission to the remote machine to display to your monitor. See Running the Front End Remotely for step-by-step instructions on how to run a front end remotely.

Font Path Errors

If you are running the front end remotely and you get error messages like Bad Font Path Element ... and your in/output at the Notebook does not display well, the Mathematica fonts may not be in the search path of the your X-server. Then add the Mathematica fonts to your X-Server font path by the command:

$ xset +fp tcp/

See also the ZID web page: Anpassungen des X-Arbeitsplatzes (PC, Workstation, X-Terminal).

Licensing Errors

If Mathematica opens the Password Dialog window at start up with the message "No valid Mathematica password entry found", please do the following before you contact your system administrators:

  1. Check if the license server (i.e. math-lizenz) is runnig:

    $ ping math-lizenz

    If the server is not responding contact its administrator.
  2. If the license server math-lizenz is responding try to start Mathematica at the dm or some other site at the ZID. If you get the same license message there, the mathlm license daemon at the math-lizenz may have died. Please, call Martin Pöll (phone: 2323) at the ZID and tell him to restart the daemon.

Mathematica Version 5.2

Until further notice Mathematica version 5.2 will still be accessible on all LinuX computers via the commands mathematica52, math52 and math_mcc52.