1.3.1 The Structure of Mathematica
The basic parts of the Mathematica system.
Mathematica is a modular software system in which the kernel which actually performs computations is separate from the front end which handles interaction with the user.
The most common type of front end for Mathematica is based on interactive documents known as notebooks. Notebooks mix Mathematica input and output with text, graphics, palettes and other material. You can use notebooks either for doing ongoing computations, or as means of presenting or publishing your results.
Common kinds of interfaces to Mathematica.
The notebook front end includes many menus and graphical tools for creating and reading notebook documents and for sending and receiving material from the Mathematica kernel.
A notebook mixing text, graphics and Mathematica input and output.
In some cases, you may not need to use the notebook front end, and you may want instead to interact more directly with the Mathematica kernel. You can do this by using a text-based interface, in which text you type on the keyboard goes straight to the kernel.
A dialog with Mathematica using a text-based interface.
In:= Integrate[1/(x^3 - 1), x]
1 + 2 x
Sqrt Log[-1 + x] Log[1 + x + x ]
Out= -(---------------) + ----------- - ---------------
Sqrt 3 6
An important aspect of Mathematica is that it can interact not only with human users but also with other programs. This is achieved primarily through MathLink, which is a standardized protocol for two-way communication between external programs and the Mathematica kernel.
A fragment of C code that communicates via MathLink with the Mathematica kernel.
MLPutFunction(stdlink, "EvaluatePacket", 1);
MLPutFunction(stdlink, "Gamma", 2);
MLCheckFunction(stdlink, "ReturnPacket", &n);
Among the many MathLink-compatible programs that are now available, some are set up to serve as complete front ends to Mathematica. Often such front ends provide their own special user interfaces, and treat the Mathematica kernel purely as an embedded computational engine. If you are using Mathematica in this way, then only some parts of the discussion in the remainder of this section will probably be relevant.