MathML - Example and Comparison To Other Formats

Example and Comparison To Other Formats

The well-known quadratic formula:

would be marked up using LaTeX syntax like this:

x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

in troff/eqn like this:

x={-b +- sqrt{b sup 2 – 4ac}} over 2a

in OpenOffice Math like this (all three are valid):

x={-b plusminus sqrt {b^2 – 4 ac}} over {2 a} x={-b ± sqrt {b^2 – 4ac}} over 2a x={-b +- sqrt {b^2 – 4ac}} over 2a

in ASCIIMathML like this:

x = (-b +- sqrt(b^2 – 4ac)) / (2a)

The above equation could be represented in Presentation MathML as an expression tree made up from layout elements like mfrac or msqrt elements:

x = − b ± b 2 − 4 ⁢ a ⁢ c 2 ⁢ a

In Content MathML, we cannot use ± (±) because it is a Presentation-only operator. To encode this statement in Content MathML, we must write both roots of the quadratic equation. This helps to illustrate the differences between Presentation and Content MathML.

x b b 2 4 a c 2 a b b 2 4 a c 2 a

The element can be used to embed a semantic annotation in non-XML format, for example to store the formula in the format used by an equation editor such as StarMath or the markup using LaTeX syntax. Alternatively, the equation could be represented in Content MathML as an expression tree for the functional structure elements like apply (for function application) or eq (for the equality relation) elements:

x ± b b 2 4 a c 0.5 2 a x=\frac{-b \pm \sqrt{b^2 - 4ac}}{2a} x={-b plusminus sqrt {b^2 - 4 ac}} over {2 a}

In the expression tree above, elements like times are defined by the MathML specification and stand for mathematical functions that are applied to sibling expressions that are interpreted as arguments. The csymbol element is a generic extension element that means whatever is specified in the document referred to in the definitionURL attribute.

Although less compact than TeX, the XML structuring promises to make it widely usable and allows for instant display in applications such as Web browsers and facilitates a straightforward interpretation of its meaning in mathematical software products. MathML is not intended to be written or edited directly by humans.

Read more about this topic:  MathML

Famous quotes containing the word comparison:

    Certainly there is not the fight recorded in Concord history, at least, if in the history of America, that will bear a moment’s comparison with this, whether for the numbers engaged in it, or for the patriotism and heroism displayed.
    Henry David Thoreau (1817–1862)