WOLFRAM

Wolfram Archive

Wolfram Research Contributes Central Ideas to Web Math Standard

Published February 24, 1998

Mathematica’s Typesetting Technology Inspires MathML’s Framework

February 24, 1998–The web has gained new powers of technical communication, thanks to MathML, the recently promulgated standard for describing mathematical expressions. The MathML standard has been adopted by the World Wide Web Consortium, an international organization which defines the formats for storing and transmitting web information. And the key ideas forming the core of the MathML standard are derived directly from Wolfram Research’s typesetting technology.

Since this means there is a very close relationship between the web’s markup standard and Mathematica‘s internal representation, Mathematica is in a unique position to integrate full-featured MathML authoring and evaluation environment for documents with MathML expressions into the flexible, extensible technical document authoring system built into Mathematica 4.

Technical users of the web know that HTML, the markup language used to describe the layout and contents of a web page, has had until now a serious shortcoming: its inability to present mathematical expressions in an efficient manner. Anyone wanting to display an equation of even minimal complexity had to choose between two unsatisfactory workarounds: either an ASCII approximation of the equation, or a snapshot of the expression saved as a GIF or JPEG file. In either case, readers were unable to cut expressions from a web site and paste them into a technical computing system like Mathematica in the same way they can cut text from a web page and paste it into a word processor.

MathML changes that. It allows for a much more efficient use of bandwith because it carries only the kind of information needed for the web browser to redraw the equation properly. To work, though, MathML required a standard way of describing the layout of a mathematical expression. This is where Mathematica‘s contribution begins.

The layout of mathematical expressions, as drawn on the screen or printed on paper, is determined by a set of recursively nested rectangular areas called “boxes.” Drawing an expression properly involves building it up out of smaller pieces, which may themselves be built from pieces even smaller. These boxes can be thought of as stencils for fractions, superscripts, square roots and other radicals, and so on. As an example, we’ll demonstrate the box structure of Newton’s Law of Universal Gravitation, from the Philosophiae naturalis principia mathematica of 1687.

Here is the expression:

An Expression

And here is the nested box structure:

The Box Structure of an Expression

Literally hundreds of layout conventions and special mathematical characters have accumulated through the centuries, and changing the position of even a single element in an expression can drastically change its meaning. Mathematica, however, can represent these layout conventions using combinations of under two dozen basic box types. Mathematica represents the box structure of mathematical expressions using objects like RowBox, SuperscriptBox, and FractionBox. The box structure of Newton’s equation looks like this in Mathematica:

RowBox[{
OverscriptBox["F", "->"],
"=",
RowBox[{
RowBox[{"-", "G"}],
FractionBox[
RowBox[{"m", " ", "M"}],
SuperscriptBox["r", "2"]],
SubscriptBox[
OverscriptBox["e", "->"], "r"]}]}]

The indentation shows the nested structure of the representation. Compare that nested structure with the MathML code for the same expression, and you will see that, although the syntax is different, the basic structure (as shown by the indentation) is fundamentally the same:

<math> <mrow>   <mover>     <mi>F</mi>     <mo>-></mo>   </mover>   <mo>=</mo>   <mrow>     <mrow>       <mo>-</mo>       <mi>G</mi>     </mrow>     <mfrac>       <mrow>         <mi>m</mi>         <mo>*</mo>         <mi>M</mi>       </mrow>       <msup>         <mi>r</mi>         <mn>2</mn>       </msup>     </mfrac>     <msub>       <mover>         <mi>e</mi>         <mo>-></mo>       </mover>       <mi>r</mi>     </msub>   </mrow> </mrow> </math>  

The similarity in approach between Mathematica and MathML is no coincidence. Neil Soiffer and Bruce Smith of Wolfram Research were founding members of the drafting committee and creators of the original proposal upon which MathML was based. They brought to the committee Mathematica‘s simple and elegant vocabulary for the layout of mathematical expressions. With only minor modifications, that vocabulary forms the core of MathML’s capability to transmit how an expression looks.

Why did the drafting committee turn to Mathematica‘s box structure as a starting place? Wolfram Research had done many years of research into the representation, interpretation, and display of mathematical expressions as part of the development process of Mathematica 3. That effort gave us a thorough understanding of the difficult issues involved in fully integrating presentation and evaluation within a single environment.

“The MathML standard will play a central role in the technical communication of the future,” said Neil Soiffer. “We worked hard to insure that MathML is powerful enough so that technical text can not only be displayed, but used directly in computations.

“This is a win-win situation,” Soiffer said. “Mathematica users will be able to communicate their results to more people, and they will be able to use other people’s results more readily. I am really pleased to have been a part of this groundbreaking work.”