Extending techexplorer via Add-ins

Mathematica add-in


The feature described is only available in the Professional Edition of techexplorer.

IBM techexplorer version 3.0 provides an add-in for connecting techexplorer documents, JavaScript, and Java programs with the Mathematica software (version 4.1 or later) of Wolfram Research Inc. This add-in allows you to harness the computational abilities provided by Mathematica to enliven scientific and technical documents rendered by techexplorer in web browsers or, moreover, to harness any application that can integrate the techexplorer ActiveX control. In this section we provide an overview of how to use the Evaluation API to access the Mathematica add-in. In particular, we describe the different ways of sending and receiving Mathematica content, describe how to use JavaScript to access Mathematica and techexplorer, as well as provide an example that uses Java, JavaScript, and techexplorer to provide a web based command line interface to Mathematica. Users need access to a Mathematica kernel to run these examples.

Sending and Receiving Mathematica Content

The techexplorer Evaluation API can be accessed easily from LaTeX by using the \evalLink control sequence. The \evalLink control sequence uses a unique identifier to determine which add-in processes a particular piece of "live" content. The table below describes the MIME types supported by the Mathematica add-in.

Add-in MIME Type Description
application/x-mathlink-mat-tex Send Mathematica content and receive LaTeX response.
application/x-mathlink-mat-mathml Send Mathematica content and receive MathML response.
application/x-mathlink-mathml-mathml Send MathML content and receive MathML response.

In the example below, the application/x-mathlink-mat-tex MIME type indicates that the Mathematica add-in should send an expression encoded in Mathematica syntax to the Mathematica kernel to be evaluated. The LaTeX encoded result of the computation will be dynamically inserted into techexplorer for display.

The application/x-mathlink-mathml-mathml MIME type can be used to send an expression encoded in MathML that will result in MathML encoded content. The Mathematica add-in will dynamically insert the result into techexplorer.

Click to use \evalLink to connect to Mathematica.

Using JavaScript to Access Mathematica and techexplorer

JavaScript and Java applications can access techexplorer add-in functionality via the add-in conduit methods provided by the techexplorer Java object. As a result it is easy to write web based scientific and technical offerings that leverage a wide range of applications. In this section we provide a JavaScript based interface to Mathematica and techexplorer that uses only a few lines of JavaScript and HTML code. Users with access to a Mathematica Kernel will be able to input expressions in their web browser and see the results displayed on their screen!

<P>IBM techexplorer Hypermedia Browser not installed! Please visit the <A HREF="http://www.software.ibm.com/techexplorer/">techexplorer home page</A> for more information.
Mathematica command:

To send an expression to Mathematica using the above interface for evaluation:

  1. Start Mathematica.
  2. Type in a Mathematica Expression ( for example, Expand[(x+y)^4] ).
  3. Evaluate the expression.

A Web Based Command Line Interface to Mathematica

This example uses Java to create a techexplorer web based "front end" to the Mathematica Kernel. Type in a Mathematica expression into the techexplorer Input area and press the "Submit" button.
The result of the computation is appended to the document. Another input area and "Submit" button appears after that.

Click to use \evalLink to connect to Mathematica.




Click here to to view the previous section. Click here to to view the next section.

IBM techexplorer Hypermedia Browser is a trademark of the IBM Corporation.
Send comments and questions to techexpl@us.ibm.com.
Visit the official techexplorer home page at http://www.software.ibm.com/techexplorer/.