# webMathematica

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

web*Mathematica* is a Java-based application that provides interactive access to *Mathematica* computations over the Web. The underlying technology behind web*Mathematica* is called *Mathematica* Server Pages (MSP), which is an application of Java servlet technology. *Servlets* are Java programs that run on a Web server, either directly or through a separate plug-in program called a *servlet container*. The details of installing and configuring web*Mathematica* on a server can be somewhat complicated. However, once the initial installation is done, it is relatively easy to write Web pages that can interact with the server to produce live mathematical content.

The basic idea is that you can insert *Mathematica* commands into a standard HTML document in the form of special Mathlet tags. When a Web page enhanced in this way is submitted to a suitably configured Web server, each Mathlet tag is interpreted and its contents evaluated by a copy of *Mathematica* running on the server. The results of the evaluation are then inserted into the HTML document, replacing the original Mathlet tag. The new Web page is then returned back to the client and displayed in the browser.

web*Mathematica* thus provides a simple way to integrate *Mathematica* input and output into a standard Web page. The Web server can run multiple *Mathematica* sessions simultaneously and can manage multiple requests, queuing and assigning evaluations as a new session becomes available. Users can purchase a license for any desired number of sessions, depending on the level of demand expected on the Web site. The configuration is scalable, and you can easily modify it for high levels of usage by increasing the number of *Mathematica* sessions available.

HTML documents enhanced by the addition of Mathlet tags are called *MSP scripts*. They must have the file extension .msp. A typical Mathlet tag has the following structure:

<% Mathlet *expr* %>

Here, *expr* can be any command or sequence of commands that is valid as input to *Mathematica*. In addition to ordinary *Mathematica* commands, Mathlet tags can contain a small set of commands, with the prefix MSP, that are defined exclusively for use in MSP scripts. These handle various details of the interaction between the Web page and *Mathematica*. Let’s look at a few examples of MSP scripts to illustrate how such pages work.

- Integrating a function
- Plotting a function
- Matrix operations
- Converting expressions to MathML
- Using MathML as input

<< 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