# The Mathematica interface

(Excerpt from "The MathML Handbook" by Pavi Sandhu)

*Mathematica* consists of two separate applications that work closely together: the front end, which provides the user interface for creating and editing documents, and the kernel, which acts as the computational engine. The kernel works behind the scenes, receiving input from the front end and returning the results of its calculations back to the front end for display. You can thus use *Mathematica* both for doing computations and for presenting the results in the form of publication-quality typeset documents. The advantage of combining document creation and computation in the same application is that the formulas and programs in the document are "live" and can be evaluated to get new results.

*Mathematica* is available for Windows, Macintosh (including a native Mac OS X version), and most Unix platforms. The latest release of *Mathematica*, Version 4.2, also offers excellent support for MathML 2.0, both presentation and content markup. You can directly copy and paste MathML equations both into and out of *Mathematica*. For example, you can create complicated equations in a notebook, and then copy them as MathML to insert into an HTML document that can be displayed on the Web. Conversely, you can copy MathML equations from a Web page, and then paste them into a *Mathematica* notebook and evaluate them. There are also several functions for translating MathML into *Mathematica* syntax and vice versa. Details of these features are given later in this chapter.

When you start *Mathematica*, a blank notebook appears on the screen along with some palettes for entering input. Each notebook consists of a series of cells, indicated by brackets on the right. Cells are a generalization of paragraphs and, in addition to text, can contain equations, graphics, or commands for evaluation. Each cell has a specific style (such as Text, Input, Output, Graphics, Section, or Subsection) that determines the default properties of its contents. You can create a cell of a specific style using the Format → Style menu.

To perform a calculation, you must type a *Mathematica* command into an input cell. By default, when you type into a new notebook, an input cell is automatically created. When you have finished entering the command, press Shift-Enter to evaluate it. The result of the evaluation is displayed in the notebook in an output cell, just below the input cell you evaluated (see the following figure). The front end automatically adds In and Out labels to the input and output cells, and numbers them in the order of evaluation.

*Figure: A Mathematica notebook that shows an input and output cell.*

*Mathematica* commands are entered in a special syntax that corresponds closely to the way an expression is normally spoken. All function names start with an uppercase letter, and function arguments are enclosed in square brackets. For example, here is the *Mathematica* command for evaluating the definite integral of sin(*x*) from 0 to π:

In[1]:= **Integrate[Sin[x], {x, 0, Pi}]**

Out[1]= 2

The terms Integrate and Sin are *Mathematica* functions. There are over two thousand built-in functions for performing a wide variety of calculations in fields such as algebra, calculus, statistics, number theory, and graphics.

**Note:**

All examples of *Mathematica* commands are shown in a bold font to simulate how these commands look in a *Mathematica* notebook.

<< back | next >> |

**Copyright © CHARLES RIVER MEDIA, INC., Massachusetts (USA) 2003**

Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "The MathML Handbook" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.

CHARLES RIVER MEDIA, INC., 20 Downer Avenue, Suite 3, Hingham, Massachusetts 02043, United States of America