4 Content Markup

Overview: Mathematical Markup Language (MathML) Version 2.0 (2nd Edition)
Previous: 3 Presentation Markup
Next: 5 Combining Presentation and Content Markup

4 Content Markup
    4.1 Introduction
        4.1.1 The Intent of Content Markup
        4.1.2 The Scope of Content Markup
        4.1.3 Basic Concepts of Content Markup
    4.2 Content Element Usage Guide
        4.2.1 Overview of Syntax and Usage
            4.2.1.1 Constructing Mathematical Objects
            4.2.1.2 Constructing General Expressions
            4.2.1.3 The apply construct
            4.2.1.4 Explicitly defined functions and operators
            4.2.1.5 The inverse construct
            4.2.1.6 The declare construct
            4.2.1.7 The lambda construct
            4.2.1.8 The use of qualifier elements and the condition construct
            4.2.1.9 Rendering of Content elements
        4.2.2 Containers
            4.2.2.1 Tokens
            4.2.2.2 Constructors
            4.2.2.3 Special Constructs
        4.2.3 Functions, Operators and Qualifiers
            4.2.3.1 Predefined functions and operators
            4.2.3.2 Operators taking Qualifiers
        4.2.4 Relations
        4.2.5 Conditions
            4.2.5.1 Examples
        4.2.6 Syntax and Semantics
        4.2.7 Semantic Mappings
        4.2.8 Constants and Symbols
        4.2.9 MathML element types
    4.3 Content Element Attributes
        4.3.1 Content Element Attribute Values
        4.3.2 Attributes Modifying Content Markup Semantics
            4.3.2.1 base
            4.3.2.2 closure
            4.3.2.3 definitionURL
            4.3.2.4 encoding
            4.3.2.5 nargs
            4.3.2.6 occurrence
            4.3.2.7 order
            4.3.2.8 scope
            4.3.2.9 type
        4.3.3 Attributes Modifying Content Markup Rendering
            4.3.3.1 type
            4.3.3.2 General Attributes
    4.4 The Content Markup Elements
        4.4.1 Token Elements
            4.4.1.1 Number (cn)
            4.4.1.2 Identifier (ci)
            4.4.1.3 Externally defined symbol (csymbol)
        4.4.2 Basic Content Elements
            4.4.2.1 Apply (apply)
            4.4.2.2 Relation (reln)
            4.4.2.3 Function (fn)
            4.4.2.4 Interval (interval)
            4.4.2.5 Inverse (inverse)
            4.4.2.6 Separator (sep)
            4.4.2.7 Condition (condition)
            4.4.2.8 Declare (declare)
            4.4.2.9 Lambda (lambda)
            4.4.2.10 Function composition (compose)
            4.4.2.11 Identity function (ident)
            4.4.2.12 Domain (domain)
            4.4.2.13 codomain (codomain)
            4.4.2.14 Image (image)
            4.4.2.15 Domain of Application (domainofapplication)
            4.4.2.16 Piecewise declaration (piecewise, piece, otherwise)
        4.4.3 Arithmetic, Algebra and Logic
            4.4.3.1 Quotient (quotient)
            4.4.3.2 Factorial (factorial)
            4.4.3.3 Division (divide)
            4.4.3.4 Maximum and minimum (max, min)
            4.4.3.5 Subtraction (minus)
            4.4.3.6 Addition (plus)
            4.4.3.7 Exponentiation (power)
            4.4.3.8 Remainder (rem)
            4.4.3.9 Multiplication (times)
            4.4.3.10 Root (root)
            4.4.3.11 Greatest common divisor (gcd)
            4.4.3.12 And (and)
            4.4.3.13 Or (or)
            4.4.3.14 Exclusive Or (xor)
            4.4.3.15 Not (not)
            4.4.3.16 Implies (implies)
            4.4.3.17 Universal quantifier (forall)
            4.4.3.18 Existential quantifier (exists)
            4.4.3.19 Absolute Value (abs)
            4.4.3.20 Complex conjugate (conjugate)
            4.4.3.21 Argument (arg)
            4.4.3.22 Real part (real)
            4.4.3.23 Imaginary part (imaginary)
            4.4.3.24 Lowest common multiple (lcm)
            4.4.3.25 Floor (floor)
            4.4.3.26 Ceiling (ceiling)
        4.4.4 Relations
            4.4.4.1 Equals (eq)
            4.4.4.2 Not Equals (neq)
            4.4.4.3 Greater than (gt)
            4.4.4.4 Less Than (lt)
            4.4.4.5 Greater Than or Equal (geq)
            4.4.4.6 Less Than or Equal (leq)
            4.4.4.7 Equivalent (equivalent)
            4.4.4.8 Approximately (approx)
            4.4.4.9 Factor Of (factorof)
        4.4.5 Calculus and Vector Calculus
            4.4.5.1 Integral (int)
            4.4.5.2 Differentiation (diff)
            4.4.5.3 Partial Differentiation (partialdiff)
            4.4.5.4 Lower limit (lowlimit)
            4.4.5.5 Upper limit (uplimit)
            4.4.5.6 Bound variable (bvar)
            4.4.5.7 Degree (degree)
            4.4.5.8 Divergence (divergence)
            4.4.5.9 Gradient (grad)
            4.4.5.10 Curl (curl)
            4.4.5.11 Laplacian (laplacian)
        4.4.6 Theory of Sets
            4.4.6.1 Set (set)
            4.4.6.2 List (list)
            4.4.6.3 Union (union)
            4.4.6.4 Intersect (intersect)
            4.4.6.5 Set inclusion (in)
            4.4.6.6 Set exclusion (notin)
            4.4.6.7 Subset (subset)
            4.4.6.8 Proper Subset (prsubset)
            4.4.6.9 Not Subset (notsubset)
            4.4.6.10 Not Proper Subset (notprsubset)
            4.4.6.11 Set Difference (setdiff)
            4.4.6.12 Cardinality (card)
            4.4.6.13 Cartesian product (cartesianproduct)
        4.4.7 Sequences and Series
            4.4.7.1 Sum (sum)
            4.4.7.2 Product (product)
            4.4.7.3 Limit (limit)
            4.4.7.4 Tends To (tendsto)
        4.4.8 Elementary classical functions
            4.4.8.1 common trigonometric functions
            4.4.8.2 Exponential (exp)
            4.4.8.3 Natural Logarithm (ln)
            4.4.8.4 Logarithm (log)
        4.4.9 Statistics
            4.4.9.1 Mean (mean)
            4.4.9.2 Standard Deviation (sdev)
            4.4.9.3 Variance (variance)
            4.4.9.4 Median (median)
            4.4.9.5 Mode (mode)
            4.4.9.6 Moment (moment)
            4.4.9.7 Point of Moment (momentabout)
        4.4.10 Linear Algebra
            4.4.10.1 Vector (vector)
            4.4.10.2 Matrix (matrix)
            4.4.10.3 Matrix row (matrixrow)
            4.4.10.4 Determinant (determinant)
            4.4.10.5 Transpose (transpose)
            4.4.10.6 Selector (selector)
            4.4.10.7 Vector product (vectorproduct)
            4.4.10.8 Scalar product (scalarproduct)
            4.4.10.9 Outer product (outerproduct)
        4.4.11 Semantic Mapping Elements
            4.4.11.1 Annotation (annotation)
            4.4.11.2 Semantics (semantics)
            4.4.11.3 XML-based annotation (annotation-xml)
        4.4.12 Constant and Symbol Elements
            4.4.12.1 integers (integers)
            4.4.12.2 reals (reals)
            4.4.12.3 Rational Numbers (rationals)
            4.4.12.4 Natural Numbers (naturalnumbers)
            4.4.12.5 complexes (complexes)
            4.4.12.6 primes (primes)
            4.4.12.7 Exponential e (exponentiale)
            4.4.12.8 Imaginary i (imaginaryi)
            4.4.12.9 Not A Number (notanumber)
            4.4.12.10 True (true)
            4.4.12.11 False (false)
            4.4.12.12 Empty Set (emptyset)
            4.4.12.13 pi (pi)
            4.4.12.14 Euler gamma (eulergamma)
            4.4.12.15 infinity (infinity)

4.1 Introduction

4.1.1 The Intent of Content Markup

As has been noted in the introductory section of this Recommendation, mathematics can be distinguished by its use of a (relatively) formal language, mathematical notation. However, mathematics and its presentation should not be viewed as one and the same thing. Mathematical sums or products exist and are meaningful to many applications completely without regard to how they are rendered aurally or visually. The intent of the content markup in the Mathematical Markup Language is to provide an explicit encoding of the underlying mathematical structure of an expression, rather than any particular rendering for the expression.

There are many reasons for providing a specific encoding for content. Even a disciplined and systematic use of presentation tags cannot properly capture this semantic information. This is because without additional information it is impossible to decide whether a particular presentation was chosen deliberately to encode the mathematical structure or simply to achieve a particular visual or aural effect. Furthermore, an author using the same encoding to deal with both the presentation and mathematical structure might find a particular presentation encoding unavailable simply because convention had reserved it for a different semantic meaning.

The difficulties stem from the fact that there are many to one mappings from presentation to semantics and vice versa. For example the mathematical construct " H multiplied by e" is often encoded using an explicit operator as in H ×  e. In different presentational contexts, the multiplication operator might be invisible " H  e", or rendered as the spoken word "times". Generally, many different presentations are possible depending on the context and style preferences of the author or reader. Thus, given " H  e" out of context it may be impossible to decide if this is the name of a chemical or a mathematical product of two variables H and e.

Mathematical presentation also changes with culture and time: some expressions in combinatorial mathematics today have one meaning to a Russian mathematician, and quite another to a French mathematician; see Section 5.4.1 Notational Style Sheets for an example. Notations may lose currency, for example the use of musical sharp and flat symbols to denote maxima and minima [Chaundy1954]. A notation in use in 1644 for the multiplication mentioned above was \blacksquare H e [Cajori1928].

When we encode the underlying mathematical structure explicitly, without regard to how it is presented aurally or visually, we are able to interchange information more precisely with those systems that are able to manipulate the mathematics. In the trivial example above, such a system could substitute values for the variables H and e and evaluate the result. Further interesting application areas include interactive textbooks and other teaching aids.

4.1.2 The Scope of Content Markup

The semantics of general mathematical notation is not a matter of consensus. It would be an enormous job to systematically codify most of mathematics - a task that can never be complete. Instead, MathML makes explicit a relatively small number of commonplace mathematical constructs, chosen carefully to be sufficient in a large number of applications. In addition, it provides a mechanism for associating semantics with new notational constructs. In this way, mathematical concepts that are not in the base collection of elements can still be encoded (Section 4.2.6 Syntax and Semantics).

The base set of content elements is chosen to be adequate for simple coding of most of the formulas used from kindergarten to the end of high school in the United States, and probably beyond through the first two years of college, that is up to A-Level or Baccalaureate level in Europe. Subject areas covered to some extent in MathML are:

  • arithmetic, algebra, logic and relations

  • calculus and vector calculus

  • set theory

  • sequences and series

  • elementary classical functions

  • statistics

  • linear algebra

It is not claimed, or even suggested, that the proposed set of elements is complete for these areas, but the provision for author extensibility greatly alleviates any problem omissions from this finite list might cause.

4.1.3 Basic Concepts of Content Markup

The design of the MathML content elements are driven by the following principles:

  • The expression tree structure of a mathematical expression should be directly encoded by the MathML content elements.

  • The encoding of an expression tree should be explicit, and not dependent on the special parsing of PCDATA or on additional processing such as operator precedence parsing.

  • The basic set of mathematical content constructs that are provided should have default mathematical semantics.

  • There should be a mechanism for associating specific mathematical semantics with the constructs.

The primary goal of the content encoding is to establish explicit connections between mathematical structures and their mathematical meanings. The content elements correspond directly to parts of the underlying mathematical expression tree. Each structure has an associated default semantics and there is a mechanism for associating new mathematical definitions with new constructs.

Significant advantages to the introduction of content-specific tags include:

  • Usage of presentation elements is less constrained. When mathematical semantics are inferred from presentation markup, processing agents must either be quite sophisticated, or they run the risk of inferring incomplete or incorrect semantics when irregular constructions are used to achieve a particular aural or visual effect.

  • It is immediately clear which kind of information is being encoded simply by the kind of elements that are used.

  • Combinations of semantic and presentation elements can be used to convey both the appearance and its mathematical meaning much more effectively than simply trying to infer one from the other.

Expressions described in terms of content elements must still be rendered. For common expressions, default visual presentations are usually clear. "Take care of the sense and the sounds will take care of themselves" wrote Lewis Carroll [Carroll1871]. Default presentations are included in the detailed description of each element occurring in Section 4.4 The Content Markup Elements.

To accomplish these goals, the MathML content encoding is based on the concept of an expression tree. A content expression tree is constructed from a collection of more primitive objects, referred to herein as containers and operators. MathML possesses a rich set of predefined container and operator objects, as well as constructs for combining containers and operators in mathematically meaningful ways. The syntax and usage of these content elements and constructions is described in the next section.

4.2 Content Element Usage Guide

Since the intent of MathML content markup is to encode mathematical expressions in such a way that the mathematical structure of the expression is clear, the syntax and usage of content markup must be consistent enough to facilitate automated semantic interpretation. There must be no doubt when, for example, an actual sum, product or function application is intended and if specific numbers are present, there must be enough information present to reconstruct the correct number for purposes of computation. Of course, it is still up to a MathML-compliant processor to decide what is to be done with such a content-based expression, and computation is only one of many options. A renderer or a structured editor might simply use the data and its own built-in knowledge of mathematical structure to render the object. Alternatively, it might manipulate the object to build a new mathematical object. A more computationally oriented system might attempt to carry out the indicated operation or function evaluation.

The purpose of this section is to describe the intended, consistent usage. The requirements involve more than just satisfying the syntactic structure specified by an XML DTD. Failure to conform to the usage as described below will result in a MathML error, even though the expression may be syntactically valid according to the DTD.

In addition to the usage information contained in this section, Section 4.4 The Content Markup Elements gives a complete listing of each content element, providing reference information about their attributes, syntax, examples and suggested default semantics and renderings. The rules for using presentation markup within content markup are explained in Section 5.2.3 Presentation Markup Contained in Content Markup. An informal EBNF grammar describing the syntax for the content markup is given in Appendix B Content Markup Validation Grammar.

4.2.1 Overview of Syntax and Usage

MathML content encoding is based on the concept of an expression tree. As a general rule, the terminal nodes in the tree represent basic mathematical objects, such as numbers, variables, arithmetic operations and so on. The internal nodes in the tree generally represent some kind of function application or other mathematical construction that builds up a compound object. Function application provides the most important example; an internal node might represent the application of a function to several arguments, which are themselves represented by the terminal nodes underneath the internal node.

The MathML content elements can be grouped into the following categories based on their usage:

  • containers

  • operators and functions

  • qualifiers

  • relations

  • conditions

  • semantic mappings

  • constants and symbols

These are the building blocks out of which MathML content expressions are constructed. Each category is discussed in a separate section below. In the remainder of this section, we will briefly introduce some of the most common elements of each type, and consider the general constructions for combining them in mathematically meaningful ways.

4.2.1.1 Constructing Mathematical Objects

Content expression trees are built up from basic mathematical objects. At the lowest level, leaf nodes are encapsulated in non-empty elements that define their type. Numbers and symbols are marked by the token elements cn and ci. More elaborate constructs such as sets, vectors and matrices are also marked using elements to denote their types, but rather than containing data directly, these container elements are constructed out of other elements. Elements are used in order to clearly identify the underlying objects. In this way, standard XML parsing can be used and attributes can be used to specify global properties of the objects.

The containers such as <cn>12345</cn> , <ci>x</ci> and <csymbol definitionURL="mySymbol.htm" encoding="text">S</csymbol>represent mathematical numbers , identifiers and externally defined symbols. Below, we will look at operator elements such as plus or sin, which provide access to the basic mathematical operations and functions applicable to those objects. Additional containers such as set for sets, and matrix for matrices are provided for representing a variety of common compound objects.

For example, the number 12345 is encoded as

<cn>12345</cn>

The attributes and PCDATA content together provide the data necessary for an application to parse the number. For example, a default base of 10 is assumed, but to communicate that the underlying data was actually written in base 8, simply set the base attribute to 8 as in

<cn base="8">12345</cn>

while the complex number 3 + 4i can be encoded as

<cn type="complex-cartesian">3<sep/>4</cn>

Such information makes it possible for another application to easily parse this into the correct number.

As another example, the scalar symbol v is encoded as

<ci>v</ci>

By default, ci elements represent elements from a commutative field (see Appendix C Content Element Definitions). If a vector is intended then this fact can be encoded as

<ci type="vector">v</ci>

This invokes default semantics associated with the vector element, namely an arbitrary element of a finite-dimensional vector space.

By using the ci and csymbol elements we have made clear that we are referring to a mathematical identifier or symbol but this does not say anything about how it should be rendered. By default a symbol is rendered as if the ci or csymbol element were actually the presentation element mi (see Section 3.2.3 Identifier (mi)). The actual rendering of a mathematical symbol can be made as elaborate as necessary simply by using the more elaborate presentational constructs (as described in Chapter 3 Presentation Markup) in the body of the ci or csymbol element.

The default rendering of a simple cn-tagged object is the same as for the presentation element mn with some provision for overriding the presentation of the PCDATA by providing explicit mn tags. This is described in detail in Section 4.4 The Content Markup Elements.

The issues for compound objects such as sets, vectors and matrices are all similar to those outlined above for numbers and symbols. Each such object has global properties as a mathematical object that impact how it is to be parsed. This may affect everything from the interpretation of operations that are applied to it to how to render the symbols representing it. These mathematical properties are captured by setting attribute values or by associating the properties with the object through the use of the semantics element.

4.2.1.2 Constructing General Expressions

The notion of constructing a general expression tree is essentially that of applying an operator to sub-objects. For example, the sum a + b can be thought of as an application of the addition operator to two arguments a and b. In MathML, elements are used for operators for much the same reason that elements are used to contain objects. They are recognized at the level of XML parsing, and their attributes can be used to record or modify the intended semantics. For example, with the MathML plus element, setting the definitionURL and encoding attributes as in

<plus definitionURL="www.example.com/VectorCalculus.htm"
      encoding="text"/>

can communicate that the intended operation is vector-based.

There is also another reason for using elements to denote operators. There is a crucial semantic distinction between the function itself and the expression resulting from applying that function to zero or more arguments which must be captured. This is addressed by making the functions self-contained objects with their own properties and providing an explicit apply construct corresponding to function application. We will consider the apply construct in the next section.

MathML contains many pre-defined operator elements, covering a range of mathematical subjects. However, an important class of expressions involve unknown or user-defined functions and symbols. For these situations, MathML provides a general csymbol element, which is discussed below.

4.2.1.3 The apply construct

The most fundamental way of building up a mathematical expression in MathML content markup is the apply construct. An apply element typically applies an operator to its arguments. It corresponds to a complete mathematical expression. Roughly speaking, this means a piece of mathematics that could be surrounded by parentheses or "logical brackets" without changing its meaning.

For example, (x + y) might be encoded as

<apply>
  <plus/>
  <ci> x </ci>
  <ci> y </ci>
</apply>

The opening and closing tags of apply specify exactly the scope of any operator or function. The most typical way of using apply is simple and recursive. Symbolically, the content model can be described as:

<apply> 
op 
a 
b </apply>

where the operands a and b are containers or other content-based elements themselves, and op is an operator or function. Note that since apply is a container, this allows apply constructs to be nested to arbitrary depth.

An apply may in principle have any number of operands:

<apply> op a b [c...] <apply>

For example, (x + y + z) can be encoded as

<apply>
  <plus/>
  <ci> x </ci>
  <ci> y </ci>
  <ci> z </ci>
</apply>

Mathematical expressions involving a mixture of operations result in nested occurrences of apply. For example, a x + b would be encoded as

<apply>
  <plus/>
  <apply>
    <times/>
    <ci> a </ci>
    <ci> x </ci>
  </apply>
  <ci> b </ci>
</apply>

There is no need to introduce parentheses or to resort to operator precedence in order to parse the expression correctly. The apply tags provide the proper grouping for the re-use of the expressions within other constructs. Any expression enclosed by an apply element is viewed as a single coherent object.

An expression such as (F + G)(x) might be a product, as in

<apply>
  <times/>
  <apply>
    <plus/>
    <ci> F </ci>
    <ci> G </ci>
  </apply>
  <ci> x </ci>
</apply>

or it might indicate the application of the function F + G to the argument x. This is indicated by constructing the sum

<apply>
  <plus/>
  <ci> F </ci>
  <ci> G </ci>
</apply>

and applying it to the argument x as in

<apply>
  <apply>
    <plus/>
    <ci> F </ci>
    <ci> G </ci>
    </apply>
  <ci> x </ci>
</apply>

Both the function and the arguments may be simple identifiers or more complicated expressions.

In MathML 1.0 , another construction closely related to the use of the apply element with operators and arguments was the reln element. The reln element was used to denote that a mathematical relation holds between its arguments, as opposed to applying an operator. Thus, the MathML markup for the expression x < y was given in MathML 1.0 by:

<reln>
  <lt/>
  <ci> x </ci>
  <ci> y </ci>
</reln>

In MathML 2.0, the apply construct is used with all operators, including logical operators. The expression above becomes

<apply>
  <lt/>
  <ci> x </ci>
  <ci> y </ci>
</apply>

in MathML 2.0. The use of reln with relational operators is supported for reasons of backwards compatibility, but deprecated. Authors creating new content are encouraged to use apply in all cases.

4.2.1.4 Explicitly defined functions and operators

The most common operations and functions such as plus and sin have been predefined explicitly as empty elements (see Section 4.4 The Content Markup Elements). The definitionURL attribute can be used by the author to record that a different sort of algebraic operation is intended. This allows essentially the same notation to be re-used for a discussion taking place in a different algebraic domain.

Due to the nature of mathematics the notation must be extensible. The key to extensibility is the ability of the user to define new functions and other symbols to expand the terrain of mathematical discourse.

It is always possible to create arbitrary expressions, and then to use them as symbols in the language. Their properties can then be inferred directly from that usage as was done in the previous section. However, such an approach would preclude being able to encode the fact that the construct was a known symbol, or to record its mathematical properties except by actually using it. The csymbol element is used as a container to construct a new symbol in much the same way that ci is used to construct an identifier. (Note that "symbol" is used here in the abstract sense and has no connection with any presentation of the construct on screen or paper). The difference in usage is that csymbol should refer to some mathematically defined concept with an external definition referenced via the definitionURL attribute, whereas ci is used for identifiers that are essentially "local" to the MathML expression . The target of the definitionURL attribute on the csymbol element may encode the definition in any format; the particular encoding in use is given by the encoding attribute. In contrast, the definitionURL attribute on a ci element, might be used to associate an identifier with another sub-expression by referring to its id attribute. This approach can be used, for example to indicate clearly that a particular ci element is an instance of a ci element that has been declared to have some properties using the declare construct (see Section 4.4.2.8 Declare (declare)) or that it is an instance of a specific bound variable as declared by a use of the bvar (see Section 4.4.5.6 Bound variable (bvar)) element.

To use csymbol to describe a completely new function, we write for example

<csymbol definitionURL="www.example.com/VectorCalculus.htm"
         encoding="text">
  Christoffel
</csymbol>

The definitionURL attribute specifies a URI that provides a written definition for the Christoffel symbol. Suggested default definitions for the content elements of MathML appear in Appendix C Content Element Definitions in a format based on OpenMath, although there is no requirement that a particular format be used. The role of the definitionURL attribute is very similar to the role of definitions included at the beginning of many mathematical papers, and which often just refer to a definition used by a particular book.

MathML 1.0 supported the use of the fn to encode the fact that a construct is explicitly being used as a function or operator. To record the fact that F+ G is being used semantically as if it were a function, it was encoded as:

<fn>
  <apply>
    <plus/>
    <ci>F</ci>
    <ci>G</ci>
  </apply>
</fn>

This usage, although allowed in MathML 2.0 for reasons of backwards compatibility, is now deprecated. The fact that a construct is being used as an operator is clear from the position of the construct as the first child of the apply. If it is required to add additional information to the construct, it should be wrapped in a semantics element, for example:

<semantics definitionURL="www.example.com/vectorfuncs/plus.htm"
           encoding="Mathematica">
  <apply>
    <plus/>
    <ci>F</ci>
    <ci>G</ci>
  </apply>
</semantics>

MathML 1.0 supported the use of definitionURL with fn to refer to external definitions for user-defined functions. This usage, although allowed for reasons of backwards compatibility, is deprecated in MathML 2.0 in favor of using csymbol to define the function, and then apply to link the function to its arguments. For example:

  <apply>
    <csymbol definitionURL="http://www.example.org/function_spaces.html#my_def"
             encoding="text">
      BigK
    </csymbol>
    <ci>x</ci>
    <ci>y</ci>
  </apply>

4.2.1.5 The inverse construct

Given functions, it is natural to have functional inverses. This is handled by the inverse element.

Functional inverses can be problematic from a mathematical point of view in that they implicitly involve the definition of an inverse for an arbitrary function F. Even at the K-through-12 level the concept of an inverse F -1 of many common functions F is not used in a uniform way. For example, the definitions used for the inverse trigonometric functions may differ slightly depending on the choice of domain and/or branch cuts.

MathML adopts the view: if F is a function from a domain D to D', then the inverse G of F is a function over D' such that G(F(x)) = x for x in D. This definition does not assert that such an inverse exists for all or indeed any x in D, or that it is single-valued anywhere. Also, depending on the functions involved, additional properties such as F(G(y)) = y for y in D' may hold.

The inverse element is applied to a function whenever an inverse is required. For example, application of the inverse sine function to x, i.e. sin-1 (x), is encoded as:

<apply>
  <apply> <inverse/> <sin/> </apply>
  <ci> x </ci>
</apply>

While arcsin is one of the predefined MathML functions, an explicit reference to sin-1(x) might occur in a document discussing possible definitions of arcsin.

4.2.1.6 The declare construct

Consider a document discussing the vectors A = (a, b, c) and B = (d, e, f), and later including the expression V = A + B. It is important to be able to communicate the fact that wherever A and B are used they represent a particular vector. The properties of that vector may determine aspects of operators such as plus.

The simple fact that A is a vector can be communicated by using the markup

<ci type="vector">A</ci>

but this still does not communicate, for example, which vector is involved or its dimensions.

The declare construct is used to associate specific properties or meanings with an object. The actual declaration itself is not rendered visually (or in any other form). However, it indirectly impacts the semantics of all affected uses of the declared object.

Declarations must occur at the beginning of a math element. The scope of a declaration is the entire math element in which the declaration is made. The scope attribute of a declare may be included but has no effect since the two possible values of "local" or "global" now have the same meaning. The "global" attribute value is still allowed for backwards compatibility with MathML 1.0., but is deprecated in MathML 2.0.

The uses of the declare element range from resetting default attribute values to associating an expression with a particular instance of a more elaborate structure. Subsequent uses of the original expression (within the scope of the declare) play the same semantic role as would the paired object.

For example, the declaration

<declare>
  <ci> A </ci>
  <vector>
    <ci> a </ci>
    <ci> b </ci>
    <ci> c </ci>
  </vector>
</declare>

specifies that A stands for the particular vector (a, b, c) so that subsequent uses of A as in V = A + B can take this into account. When declare is used in this way, the actual encoding

<apply>
  <eq/>
  <ci> V </ci>
  <apply>
    <plus/>
    <ci> A </ci>
    <ci> B </ci>
  </apply>
</apply>

remains unchanged but the expression can be interpreted properly as vector addition.

There is no requirement to declare an expression to stand for a specific object. For example, the declaration

<declare type="vector">
  <ci> A </ci>
</declare>

specifies that A is a vector without indicating the number of components or the values of specific components. Any attribute which is valid for the target element can be assigned in this way, with the possible values being the same as would ordinarily be assigned to such an object.

4.2.1.7 The lambda construct

The lambda calculus allows a user to construct a function from a variable and an expression. For example, the lambda construct underlies the common mathematical idiom illustrated here:

Let f be the function taking x to x2 + 2

There are various notations for this concept in mathematical literature, such as \lambda(x, F(x)) = F or \lambda(x, [F]) =F, where x is a free variable in F.

This concept is implemented in MathML with the lambda element. A lambda construct with n internal variables is encoded by a lambda element with n+1 children. All but the last child must be bvar elements containing the identifiers of the internal variables. The last child is an expression defining the function. This is typically an apply, but can also be any container element.

The following constructs \lambda (x, sin(x+1)):

<lambda>
  <bvar><ci> x </ci></bvar>
  <apply>
    <sin/>
    <apply>
      <plus/>
      <ci> x </ci>
      <cn> 1 </cn>
    </apply>
  </apply>
</lambda>

To use declare and lambda to construct the function f for which f( x) = x2 + x + 3 use:

<declare type="fn">
  <ci> f </ci>
  <lambda>
    <bvar><ci> x </ci></bvar>
    <apply>
      <plus/>
      <apply>
        <power/>
        <ci> x </ci>
        <cn> 2 </cn>
      </apply>
      <ci> x </ci>
      <cn> 3 </cn>
    </apply>
  </lambda>
</declare>

The following markup declares and constructs the function J such that J(x, y) is the integral from x to y of t4 with respect to t.

<declare type="fn">
  <ci> J </ci>
  <lambda>
    <bvar><ci> x </ci></bvar>
    <bvar><ci> y </ci></bvar>
    <apply> <int/>
      <bvar>
        <ci> t </ci>
      </bvar>
      <lowlimit>
        <ci> x </ci>
      </lowlimit>
      <uplimit>
        <ci> y </ci>
      </uplimit>
      <apply>   <power/>
        <ci>t</ci>
        <cn>4</cn>
      </apply>
    </apply>
  </lambda>
</declare>

The function J can then in turn be applied to an argument pair.

4.2.1.8 The use of qualifier elements and the condition construct

The last example of the preceding section illustrates the use of qualifier elements lowlimit, uplimit, and bvar used in conjunction with the int element. A number of common mathematical constructions involve additional data that is either implicit in conventional notation, such as a bound variable, or thought of as part of the operator rather than an argument, as is the case with the limits of a definite integral.

Content markup uses qualifier elements in conjunction with a number of operators, including integrals, sums, series, and certain differential operators. Qualifier elements appear in the same apply element with one of these operators. In general, they must appear in a certain order, and their precise meaning depends on the operators being used. For details, see Section 4.2.3.2 Operators taking Qualifiers.

The qualifier element bvar is also used in another important MathML construction. The condition element is used to place conditions on bound variables in other expressions. This allows MathML to define sets by rule, rather than enumeration, for example. The following markup, for instance, encodes the set {x | x < 1}:

<set>
  <bvar><ci> x </ci></bvar>
  <condition>
    <apply>
      <lt/>
      <ci> x </ci>
      <cn> 1 </cn>
    </apply>
  </condition>
</set>

4.2.1.9 Rendering of Content elements

While the primary role of the MathML content element set is to directly encode the mathematical structure of expressions independent of the notation used to present the objects, rendering issues cannot be ignored. Each content element has a default rendering, given in Section 4.4 The Content Markup Elements, and several mechanisms (including Section 4.3.3.2 General Attributes) are provided for associating a particular rendering with an object.

4.2.2 Containers

Containers provide a means for the construction of mathematical objects of a given type.

Tokens ci, cn, csymbol
Constructors interval, list, matrix, matrixrow, set, vector, apply, reln, fn, lambda, piecewise, piece, otherwise
Specials declare

4.2.2.1 Tokens

Token elements are typically the leaves of the MathML expression tree. Token elements are used to indicate mathematical identifiers, numbers and symbols.

It is also possible for the canonically empty operator elements such as exp, sin and cos to be leaves in an expression tree. The usage of operator elements is described in Section 4.2.3 Functions, Operators and Qualifiers.

cn

The cn element is the MathML token element used to represent numbers. The supported types of numbers include: "real", "integer", "rational", "complex-cartesian", and "complex-polar", with "real" being the default type. An attribute base (with default value "10") is used to help specify how the content is to be parsed. The content itself is essentially PCDATA, separated by <sep/> when two parts are needed in order to fully describe a number. For example, the real number 3 is constructed by <cn type="real"> 3 </cn>, while the rational number 3/4 is constructed as <cn type="rational"> 3<sep/>4 </cn>. The detailed structure and specifications are provided in Section 4.4.1.1 Number (cn).

ci

The ci element, or "content identifier" is used to construct a variable, or an identifier. A type attribute indicates the type of object the symbol represents. Typically, ci represents a real scalar, but no default is specified. The content is either PCDATA or a general presentation construct (see Section 3.1.6 Summary of Presentation Elements). For example,

<ci>
<msub>
  <mi>c</mi>
  <mn>1</mn>
</msub>
</ci>

encodes an atomic symbol that displays visually as c1 which, for purposes of content, is treated as a single symbol representing a real number. The definitionURL attribute can be used to identify special properties or to refer to a defining instance of (for example) a bound variable. The detailed structure and specifications are provided in Section 4.4.1.2 Identifier (ci).

csymbol

The csymbol element, or "content symbol" is used to construct a symbol whose semantics are not part of the core content elements provided by MathML, but defined outside of the MathML specification. csymbol does not make any attempt to describe how to map the arguments occurring in any application of the function into a new MathML expression. Instead, it depends on its definitionURL attribute to point to a particular meaning, and the encoding attribute to give the syntax of this definition. The content of a csymbol is either PCDATA or a general presentation construct (see Section 3.1.6 Summary of Presentation Elements). For example,

<csymbol definitionURL="www.example.com/ContDiffFuncs.htm"
         encoding="text">
<msup>
  <mi>C</mi>
  <mn>2</mn>
</msup>
</csymbol>

encodes an atomic symbol that displays visually as C2 and that, for purposes of content, is treated as a single symbol representing the space of twice-differentiable continuous functions. The detailed structure and specifications are provided in Section 4.4.1.3 Externally defined symbol (csymbol).

4.2.2.2 Constructors

MathML provides a number of elements for combining elements into familiar compound objects. The compound objects include things like lists and sets. Each constructor produces a new type of object.

interval

The interval element is described in detail in Section 4.4.2.4 Interval (interval). It denotes an interval on the real line with the values represented by its children as end points. The closure attribute is used to qualify the type of interval being represented. For example,

<interval closure="open-closed">
  <ci> a </ci>
  <ci> b </ci>
</interval>

represents the open-closed interval often written (a, b].

set and list

The set and list elements are described in detail in Section 4.4.6.1 Set (set) and Section 4.4.6.2 List (list). Typically, the child elements of a possibly empty list element are the actual components of an ordered list. For example, an ordered list of the three symbols a, b, and c is encoded as

<list> <ci> a </ci> <ci> b </ci> <ci> c </ci> </list>

Alternatively, bvar and condition elements can be used to define lists where membership depends on satisfying certain conditions.

An order attribute can be used to specify what ordering is to be used. When the nature of the child elements permits, the ordering defaults to a numeric or lexicographic ordering.

Sets are structured much the same as lists except that there is no implied ordering and the type of set may be "normal" or "multiset" with "multiset" indicating that repetitions are allowed.

For both sets and lists, the child elements must be valid MathML content elements. The type of the child elements is not restricted. For example, one might construct a list of equations, or of inequalities.

matrix and matrixrow

The matrix element is used to represent mathematical matrices. It is described in detail in Section 4.4.10.2 Matrix (matrix). It has zero or more child elements, all of which are matrixrow elements. These in turn expect zero or more child elements that evaluate to algebraic expressions or numbers. These sub-elements are often real numbers, or symbols as in

<matrix>
  <matrixrow> <cn> 1 </cn> <cn> 2 </cn> </matrixrow>
  <matrixrow> <cn> 3 </cn> <cn> 4 </cn> </matrixrow>
</matrix>

The matrixrow elements must always be contained inside of a matrix, and all rows in a given matrix must have the same number of elements.

Note that the behavior of the matrix and matrixrow elements is substantially different from the mtable and mtr presentation elements.

vector

The vector element is described in detail in Section 4.4.10.1 Vector (vector). It constructs vectors from an n-dimensional vector space so that its n child elements typically represent real or complex valued scalars as in the three-element vector

<vector>
  <apply>
    <plus/>
    <ci> x </ci>
    <ci> y </ci>
  </apply>
  <cn> 3 </cn>
  <cn> 7 </cn>
</vector>
apply

The apply element is described in detail in Section 4.4.2.1 Apply (apply). Its purpose is to apply a function or operator to its arguments to produce an expression representing an element of the codomain of the function. It is involved in everything from forming sums such as a + b as in

<apply>
  <plus/>
  <ci> a </ci>
  <ci> b </ci>
</apply>

through to using the sine function to construct sin(a) as in

<apply>
  <sin/>
  <ci> a </ci>
</apply>

or constructing integrals. Its usage in any particular setting is determined largely by the properties of the function (the first child element) and as such its detailed usage is covered together with the functions and operators in Section 4.2.3 Functions, Operators and Qualifiers.

reln

The reln element is described in detail in Section 4.4.2.2 Relation (reln). It was used in MathML 1.0 to construct an expression such as a = b, as in

<reln><eq/>
  <ci> a </ci>
  <ci> b </ci>
</reln>

indicating an intended comparison between two mathematical values.

MathML 2.0 takes the view that this should be regarded as the application of a boolean function, and as such could be constructed using apply. The use of reln with logical operators is supported for reasons of backwards compatibility, but deprecated in favor of apply.

fn

The fn element was used in MathML 1.0 to make explicit the fact that an expression is being used as a function or operator. This is allowed in MathML 2.0 for backwards compatibility, but is deprecated, as the use of an expression as a function or operator is clear from its position as the first child of an apply. fn is discussed in detail in Section 4.4.2.3 Function (fn).

lambda

The lambda element is used to construct a user-defined function from an expression and one or more free variables. The lambda construct with n internal variables takes n+1 children. The first (second, up to n) is a bvar containing the identifiers of the internal variables. The last is an expression defining the function. This is typically an apply, but can also be any container element. The following constructs \lambda (x, sin x)

<lambda>
  <bvar><ci> x </ci></bvar>
  <apply>
    <sin/>
    <ci> x </ci>
  </apply>
</lambda>

The following constructs the constant function \lambda (x, 3)

<lambda>
  <bvar><ci> x </ci></bvar>
  <cn> 3 </cn>
</lambda>
piecewise, piece, otherwise

The piecewise, piece, otherwise elements are used to support "piecewise" declarations of the form " H(x) = 0 if x less than 0, H(x) = 1 otherwise".

<piecewise>
  <piece>
      <cn> 0 </cn>
      <apply><lt/><ci> x </ci> <cn> 0 </cn></apply>
  </piece>
    <otherwise>
      <ci> x </ci>
    </otherwise>
</piecewise>

The piecewise elements are discussed in detail in Section 4.4.2.16 Piecewise declaration (piecewise, piece, otherwise) .

4.2.2.3 Special Constructs

The declare construct is described in detail in Section 4.4.2.8 Declare (declare). It is special in that its entire purpose is to modify the semantics of other objects. It is not rendered visually or aurally.

The need for declarations arises any time a symbol (including more general presentations) is being used to represent an instance of an object of a particular type. For example, you may wish to declare that the symbolic identifier V represents a vector. The single argument form can be used to set properties of objects by setting the default values of implied attribute values to specific values.

The declaration

<declare type="vector"><ci>V</ci></declare>

resets the default type attribute of <ci>V</ci> to "vector" for all affected occurrences of <ci>V</ci>. This avoids having to write <ci type="vector">V</ci> every time you use the symbol.

More generally, declare can be used to associate expressions with specific content. For example, the declaration

<declare>
  <ci>F</ci>
  <lambda>
    <bvar><ci> U </ci></bvar>
    <apply>
      <int/>
      <bvar><ci> x </ci></bvar>
      <lowlimit><cn> 0 </cn></lowlimit>
      <uplimit><ci> a </ci></uplimit>
      <ci> U </ci>
    </apply>
  </lambda>
</declare>

associates the symbol F with a new function defined by the lambda construct. Within the scope where the declaration is in effect, the expression

<apply>
  <ci>F</ci>
  <ci> U </ci>
</apply>

stands for the integral of U from 0 to a.

The declare element can also be used to change the definition of a function or operator. For example, if the URL http://.../MathML:noncommutplus described a non-commutative plus operation encoded in Maple syntax, then the declaration

<declare definitionURL="http://.../MathML:noncommutplus"
         encoding="Maple">
  <plus/>
</declare>

would indicate that all affected uses of plus are to be interpreted as having that definition of plus.

4.2.3 Functions, Operators and Qualifiers

The operators and functions defined by MathML can be divided into categories as shown in the table below.

unary arithmetic factorial, minus, abs, conjugate, arg, real, imaginary, floor, ceiling
unary logical not
unary functional inverse, ident, domain, codomain, image
unary elementary classical functions sin, cos, tan, sec, csc, cot, sinh, cosh, tanh, sech, csch, coth, arcsin, arccos, arctan, arccosh, arccot, arccoth, arccsc, arccsch, arcsec, arcsech, arcsinh, arctanh, exp, ln, log
unary linear algebra determinant, transpose
unary calculus and vector calculus divergence, grad, curl, laplacian
unary set-theoretic card
binary arithmetic quotient, divide, minus, power, rem
binary logical implies, equivalent, approx
binary set operators setdiff
binary linear algebra vectorproduct, scalarproduct, outerproduct
n-ary arithmetic plus, times, max, min, gcd, lcm
n-ary statistical mean, sdev, variance, median, mode
n-ary logical and, or, xor
n-ary linear algebra selector
n-ary set operator union, intersect, cartesianproduct
n-ary functional fn, compose
integral, sum, product operators int, sum, product
differential operator diff, partialdiff
quantifier forall, exists

From the point of view of usage, MathML regards functions (for example sin and cos) and operators (for example plus and times) in the same way. MathML predefined functions and operators are all canonically empty elements.

Note that the csymbol element can be used to construct a user-defined symbol that can be used as a function or operator.

4.2.3.1 Predefined functions and operators

MathML functions can be used in two ways. They can be used as the operator within an apply element, in which case they refer to a function evaluated at a specific value. For example,

<apply>
  <sin/>
  <cn>5</cn>
</apply>

denotes a real number, namely sin(5).

MathML functions can also be used as arguments to other operators, for example

<apply>
  <plus/><sin/><cos/>
</apply>

denotes a function, namely the result of adding the sine and cosine functions in some function space. (The default semantic definition of plus is such that it infers what kind of operation is intended from the type of its arguments.)

The number of child elements in the apply is defined by the element in the first (i.e. operator) position.

Unary operators are followed by exactly one other child element within the apply.

Binary operators are followed by exactly two child elements.

N-ary operators are followed by two or more child elements.

The one exception to these rules is that declare elements may be inserted in any position except the first. declare elements are not counted when satisfying the child element count for an apply containing a unary or binary operator element.

Integral, sum, product and differential operators are discussed below in Section 4.2.3.2 Operators taking Qualifiers.

4.2.3.2 Operators taking Qualifiers

The table below contains the qualifiers and the operators defined as taking qualifiers in MathML.

qualifiers lowlimit, uplimit, bvar, degree, logbase, interval, condition, domainofapplication, momentabout
operators int, sum, product, root, diff, partialdiff, limit, log, moment, min, max, forall, exists

Operators taking qualifiers are canonically empty functions that differ from ordinary empty functions only in that they support the use of special qualifier elements to specify their meaning more fully. They are used in exactly the same way as ordinary operators, except that when they are used as operators, certain qualifier elements are also permitted to be in the enclosing apply. Qualifiers always follow the operator and precede the argument if it is present. If more than one qualifier is present, they appear in the order bvar, lowlimit, uplimit, interval, condition, domainofapplication, degree, momentabout, logbase. A typical example is:

<apply>
  <int/>
  <bvar><ci>x</ci></bvar>
  <interval><cn>0</cn><cn>1</cn></interval>
  <apply>
      <power/>
    <ci>x</ci>
    <cn>2</cn>
  </apply>
</apply>

It is also valid to use qualifier schema with a function not applied to an argument. For example, a function acting on integrable functions on the interval [0,1] might be denoted:

<fn>
  <apply>
    <int/>
    <bvar><ci>x</ci></bvar>
    <lowlimit><cn>0</cn></lowlimit>
    <uplimit><cn>1</cn></uplimit>
  </apply>
</fn>

In addition to the defined usage in MathML, qualifier schema may be used with any user-defined symbol (e.g. using csymbol) or construct. The meaning of such a usage is not defined by MathML; it would normally be user-defined using the definitionURL attribute.

The meaning and usage of qualifier schema varies from function to function. The following list summarizes the usage of qualifier schema with the MathML functions taking qualifiers.

int

The int function accepts the lowlimit, uplimit, bvar, interval, condition and domainofapplication schemata. If both lowlimit and uplimit schemata are present, they denote the limits of a definite integral. The domain of integration may alternatively be specified using interval, condition or domainofapplication. The bvar schema signifies the variable of integration. When used with int, each qualifier schema is expected to contain a single child schema; otherwise an error is generated.

diff

The diff function accepts the bvar schema. The bvar schema specifies with respect to which variable the derivative is being taken. The bvar may itself contain a degree schema that is used to specify the order of the derivative, i.e. a first derivative, a second derivative, etc. For example, the second derivative of f with respect to x is:

<apply>
  <diff/>
  <bvar>
    <ci> x </ci>
    <degree>
      <cn> 2 </cn>
    </degree>
  </bvar>
  <apply><fn><ci>f</ci></fn>
    <ci> x </ci>
  </apply>
</apply>
partialdiff

The partialdiff operator accepts zero or more bvar schemata, and an optional degree qualifier schema. The bvar schema specify, in order, the variables with respect to which the derivative is being taken. Each bvar element may contain a degree schema which is used to specify the order of the derivative being taken with respect to that variable. The optional degree schema qualifier associated with the partialdiff element itself (that is, appearing as a child of the enclosing apply element rather than of one of the bvar qualifiers) is used to represent the total degree of the differentiation. Each degree schema used with partialdiff is expected to contain a single child schema. For example,

<apply>
  <partialdiff/>
  <bvar>
    <degree><cn>2</cn></degree>
    <ci>x</ci>
  </bvar>
  <bvar><ci>y</ci></bvar>
  <bvar><ci>x</ci></bvar>
  <degree><cn>4</cn></degree>
  <ci type="fn">f</ci>
</apply>

denotes the mixed partial derivative ( d4 / d2x dy dx ) f.

sum, product

The sum and product functions accept the bvar, lowlimit, uplimit, interval, condition and domainofapplication schemata. If both lowlimit and uplimit schemata are present, they denote the limits of the sum or product. The limits may alternatively be specified using the interval, condition or domainofapplication schema. The bvar schema signifies the internal variable in the sum or product. A typical example might be:

<apply>
  <sum/>
  <bvar><ci>i</ci></bvar>
  <lowlimit><cn>0</cn></lowlimit>
  <uplimit><cn>100</cn></uplimit>
  <apply>
    <power/>
    <ci>x</ci>
    <ci>i</ci>
  </apply>
</apply>

When used with sum or product, each qualifier schema is expected to contain a single child schema; otherwise an error is generated.

limit

The limit function accepts zero or more bvar schemata, and optional condition and lowlimit schemata. A condition may be used to place constraints on the bvar. The bvar schema denotes the variable with respect to which the limit is being taken. The lowlimit schema denotes the limit point. When used with limit, the bvar and lowlimit schemata are expected to contain a single child schema; otherwise an error is generated.

log

The log function accepts only the logbase schema. If present, the logbase schema denotes the base with respect to which the logarithm is being taken. Otherwise, the log is assumed to be base 10. When used with log, the logbase schema is expected to contain a single child schema; otherwise an error is generated.

moment

The moment function accepts the degree and momentabout schema. If present, the degree schema denotes the order of the moment. Otherwise, the moment is assumed to be the first order moment. When used with moment, the degree schema is expected to contain a single child schema; otherwise an error is generated. If present, the momentabout schema denotes the point about which the moment is taken. Otherwise, the moment is assumed to be the moment about zero.

min, max

The min and max functions accept a bvar schema in cases where the maximum or minimum is being taken over a set of values specified by a condition schema together with an expression to be evaluated on that set. In MathML1.0, the bvar element was optional when using a condition; if a condition element containing a single variable was given by itself following a min or max operator, the variable was implicitly assumed to be bound, and the expression to be maximized or minimized (if absent) was assumed to be the single bound variable. This usage is deprecated in MathML 2.0 in favor of explicitly stating the bound variable(s) and the expression to be maximized or minimized in all cases.

The min and max elements may also be applied to a list of values in which case no qualifier schemata are used. For examples of all three usages, see Section 4.4.3.4 Maximum and minimum (max, min).

forall, exists

The universal and existential quantifier operators forall and exists are used in conjunction with one or more bvar schemata to represent simple logical assertions. There are two ways of using the logical quantifier operators. The first usage is for representing a simple, quantified assertion. For example, the statement "there exists x < 9" would be represented as:

<apply>
  <exists/>
  <bvar><ci> x </ci></bvar>
  <apply><lt/>
    <ci> x </ci><cn> 9 </cn>
  </apply>
</apply>

The second usage is for representing implications. Hypotheses are given by a condition element following the bound variables. For example the statement "for all x < 9, x < 10" would be represented as:

<apply>
  <forall/>
  <bvar><ci> x </ci></bvar>
  <condition>
    <apply><lt/>
      <ci> x </ci><cn> 9 </cn>
    </apply>
  </condition>
  <apply><lt/>
    <ci> x </ci><cn> 10 </cn>
  </apply>
</apply>

Note that in both usages one or more bvar qualifiers are mandatory.

4.2.4 Relations

binary relation neq, equivalent, approx, factorof
binary logical relation implies
binary set relation in, notin, notsubset, notprsubset
binary series relation tendsto
n-ary relation eq, leq, lt, geq, gt
n-ary set relation subset, prsubset

The MathML content tags include a number of canonically empty elements which denote arithmetic and logical relations. Relations are characterized by the fact that, if an external application were to evaluate them (MathML does not specify how to evaluate expressions), they would typically return a truth value. By contrast, operators generally return a value of the same type as the operands. For example, the result of evaluating a < b is either true or false (by contrast, 1 + 2 is again a number).

Relations are bracketed with their arguments using the apply element in the same way as other functions. In MathML 1.0, relational operators were bracketed using reln. This usage, although still supported, is now deprecated in favor of apply. The element for the relational operator is the first child element of the apply. Thus, the example from the preceding paragraph is properly marked up as:

<apply>
  <lt/>
  <ci>a</ci>
  <ci>b</ci>
</apply>

It is an error to enclose a relation in an element other than apply or reln.

The number of child elements in the apply is defined by the element in the first (i.e. relation) position.

Unary relations are followed by exactly one other child element within the apply.

Binary relations are followed by exactly two child elements.

N-ary relations are followed by zero or more child elements.

The one exception to these rules is that declare elements may be inserted in any position except the first. declare elements are not counted when satisfying the child element count for an apply containing a unary or binary relation element.

4.2.5 Conditions

condition condition

The condition element is used to define the "such that" construct in mathematical expressions. Condition elements are used in a number of contexts in MathML. They are used to construct objects like sets and lists by rule instead of by enumeration. They can be used with the forall and exists operators to form logical expressions. And finally, they can be used in various ways in conjunction with certain operators. For example, they can be used with an int element to specify domains of integration, or to specify argument lists for operators like min and max.

The condition element is always used together with one or more bvar elements.

The exact interpretation depends on the context, but generally speaking, the condition element is used to restrict the permissible values of a bound variable appearing in another expression to those that satisfy the relations contained in the condition. Similarly, when the condition element contains a set, the values of the bound variables are restricted to that set.

A condition element contains a single child that is either an apply, or a reln element (deprecated). Compound conditions are indicated by applying relations such as and inside the child of the condition.

4.2.5.1 Examples

The following encodes "there exists x such that x5 < 3".

<apply>
  <exists/>
  <bvar><ci> x </ci></bvar>
  <condition>
    <apply><lt/>
      <apply>
        <power/>
        <ci>x</ci>
        <cn>5</cn>
      </apply>
      <cn>3</cn>
    </apply>
  </condition>
</apply>

The next example encodes "for all x in N there exist prime numbers p, q such that p+q = 2x".

<apply>
  <forall/>
  <bvar><ci>x</ci></bvar>
  <condition>
    <apply><in/>
          <ci>x</ci>
          <csymbol encoding="OpenMath" 
            definitionURL="http://www.openmath.org/cd/setname1.ocd">
            N
          </csymbol>
        </apply>
  </condition>

  <apply><exists/>
     <bvar><ci>p</ci></bvar>
     <bvar><ci>q</ci></bvar>
     <condition>
       <apply><and/>
          <apply><in/><ci>p</ci>
            <csymbol encoding="OpenMath" 
              definitionURL="http://www.openmath.org/cd/setname1.ocd">
             P
            </csymbol>
          </apply>
          <apply><in/><ci>q</ci>
            <csymbol encoding="OpenMath" 
              definitionURL="http://www.openmath.org/cd/setname1.ocd">
              P
            </csymbol>
          </apply>
          <apply><eq/>
              <apply><plus/><ci>p</ci><ci>q</ci></apply>
              <apply><times/><cn>2</cn><ci>x</ci></apply>
          </apply>
        </apply>
      </condition>
  </apply>
</apply>

A third example shows the use of quantifiers with condition. The following markup encodes "there exists x < 3 such that x2 = 4".

<apply>
  <exists/>
  <bvar><ci> x </ci></bvar>
  <condition>
    <apply><lt/><ci>x</ci><cn>3</cn></apply>
  </condition>
  <apply>
    <eq/>
    <apply>
      <power/><ci>x</ci><cn>2</cn>
    </apply>
    <cn>4</cn>
  </apply>
</apply>

4.2.6 Syntax and Semantics

mappings semantics, annotation, annotation-xml

The use of content markup rather than presentation markup for mathematics is sometimes referred to as semantic tagging [Buswell1996]. The parse-tree of a valid element structure using MathML content elements corresponds directly to the expression tree of the underlying mathematical expression. We therefore regard the content tagging itself as encoding the syntax of the mathematical expression. This is, in general, sufficient to obtain some rendering and even some symbolic manipulation (e.g. polynomial factorization).

However, even in such apparently simple expressions as X + Y, some additional information may be required for applications such as computer algebra. Are X and Y integers, or functions, etc.? "Plus" represents addition over which field? This additional information is referred to as semantic mapping. In MathML, this mapping is provided by the semantics, annotation and annotation-xml elements.

The semantics element is the container element for the MathML expression together with its semantic mappings. semantics expects a variable number of child elements. The first is the element (which may itself be a complex element structure) for which this additional semantic information is being defined. The second and subsequent children, if any, are instances of the elements annotation and/or annotation-xml.

The semantics element also accepts the definitionURL and encoding attributes for use by external processing applications. One use might be a URI for a semantic content dictionary, for example. Since the semantic mapping information might in some cases be provided entirely by the definitionURL attribute, the annotation or annotation-xml elements are optional.

The annotation element is a container for arbitrary data. This data may be in the form of text, computer algebra encodings, C programs, or whatever a processing application expects. annotation has an attribute "encoding" defining the form in use. Note that the content model of annotation is PCDATA, so care must be taken that the particular encoding does not conflict with XML parsing rules.

The annotation-xml element is a container for semantic information in well-formed XML. For example, an XML form of the OpenMath semantics could be given. Another possible use here is to embed, for example, the presentation tag form of a construct given in content tag form in the first child element of semantics (or vice versa). annotation-xml has an attribute "encoding" defining the form in use.

For example:

<semantics>
  <apply>
  <divide/>
    <cn>123</cn>
    <cn>456</cn>
  </apply>
  <annotation encoding="Mathematica">
    N[123/456, 39]
  </annotation>
  <annotation encoding="TeX">
    $0.269736842105263157894736842105263157894\ldots$
  </annotation>
  <annotation encoding="Maple">
    evalf(123/456, 39);
  </annotation>
  <annotation-xml encoding="MathML-Presentation">
    <mrow>
      <mn> 0.269736842105263157894 </mn>
      <mover accent='true'>
        <mn> 736842105263157894 </mn>
        <mo> &OverBar; </mo>
      </mover>
    </mrow>
  </annotation-xml>
  <annotation-xml encoding="OpenMath">
    <OMA xmlns="http://www.openmath.org/OpenMath">
	  <OMS cd="arith1" name="divide"/>
	  <OMI>123</OMI>
	  <OMI>456</OMI>
    </OMA>
  </annotation-xml>
</semantics>

where OMA is the element defining the additional semantic information.

Of course, providing an explicit semantic mapping at all is optional, and in general would only be provided where there is some requirement to process or manipulate the underlying mathematics.

4.2.7 Semantic Mappings

Although semantic mappings can easily be provided by various proprietary, or highly specialized encodings, there are no widely available, non-proprietary standard schemes for semantic mapping. In part to address this need, the goal of the OpenMath effort is to provide a platform-independent, vendor-neutral standard for the exchange of mathematical objects between applications. Such mathematical objects include semantic mapping information. The OpenMath group has defined an XML syntax for the encoding of this information [OpenMath2000]. This element set could provide the basis of one annotation-xml element set.

An attractive side of this mechanism is that the OpenMath syntax is specified in XML, so that a MathML expression together with its semantic annotations can be validated using XML parsers.

4.2.8 Constants and Symbols

MathML provides a collection of predefined constants and symbols which represent frequently-encountered concepts in K-12 mathematics. These include symbols for well-known sets, such as integers and rationals, and also some widely known constant symbols such as false, true, exponentiale.

4.2.9 MathML element types

MathML functions, operators and relations can all be thought of as mathematical functions if viewed in a sufficiently abstract way. For example, the standard addition operator can be regarded as a function mapping pairs of real numbers to real numbers. Similarly, a relation can be thought of as a function from some space of ordered pairs into the set of values {true, false}. To be mathematically meaningful, the domain and codomain of a function must be precisely specified. In practical terms, this means that functions only make sense when applied to certain kinds of operands. For example, thinking of the standard addition operator, it makes no sense to speak of "adding" a set to a function. Since MathML content markup seeks to encode mathematical expressions in a way that can be unambiguously evaluated, it is no surprise that the types of operands is an issue.

MathML specifies the types of arguments in two ways. The first way is by providing precise instructions for processing applications about the kinds of arguments expected by the MathML content elements denoting functions, operators and relations. These operand types are defined in a dictionary of default semantic bindings for content elements, which is given in Appendix C Content Element Definitions. For example, the MathML content dictionary specifies that for real scalar arguments the plus operator is the standard commutative addition operator over a field. The elements cn has a type attribute with a default value of "real". Thus some processors will be able to use this information to verify the validity of the indicated operations.

Although MathML specifies the types of arguments for functions, operators and relations, and provides a mechanism for typing arguments, a MathML-compliant processor is not required to do any type checking. In other words, a MathML processor will not generate errors if argument types are incorrect. If the processor is a computer algebra system, it may be unable to evaluate an expression, but no MathML error is generated.

4.3 Content Element Attributes

4.3.1 Content Element Attribute Values

Content element attributes are all of the type CDATA, that is, any character string will be accepted as valid. In addition, each attribute has a list of predefined values, which a content processor is expected to recognize and process. The reason that the attribute values are not formally restricted to the list of predefined values is to allow for extension. A processor encountering a value (not in the predefined list) which it does not recognize may validly process it as the default value for that attribute.

4.3.2 Attributes Modifying Content Markup Semantics

Each attribute is followed by the elements to which it can be applied.

4.3.2.1 base

cn

indicates numerical base of the number. Predefined values: any numeric string.

The default value is "10"

4.3.2.2 closure

interval

indicates closure of the interval. Predefined values: "open", "closed", "open-closed", "closed-open".

The default value is "closed"

4.3.2.3 definitionURL

csymbol, declare, semantics, any operator element

points to an external definition of the semantics of the symbol or construct being declared. The value is a URL or URI that should point to some kind of definition. This definition overrides the MathML default semantics.

At present, MathML does not specify the format in which external semantic definitions should be given. In particular, there is no requirement that the target of the URI be loadable and parsable. An external definition could, for example, define the semantics in human-readable form.

Ideally, in most situations the definition pointed to by the definitionURL attribute would be some standard, machine-readable format. However, there are reasons why MathML does not require such a format.

  • No such format currently exists. There are several projects underway to develop and implement standard semantic encoding formats, most notably the OpenMath effort. By nature, the development of a comprehensive system of semantic encoding is a very large enterprise, and while much work has been done, much additional work remains. Even though the definitionURL is designed and intended for use with a formal semantic encoding language such as OpenMath, it is premature to require any one particular format.

  • There will always be situations where some non-standard format is preferable. This is particularly true in situations where authors are describing new ideas. It is anticipated that in the near term, there will be a variety of renderer-dependent implementations of the definitionURL attribute.

    • A translation tool might simply prompt the user with the specified definition in situations where the proper semantics have been overridden, and in this case, human-readable definitions will be most useful.

    • Other software may utilize OpenMath encodings.

    • Still other software may use proprietary encodings, or look for definitions in any of several formats.

    As a consequence, authors need to be aware that there is no guarantee a generic renderer will be able to take advantage of information pointed to by the definitionURL attribute. Of course, when widely-accepted standardized semantic encodings are available, the definitions pointed to can be replaced without modifying the original document. However, this is likely to be labor intensive.

There is no default value for the definitionURL attribute, i.e. the semantics are defined within the MathML fragment, and/or by the MathML default semantics.

4.3.2.4 encoding

annotation, annotation-xml, csymbol, semantics, all operator elements

indicates the encoding of the annotation, or in the case of csymbol , semantics and operator elements, the syntax of the target referred to by definitionURL. Predefined values are "MathML-Presentation", "MathML-Content". Other typical values: "TeX", "OpenMath".

The default value is "", i.e. unspecified.

4.3.2.5 nargs

declare

indicates number of arguments for function declarations. Pre-defined values: "nary", or any numeric string.

The default value is "1".

4.3.2.6 occurrence

declare

indicates occurrence for operator declarations. Pre-defined values: "prefix", "infix", "function-model".

The default value is "function-model".

4.3.2.7 order

list

indicates ordering on the list. Predefined values: "lexicographic", "numeric".

The default value is "numeric".

4.3.2.8 scope

declare

indicates scope of applicability of the declaration. Pre-defined values: "local", "global" (deprecated).

  • "local" means the containing MathML element.

  • "global" means the containing math element.

In MathML 2.0, a declare has been restricted to occur only at the beginning of a math element. Thus, there is no difference between the two possible scope values and the scope attribute may be safely ignored. The "global" attribute value has been deprecated for this role as "local" better represents the concept. Ideally, one would like to make document-wide declarations by setting the value of the scope attribute to be "global-document". However, the proper mechanism for document-wide declarations very much depends on details of the way in which XML will be embedded in HTML, future XML style sheet mechanisms, and the underlying Document Object Model.

Since these supporting technologies are still in flux at present, the MathML specification does not include "global-document" as a pre-defined value of the scope attribute. It is anticipated, however, that this issue will be revisited in future revisions of MathML as supporting technologies stabilize. In the near term, MathML implementors that wish to simulate the effect of a document-wide declaration are encouraged to pre-process documents in order to distribute document-wide declarations to each individual math element in the document.

4.3.2.9 type

cn

indicates type of the number. Predefined values: "e-notation", "integer", "rational", "real", "complex-polar", "complex-cartesian", "constant".

The default value is "real".

Note: Each data type implies that the data adheres to certain formatting conventions, detailed below. If the data fails to conform to the expected format, an error is generated. Details of the individual formats are:

real

A real number is presented in decimal notation. Decimal notation consists of an optional sign ("+" or "-") followed by a string of digits possibly separated into an integer and a fractional part by a "decimal point". Some examples are 0.3, 1, and -31.56. If a different base is specified, then the digits are interpreted as being digits computed to that base.

e-notation

A real number may also be presented in scientific notation. Such numbers have two parts (a mantissa and an exponent) separated by sep. The first part is a real number, while the second part is an integer exponent indicating a power of the base. For example, 12.3<sep/>5 represents 12.3 times 105. The default presentation of this example is 12.3e5.

integer

An integer is represented by an optional sign followed by a string of 1 or more "digits". What a "digit" is depends on the base attribute. If base is present, it specifies the base for the digit encoding, and it specifies it base 10. Thus base='16' specifies a hex encoding. When base > 10, letters are added in alphabetical order as digits. The legitimate values for base are therefore between 2 and 36.

rational

A rational number is two integers separated by <sep/>. If base is present, it specifies the base used for the digit encoding of both integers.

complex-cartesian

A complex number is of the form two real point numbers separated by <sep/>.

complex-polar

A complex number is specified in the form of a magnitude and an angle (in radians). The raw data is in the form of two real numbers separated by <sep/>.

constant

The "constant" type is used to denote named constants. Several important constants such as pi have been included explicitly in MathML 2.0 as empty elements. This use of the cn is discouraged in favour of the defined constants, or the use of csymbol with an appropriate value for the definitionURL. For example, instead of using the pi element, an instance of <cn type="constant">&pi;</cn> could be used. This should be interpreted as having the semantics of the mathematical constant Pi. The data for a constant cn tag may be one of the following common constants:

Symbol Value
&pi; The usual &pi; of trigonometry: approximately 3.141592653...
&ExponentialE; (or &ee;) The base for natural logarithms: approximately 2.718281828...
&ImaginaryI; (or &ii;) Square root of -1
&gamma; Euler's constant: approximately 0.5772156649...
&infin; (or &infty;) Infinity. Proper interpretation varies with context
&true; the logical constant true
&false; the logical constant false
&NotANumber; (or &NaN;) represents the result of an ill-defined floating point division
ci

indicates type of the identifier. Predefined values: "integer", "rational", "real", , "complex", "complex-polar", "complex-cartesian", "constant", or the name of any content element. The meanings of the attribute values shared with cn are the same as those listed for the cn element. The attribute value "complex" is intended for use when an identifier represents a complex number but the particular representation (such as polar or cartesian) is either not known or is irrelevant.

The default value is "", i.e. unspecified.

declare

indicates a type value that is to be attached to the first child of the declare. The first child of the declare must accept a type attribute and the attribute value provided must be appropriate for that element. For example, if the first child is a ci element then the attribute value must be valid for a ci element.

The default value is unspecified.

set

indicates type of the set. Predefined values: "normal", "multiset". "multiset" indicates that repetitions are allowed.

The default value is "normal".

tendsto

is used to capture the notion of one quantity approaching another. It occurs as a container so that it can more easily be used in the construction of a limit expression. Predefined values: "above", "below", "two-sided".

The default value is "two-sided".

4.3.3 Attributes Modifying Content Markup Rendering

4.3.3.1 type

The type attribute, in addition to conveying semantic information, can be interpreted to provide rendering information. For example in

<ci type="vector">V</ci>

a renderer could display a bold V for the vector.

4.3.3.2 General Attributes

All content elements support the following general attributes that can be used to modify the rendering of the markup.

  • class

  • style

  • id

  • other

The "class", "style" and "id" attributes are intended for compatibility with Cascading Style Sheets (CSS), as described in Section 2.4.5 Attributes Shared by all MathML Elements.

Content or semantic tagging goes along with the (frequently implicit) premise that, if you know the semantics, you can always work out a presentation form. When an author's main goal is to mark up re-usable, evaluatable mathematical expressions, the exact rendering of the expression is probably not critical, provided that it is easily understandable. However, when an author's goal is more along the lines of providing enough additional semantic information to make a document more accessible by facilitating better visual rendering, voice rendering, or specialized processing, controlling the exact notation used becomes more of an issue.

MathML elements accept an attribute other (see Section 7.2.3 Attributes for unspecified data), which can be used to specify things not specifically documented in MathML. On content tags, this attribute can be used by an author to express a preference between equivalent forms for a particular content element construct, where the selection of the presentation has nothing to do with the semantics. Examples might be

  • inline or displayed equations

  • script-style fractions

  • use of x with a dot for a derivative over dx/dt

Thus, if a particular renderer recognized a display attribute to select between script-style and display-style fractions, an author might write

<apply other='display="scriptstyle"'>
  <divide/>
  <cn> 1 </cn>
  <ci> x </ci>
</apply>

to indicate that the rendering 1/x is preferred.

The information provided in the other attribute is intended for use by specific renderers or processors, and therefore, the permitted values are determined by the renderer being used. It is legal for a renderer to ignore this information. This might be intentional, as in the case of a publisher imposing a house style, or simply because the renderer does not understand them, or is unable to carry them out.

4.4 The Content Markup Elements

This section provides detailed descriptions of the MathML content tags. They are grouped in categories that broadly reflect the area of mathematics from which they come, and also the grouping in the MathML DTD. There is no linguistic difference in MathML between operators and functions. Their separation here and in the DTD is for reasons of historical usage.

When working with the content elements, it can be useful to keep in mind the following.

The available content elements are:

4.4.1 Token Elements

4.4.1.1 Number (cn)

4.4.1.1.1 Discussion

The cn element is used to specify actual numerical constants. The content model must provide sufficient information that a number may be entered as data into a computational system. By default, it represents a signed real number in base 10. Thus, the content normally consists of PCDATA restricted to a sign, a string of decimal digits and possibly a decimal point, or alternatively one of the predefined symbolic constants such as &pi;.

The cn element uses the attribute type to represent other types of numbers such as, for example, integer, rational, real or complex, and uses the attribute base to specify the numerical base.

In addition to simple PCDATA, cn accepts as content PCDATA separated by the (empty) element sep. This determines the different parts needed to construct a rational or complex-cartesian number.

The cn element may also contain arbitrary presentation markup in its content (see Chapter 3 Presentation Markup) so that its presentation can be very elaborate.

Alternative input notations for numbers are possible, but must be explicitly defined by using the definitionURL and encoding attributes, to refer to a written specification of how a sequence of real numbers separated by <sep/> should be interpreted.

4.4.1.1.2 Attributes

All attributes are CDATA:

type

Allowed values are "real", "integer", "rational", "complex-cartesian", "complex-polar", "constant"

base

Number (CDATA for XML DTD) between 2 and 36.

definitionURL

URL or URI pointing to an alternative definition.

encoding

Syntax of the alternative definition.

4.4.1.1.3 Examples
<cn type="real"> 12345.7 </cn>
<cn type="integer"> 12345 </cn>
<cn type="integer" base="16"> AB3 </cn>
<cn type="rational"> 12342 <sep/> 2342342 </cn>
<cn type="complex-cartesian"> 12.3 <sep/> 5 </cn>
<cn type="complex-polar"> 2 <sep/> 3.1415 </cn>
<cn type="constant">  &pi; </cn>
4.4.1.1.4 Default Rendering

By default, a contiguous block of PCDATA contained in a cn element should render as if it were wrapped in an mn presentation element.

If an application supports bidirectional text rendering, then the rendering within a cn element follows the Unicode bidirectional rendering rules just as if it were wrapped in an mn presentation element.

Similarly, presentation markup contained in a cn element should render as it normally would. A mixture of PCDATA and presentation markup should render as if it were wrapped in an mrow element, with contiguous blocks of PCDATA wrapped in mn elements.

However, not all mathematical systems that encounter content based tagging do visual or aural rendering. The receiving applications are free to make use of a number in the manner in which they normally handle numerical data. Some systems might simplify the rational number 12342/2342342 to 6171/1171171 while pure floating point based systems might approximate this as 0.5269085385e-2. All numbers might be re-expressed in base 10. The role of MathML is simply to record enough information about the mathematical object and its structure so that it may be properly parsed.

The following renderings of the above MathML expressions are included both to help clarify the meaning of the corresponding MathML encoding and as suggestions for authors of rendering applications. In each case, no mathematical evaluation is intended or implied.

  • 12345.7

  • 12345

  • AB316

  • 12342 / 2342342

  • 12.3 + 5 i

  • Polar( 2 , 3.1415 )

  • \pi

4.4.1.2 Identifier (ci)

4.4.1.2.1 Discussion

The ci element is used to name an identifier in a MathML expression (for example a variable). Such names are used to identify mathematical objects. By default they are assumed to represent complex scalars. The ci element may contain arbitrary presentation markup in its content (see Chapter 3 Presentation Markup) so that its presentation as a symbol can be very elaborate.

The ci element uses the type attribute to specify the basic type of object that it represents. While any CDATA string is a valid type, the predefined types include "integer", "rational", "real", , "complex", "complex-polar", "complex-cartesian", "constant", and more generally, any of the names of the MathML container elements (e.g. vector) or their type values. For a more advanced treatment of types, the type attribute is inappropriate. Advanced types require significant structure of their own (for example, vector(complex)) and are probably best constructed as mathematical objects and then associated with a MathML expression through use of the semantics element. Additional information on this topic is planned. See the MathML website for more information.

The definitionURL attribute can be used to associate additional properties with a ci element. See the discussion of bound variables (Section 4.4.5.6 Bound variable (bvar)) for a discussion of an important instance of this.

4.4.1.2.2 Examples
<ci> x </ci>
<ci type="vector"> V </ci>
<ci>
  <msub>
    <mi>x</mi>
    <mi>a</mi>
  </msub>
</ci>
4.4.1.2.3 Default Rendering

If the content of a ci element is tagged using presentation tags, that presentation is used. If no such tagging is supplied then the PCDATA content is rendered as if it were the content of an mi element.

If an application supports bidirectional text rendering, then the rendering within a ci element follows the Unicode bidirectional rendering rules just as if it were wrapped in an mi presentation element.

A renderer may wish to make use of the value of the type attribute to improve on this. For example, a symbol of type vector might be rendered using a bold face. Typical renderings of the above symbols are:

  • x

  • V

  • x_i

4.4.1.3 Externally defined symbol (csymbol)

4.4.1.3.1 Discussion

The csymbol element allows a writer to create an element in MathML whose semantics are externally defined (i.e. not in the core MathML content). The element can then be used in a MathML expression as for example an operator or constant. Attributes are used to give the syntax and location of the external definition of the symbol semantics.

Use of csymbol for referencing external semantics can be contrasted with use of the semantics to attach additional information in-line (ie. within the MathML fragment) to a MathML construct. See Section 4.2.6 Syntax and Semantics.

4.4.1.3.2 Attributes

All attributes are CDATA:

definitionURL

Pointer to external definition of the semantics of the symbol. MathML does not specify a particular syntax in which this definition should be written.

encoding

Gives the syntax of the definition pointed to by definitionURL. An application can then test the value of this attribute to determine whether it is able to process the target of the definitionURL. This syntax might be text, or a formal syntax such as OpenMath.

4.4.1.3.3 Examples
<!-- reference to OpenMath formal syntax definition of Bessel function -->
<apply>
  <csymbol encoding="OpenMath" 
           definitionURL="http://www.openmath.org/cd/BesselFunctions.ocd">
    <msub><mi>J</mi><mn>0</mn></msub>
  </csymbol>
  <ci>y</ci>
</apply>

<!-- reference to human readable text description of Boltzmann's constant -->
<csymbol encoding="text" 
         definitionURL="www.example.org/universalconstants/Boltzmann.htm">
  k
</csymbol>
4.4.1.3.4 Default Rendering

By default, a contiguous block of PCDATA contained in a csymbol element should render as if it were wrapped in an mo presentation element.

If an application supports bidirectional text rendering, then the rendering within a csymbol element follows the Unicode bidirectional rendering rules just as if it were wrapped in an mo presentation element.

Similarly, presentation markup contained in a csymbol element should render as it normally would. A mixture of PCDATA and presentation markup should render as if it were contained wrapped in an mrow element, with contiguous blocks of PCDATA wrapped in mo elements. The examples above would render by default as

  • J_0(y)

  • k

As csymbol is used to support reference to externally defined semantics, it is a MathML error to have embedded content MathML elements within the csymbol element.

4.4.2 Basic Content Elements

4.4.2.1 Apply (apply)

4.4.2.1.1 Discussion

The apply element allows a function or operator to be applied to its arguments. Nearly all expression construction in MathML content markup is carried out by applying operators or functions to arguments. The first child of apply is the operator to be applied, with the other child elements as arguments or qualifiers.

The apply element is conceptually necessary in order to distinguish between a function or operator, and an instance of its use. The expression constructed by applying a function to 0 or more arguments is always an element from the codomain of the function.

Proper usage depends on the operator that is being applied. For example, the plus operator may have zero or more arguments, while the minus operator requires one or two arguments to be properly formed.

If the object being applied as a function is not already one of the elements known to be a function (such as fn, sin or plus) then it is treated as if it were the content of an fn element.

Some operators such as diff and int make use of "named" arguments. These special arguments are elements that appear as children of the apply element and identify "parameters" such as the variable of differentiation or the domain of integration. These elements are discussed further in Section 4.2.3.2 Operators taking Qualifiers.

4.4.2.1.2 Examples
<apply>
  <factorial/>
  <cn>3</cn>
</apply>
<apply>
  <plus/>
  <cn>3</cn>
  <cn>4</cn>
</apply>
<apply>
  <sin/>
  <ci>x</ci>
</apply>
4.4.2.1.3 Default Rendering

A mathematical system that has been passed an apply element is free to do with it whatever it normally does with such mathematical data. It may be that no rendering is involved (e.g. a syntax validator), or that the "function application" is evaluated and that only the result is rendered (e.g. sin(0) \rightarrow 0).

When an unevaluated "function application" is rendered there are a wide variety of appropriate renderings. The choice often depends on the function or operator being applied. Applications of basic operations such as plus are generally presented using an infix notation while applications of sin would use a more traditional functional notation such as sin(x). Consult the default rendering for the operator being applied.

Applications of user-defined functions (see csymbol, fn) that are not evaluated by the receiving or rendering application would typically render using a traditional functional notation unless an alternative presentation is specified using the semantics tag.

4.4.2.2 Relation (reln)

4.4.2.2.1 Discussion

The reln element was used in MathML 1.0 to construct an equation or relation. Relations were constructed in a manner exactly analogous to the use of apply. This usage is deprecated in MathML 2.0 in favor of the more generally usable apply.

The first child of reln is the relational operator to be applied, with the other child elements acting as arguments. See Section 4.2.4 Relations for further details.

4.4.2.2.2 Examples
<reln>
  <eq/>
  <ci> a </ci>
  <ci> b </ci>
</reln>
<reln>
  <lt/>
  <ci> a </ci>
  <ci> b </ci>
</reln>
4.4.2.2.3 Default Rendering
  • a = b

  • a < b

4.4.2.3 Function (fn)

4.4.2.3.1 Discussion

The fn element makes explicit the fact that a more general (possibly constructed) MathML object is being used in the same manner as if it were a pre-defined function such as sin or plus.

fn has exactly one child element, used to give the name (or presentation form) of the function. When fn is used as the first child of an apply, the number of following arguments is determined by the contents of the fn.

In MathML 1.0, fn was also the primary mechanism used to extend the collection of "known" mathematical functions. This usage is now deprecated in favor of the more generally applicable csymbol element. (New functions may also be introduced by using declare in conjunction with a lambda expression.)

4.4.2.3.2 Examples
<fn><ci> L </ci> </fn>
<apply>
  <fn>
  <apply>
    <plus/>
    <ci> f </ci>
    <ci> g </ci>
  </apply>
  </fn>
  <ci>z</ci>
</apply>
4.4.2.3.3 Default Rendering

An fn object is rendered in the same way as its content. A rendering application may add additional adornments such as parentheses to clarify the meaning.

  • L

  • (f+g)z

4.4.2.4 Interval (interval)

4.4.2.4.1 Discussion

The interval element is used to represent simple mathematical intervals of the real number line. It takes an attribute closure, which can take on any of the values "open", "closed", "open-closed", or "closed-open", with a default value of "closed".

More general domains are constructed by using the condition and bvar elements to bind free variables to constraints.

The interval element expects either two child elements that evaluate to real numbers or one child element that is a condition defining the interval.

4.4.2.4.2 Examples
<interval>
  <ci> a </ci>
  <ci> b </ci>
</interval>
<interval closure="open-closed">
  <ci> a </ci>
  <ci> b </ci>
</interval>
4.4.2.4.3 Default Rendering
  • [a, b]

  • (a, b]

4.4.2.5 Inverse (inverse)

4.4.2.5.1 Discussion

The inverse element is applied to a function in order to construct a generic expression for the functional inverse of that function. (See also the discussion of inverse in Section 4.2.1.5 The inverse construct). As with other MathML functions, inverse may either be applied to arguments, or it may appear alone, in which case it represents an abstract inversion operator acting on other functions.

A typical use of the inverse element is in an HTML document discussing a number of alternative definitions for a particular function so that there is a need to write and define f(-1)(x). To associate a particular definition with f(-1), use the definitionURL and encoding attributes.

4.4.2.5.2 Examples
<apply>
  <inverse/>
  <ci> f </ci>
</apply>
<apply>
  <inverse definitionURL="../MyDefinition.htm" encoding="text"/>
  <ci> f </ci>
</apply>
<apply>
  <apply><inverse/>
    <ci type="matrix"> a </ci>
  </apply>
  <ci> A </ci>
</apply>
4.4.2.5.3 Default Rendering

The default rendering for a functional inverse makes use of a parenthesized exponent as in f(-1)(x).

4.4.2.6 Separator (sep)

4.4.2.6.1 Discussion

The sep element is used to separate PCDATA into separate tokens for parsing the contents of the various specialized forms of the cn elements. For example, sep is used when specifying the real and imaginary parts of a complex number (see Section 4.4.1 Token Elements). If it occurs between MathML elements, it is a MathML error.

4.4.2.6.2 Examples
<cn type="complex-cartesian"> 3 <sep/> 4 </cn>
4.4.2.6.3 Default Rendering

The sep element is not directly rendered (see Section 4.4.1 Token Elements).

4.4.2.7 Condition (condition)

4.4.2.7.1 Discussion

The condition element is used to place a condition on one or more free variables or identifiers. The conditions may be specified in terms of relations that are to be satisfied by the variables, including general relationships such as set membership.

It is used to define general sets and lists in situations where the elements cannot be explicitly enumerated. Condition contains either a single apply or reln element; the apply element is used to construct compound conditions. For example, it is used below to describe the set of all x such that x < 5. See the discussion on sets in Section 4.4.6 Theory of Sets. See Section 4.2.5 Conditions for further details.

4.4.2.7.2 Examples
<condition>
  <apply><in/><ci> x </ci><ci type="set"> R </ci></apply>
</condition>
<condition>
  <apply>
    <and/>
    <apply><gt/><ci> x </ci><cn> 0 </cn></apply>
    <apply><lt/><ci> x </ci><cn> 1 </cn></apply>
  </apply>
</condition>
<apply>
  <max/>
  <bvar><ci> x </ci></bvar>
  <condition>
    <apply> <and/>
      <apply><gt/><ci> x </ci><cn> 0 </cn></apply>
      <apply><lt/><ci> x </ci><cn> 1 </cn></apply>
    </apply>
  </condition>
  <apply>
    <minus/>
    <ci> x </ci>
    <apply>
      <sin/>
      <ci> x </ci>
    </apply>
  </apply>
</apply>
4.4.2.7.3 Default Rendering
  • x \in \mathbb{R}

  • x > 0 \land x < 1

  • \max_{x}\{\,x-\sin x\mid 0<x<1\,\}

4.4.2.8 Declare (declare)

4.4.2.8.1 Discussion

The declare construct has two primary roles. The first is to change or set the default attribute values for a specific mathematical object. The second is to establish an association between a "name" and an object. Once a declaration is in effect, the "name" object acquires the new attribute settings, and (if the second object is present) all the properties of the associated object.

The various attributes of the declare element assign properties to the object being declared or determine where the declaration is in effect. The list of allowed attributes varies depending on the object involved as it always includes the attributes associated with that object.

The scope of a declaration is "local" to the surrounding container element. The scope attribute can only be assigned to "local", but is intended to support future extensions. As discussed in Section 4.3.2.8 scope, MathML contains no provision for making document-wide declarations at present, though it is anticipated that this capability will be added in future revisions of MathML, when supporting technologies become available.

declare takes one or two children. The first child, which is mandatory, is the object affected by the declaration. This is usually a ci element providing the identifier that is being declared as in:

<declare type="vector"> <ci> V </ci> </declare>

The second child, which is optional, is a constructor initializing the variable:

<declare type="vector">
  <ci> V </ci>
  <vector>
    <cn> 1 </cn><cn> 2 </cn><cn> 3 </cn>
  </vector>
</declare>

The constructor type and the type of the element declared must agree. For example, if the type attribute of the declaration is fn, the second child (constructor) must be an element equivalent to an fn element. (This would include actual fn elements, lambda elements and any of the defined functions in the basic set of content tags.) If no type is specified in the declaration then the type attribute of the declared name is set to the type of the constructor (second child) of the declaration.

An important case is when the first child is an identifier, and the second child is a semantics tag enclosing that identifier. In this case all uses of the identifier acquire the associations implied by the use of the semantics element. without having to write out the full semantics element for every use.

The actual instances of a declared ci element are normally recognized by comparing their content with that of the declared element. Equality of two elements is determined by comparing the XML information set of the two expressions after XML space normalization.

When the content is more complex, semantics elements are involved, or the author simply wants to use multiple presentations for emphasis without losing track of the relationship to the declared instance the author may choose to make the correspondence explicit by placing an id attribute on a declared instance and refering back to it using a definitionURL attribute on the matching instances of the ci element as in the following example.

  <declare>
    <ci id="var-A"> A </ci>
    <vector>
      <ci> a </ci>
      <ci> b </ci>
      <ci> c </ci>
    </vector>
  </declare>
  <apply>
    <eq/>
    <ci> V </ci>
    <apply>
      <plus/>
      <ci definitionURL="#var-A"> A </ci>
      <ci> B </ci>
    </apply>
  </apply>
4.4.2.8.2 Attributes

All attributes are CDATA. Of special interest are:

type

defines the MathML element type of the identifier declared.

scope

defines the scope of application of the declaration.

nargs

number of arguments for function declarations.

occurrence

describes operator usage as "prefix", "infix" or "function-model" indications.

definitionURL

URI pointing to detailed semantics of the function.

encoding

syntax of the detailed semantics of the function.

4.4.2.8.3 Examples

The declaration

<declare type="fn" nargs="2">
  <ci> f </ci>
  <apply>
    <plus/>
    <ci> F </ci><ci> G </ci>
  </apply>
</declare>

declares f to be a two-variable function with the property that f(x, y) = (F+ G)(x, y).

The declaration

<declare type="fn">
  <ci> J </ci>
  <lambda>
    <bvar><ci> x </ci></bvar>
    <apply><ln/>
      <ci> x </ci>
    </apply>
  </lambda>
</declare>

associates the name J with a one-variable function defined so that J(y) = ln y. (Note that because of the type attribute of the declare element, the second argument must be something of function type , namely a known function like sin, or a lambda construct.)

The type attribute on the declaration is only necessary if the type cannot be inferred from the type of the second argument.

Even when a declaration is in effect it is still possible to override attributes values selectively as in <ci type="set"> S </ci>. This capability is needed in order to write statements of the form "Let s be a member of S".

4.4.2.8.4 Default Rendering

Since the declare construct is not directly rendered, most declarations are likely to be invisible to a reader. However, declarations can produce quite different effects in an application which evaluates or manipulates MathML content. While the declaration

<declare>
  <ci> v </ci>
  <vector>
    <cn> 1 </cn>
    <cn> 2 </cn>
    <cn> 3 </cn>
  </vector>
</declare>

is active the symbol v acquires all the properties of the vector, and even its dimension and components have meaningful values. This may affect how v is rendered by some applications, as well as how it is treated mathematically.

4.4.2.9 Lambda (lambda)

4.4.2.9.1 Discussion

The lambda element is used to construct a user-defined function from an expression and one or more free variables. The lambda construct with n internal variables takes n+1 children. The first n children identify the variables that are used as placeholders in the last child for actual parameter values. See Section 4.2.2.2 Constructors for further details.

4.4.2.9.2 Examples

The first example presents a simple lambda construct.

<lambda>
  <bvar><ci> x </ci></bvar>
  <apply><sin/>
    <apply>
      <plus/>
      <ci> x </ci>
      <cn> 1 </cn>
    </apply>
  </apply>
</lambda>

The next example constructs a one-argument function in which the argument b specifies the upper bound of a specific definite integral.

<lambda>
  <bvar><ci> b </ci></bvar>
  <apply>
    <int/>
    <bvar>
       <ci> x </ci>
    </bvar>
    <lowlimit>
       <ci> a </ci>
    </lowlimit>
    <uplimit>
       <ci> b </ci>
    </uplimit>
    <apply><fn><ci> f </ci></fn>
       <ci> x </ci>
    </apply>
  </apply>
</lambda>

Such constructs are often used in conjunction with declare to construct new functions.

4.4.2.9.3 Default Rendering
  • \lambda(x, \sin x + 1)

  • \lambda(b, \int_a^b f(x)\,\diffd x)

4.4.2.10 Function composition (compose)

4.4.2.10.1 Discussion

The compose element represents the function composition operator. Note that MathML makes no assumption about the domain and codomain of the constituent functions in a composition; the domain of the resulting composition may be empty.

To override the default semantics for the compose element, or to associate a more specific definition for function composition, use the definitionURL and encoding attributes. See Section 4.2.3 Functions, Operators and Qualifiers for further details.

4.4.2.10.2 Examples
<apply>
  <compose/>
  <fn><ci> f </ci></fn>
  <fn><ci> g </ci></fn>
</apply>
<apply>
  <compose/>
  <ci type="fn"> f </ci>
  <ci type="fn"> g </ci>
  <ci type="fn"> h </ci>
</apply>
<apply>
  <apply><compose/>
    <fn><ci> f </ci></fn>
    <fn><ci> g </ci></fn>
  </apply>
  <ci> x </ci>
</apply>
<apply>
  <fn><ci> f </ci></fn>
  <apply>
    <fn><ci> g </ci></fn>
    <ci> x </ci>
  </apply>
</apply>
4.4.2.10.3 Default Rendering
  • f \circ g

  • f \circ g \circ h

  • (f \circ g) (x)

  • f(g(x))

4.4.2.11 Identity function (ident)

4.4.2.11.1 Discussion

The ident element represents the identity function. MathML makes no assumption about the function space in which the identity function resides. That is, proper interpretation of the domain (and hence codomain) of the identity function depends on the context in which it is used.

To override the default semantics for the ident element, or to associate a more specific definition, use the definitionURL and encoding attributes (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.2.11.2 Examples
<apply>
  <eq/>
  <apply><compose/>
    <fn><ci> f </ci></fn>
    <apply><inverse/>
      <fn><ci> f </ci></fn>
    </apply>
  </apply>
  <ident/>
</apply>
4.4.2.11.3 Default Rendering

f \circ f^{-1} = \mathrm{id}

4.4.2.12 Domain (domain)

4.4.2.12.1 Discussion

The domain element denotes the domain of a given function, which is the set of values over which it is defined.

To override the default semantics for the domain element, or to associate a more specific definition, use the definitionURL and encoding attributes (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.2.12.2 Examples

If f is a function from the reals to the rationals, then:

<apply>
  <eq/>
  <apply><domain/>
    <fn><ci> f </ci></fn>
  </apply>
  <reals/>
</apply>
4.4.2.12.3 Default Rendering

\mbox{domain}(f) = \mathbb{R}

4.4.2.13 codomain (codomain)

4.4.2.13.1 Discussion

The codomain element denotes the codomain of a given function, which is a set containing all values taken by the function. It is not necessarily the case that every point in the codomain is generated by the function applied to some point of the domain. (For example I may know that a function is integer-valued, so its codomain is the integers, without knowing (or stating) which subset of the integers is mapped to by the function.)

Codomain is sometimes also called Range.

To override the default semantics for the codomain element, or to associate a more specific definition, use the definitionURL and encoding attributes (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.2.13.2 Examples

If f is a function from the reals to the rationals, then:

<apply>
  <eq/>
  <apply><codomain/>
    <fn><ci> f </ci></fn>
  </apply>
  <rationals/>
</apply>
4.4.2.13.3 Default Rendering

\mbox{codomain} (f) = \mathbb{Q}

4.4.2.14 Image (image)

4.4.2.14.1 Discussion

The image element denotes the image of a given function, which is the set of values taken by the function. Every point in the image is generated by the function applied to some point of the domain.

To override the default semantics for the image element, or to associate a more specific definition, use the definitionURL and encoding attributes (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.2.14.2 Examples

The real sin function is a function from the reals to the reals, taking values between -1 and 1.

<apply>
  <eq/>
  <apply><image/>
    <sin/>
  </apply>
  <interval>
    <cn>-1</cn>
	<cn> 1</cn>
  </interval>
</apply>
4.4.2.14.3 Default Rendering

\mbox{image}(\sin) = [-1 , 1]

4.4.2.15 Domain of Application (domainofapplication)

4.4.2.15.1 Discussion

The domainofapplication element denotes the domain over which a given function is being applied. It is intended to be a more general alternative to specification of this domain using such qualifier elements as bvar, lowlimit or condition.

To override the default semantics for the domainofapplication element, or to associate a more specific definition, use the definitionURL and encoding attributes (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.2.15.2 Examples

The integral of a function f over an arbitrary domain C .

<apply>
  <int/>
  <domainofapplication>
    <ci> C </ci>
  </domainofapplication>
  <ci> f </ci>
</apply>
4.4.2.15.3 Default Rendering

The default rendering depends on the particular function being applied.

\int_C f

4.4.2.16 Piecewise declaration (piecewise, piece, otherwise)

4.4.2.16.1 Discussion

The piecewise, piece, and otherwise elements are used to support "piecewise" declarations of the form " H(x) = 0 if x less than 0, H(x) = 1 otherwise".

The declaration is constructed using the piecewise element. This contains one or more piece elements, and optionally one otherwise element. Each piece element contains exactly two children. The first child defines the value taken by the piecewise expression when the condition specified in the associated second child of the piece is true.

otherwise allows the specification of a value to be taken by the piecewise function when none of the conditions (second child elements of the piece elements) is true, i.e. a default value.

It should be noted that no "order of execution" is implied by the ordering of the piece child elements within piecewise. It is the responsibility of the author to ensure that the subsets of the function domain defined by the second children of the piece elements are disjoint, or that, where they overlap, the values of the corresponding first children of the piece elements coincide. If this is not the case, the meaning of the expression is undefined.

The piecewise elements are constructors (see Section 4.2.2.2 Constructors).

4.4.2.16.2 Examples
<piecewise>
  <piece>
      <cn> 0 </cn>
      <apply><lt/><ci> x </ci> <cn> 0 </cn></apply>
  </piece>
  <otherwise>
      <ci> x </ci>
  </otherwise>
</piecewise>

The following might be a definition of abs (x)

<apply>
<eq/>
<apply>
  <abs/>
  <ci> x </ci>
</apply>
<piecewise>
  <piece>
      <apply><minus/><ci> x </ci></apply>
      <apply><lt/><ci> x </ci> <cn> 0 </cn></apply>
  </piece>
  <piece>
      <cn> 0 </cn>
      <apply><eq/><ci> x </ci> <cn> 0 </cn></apply>
  </piece>
  <piece>
      <ci> x </ci>
      <apply><gt/><ci> x </ci> <cn> 0 </cn></apply>
  </piece>
</piecewise>
</apply>
4.4.2.16.3 Default Rendering

|x| =   \left\{\begin{array}{ll}-x& \mbox{if } x < 0\\0& \mbox{if } x = 0 \\ x& \mbox{if } x > 0\end{array}\right.

4.4.3 Arithmetic, Algebra and Logic

4.4.3.1 Quotient (quotient)

4.4.3.1.1 Discussion

The quotient element is the operator used for division modulo a particular base. When the quotient operator is applied to integer arguments a and b, the result is the "quotient of a divided by b". That is, quotient returns the unique integer q such that a = q b + r. (In common usage, q is called the quotient and r is the remainder.)

The quotient element takes the attribute definitionURL and encoding attributes, which can be used to override the default semantics.

The quotient element is a binary arithmetic operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.3.1.2 Example
<apply>
  <quotient/>
  <ci> a </ci>
  <ci> b </ci>
</apply>

Various mathematical applications will use this data in different ways. Editing applications might choose an image such as shown below, while a computationally based application would evaluate it to 2 when a=13 and b=5.

4.4.3.1.3 Default Rendering

There is no commonly used notation for this concept. Some possible renderings are

  • quotient of a divided by b

  • integer part of a / b

  • \lfloor a/b \rfloor

4.4.3.2 Factorial (factorial)

4.4.3.2.1 Discussion

The factorial element is used to construct factorials.

The factorial element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The factorial element is a unary arithmetic operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.3.2.2 Example
<apply>
  <factorial/>
  <ci> n </ci>
</apply>

If this were evaluated at n = 5 it would evaluate to 120.

4.4.3.2.3 Default Rendering

n!

4.4.3.3 Division (divide)

4.4.3.3.1 Discussion

The divide element is the division operator.

The divide element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The divide element is a binary arithmetic operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.3.3.2 Example
<apply>
  <divide/>
  <ci> a </ci>
  <ci> b </ci>
</apply>

As a MathML expression, this does not evaluate. However, on receiving such an expression, some applications may attempt to evaluate and simplify the value. For example, when a=5 and b=2 some mathematical applications may evaluate this to 2.5 while others will treat is as a rational number.

4.4.3.3.3 Default Rendering

a/b

4.4.3.4 Maximum and minimum (max, min)

4.4.3.4.1 Discussion

The elements max and min are used to compare the values of their arguments. They return the maximum and minimum of these values respectively.

The max and min elements take the definitionURL and encoding attributes that can be used to override the default semantics.

The max and min elements are n-ary arithmetic operators (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.3.4.2 Examples

When the objects are to be compared explicitly they are listed as arguments to the function as in:

<apply>
  <max/>
  <ci> a </ci>
  <ci> b </ci>
</apply>

The elements to be compared may also be described using bound variables with a condition element and an expression to be maximized (or minimized), as in:

<apply>
  <min/>
  <bvar><ci>x</ci></bvar>
  <condition>
    <apply><notin/><ci> x </ci><ci type="set"> B </ci></apply>
  </condition>
  <apply>
      <power/>
    <ci> x </ci>
    <cn> 2 </cn>
  </apply>
</apply>

Note that the bound variable must be stated even if it might be implicit in conventional notation. In MathML1.0, the bound variable and expression to be evaluated (x) could be omitted in the example below: this usage is deprecated in MathML2.0 in favor of explicitly stating the bound variable and expression in all cases:

<apply>
  <max/>
  <bvar><ci>x</ci></bvar>
  <condition>
    <apply><and/>
      <apply><in/><ci>x</ci><ci type="set">B</ci></apply>
      <apply><notin/><ci>x</ci><ci type="set">C</ci></apply>
    </apply>
  </condition>
  <ci>x</ci>
</apply>
4.4.3.4.3 Default Rendering
  • \max\{a,b\}

  • \min_{x}\{\,x^{2}\mid x\notin B\,\}

  • \max\{\,x\in B\land x\notin C\,\}

4.4.3.5 Subtraction (minus)

4.4.3.5.1 Discussion

The minus element is the subtraction operator.

The minus element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The minus element can be used as a unary arithmetic operator (e.g. to represent - x), or as a binary arithmetic operator (e.g. to represent x- y).

4.4.3.5.2 Example
<apply> <minus/>
  <ci> x </ci>
  <ci> y </ci>
</apply>

If this were evaluated at x=5 and y=2 it would yield 3.

4.4.3.5.3 Default Rendering

x-y

4.4.3.6 Addition (plus)

4.4.3.6.1 Discussion

The plus element is the addition operator.

The plus element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The plus element is an n-ary arithmetic operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.3.6.2 Example
<apply>
  <plus/>
  <ci> x </ci>
  <ci> y </ci>
  <ci> z </ci>
</apply>

If this were evaluated at x = 5, y = 2 and z = 1 it would yield 8.

4.4.3.6.3 Default Rendering

x+y+z

4.4.3.7 Exponentiation (power)

4.4.3.7.1 Discussion

The power element is a generic exponentiation operator. That is, when applied to arguments a and b, it returns the value of "a to the power of b".

The power element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The power element is a binary arithmetic operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.3.7.2 Example
<apply>
  <power/>
  <ci> x </ci>
  <cn> 3 </cn>
</apply>

If this were evaluated at x= 5 it would yield 125.

4.4.3.7.3 Default Rendering

x^3

4.4.3.8 Remainder (rem)

4.4.3.8.1 Discussion

The rem element is the operator that returns the "remainder" of a division modulo a particular base. When the rem operator is applied to integer arguments a and b, the result is the "remainder of a divided by b". That is, rem returns the unique integer, r such that a = q b+ r, where r < q. (In common usage, q is called the quotient and r is the remainder.)

The rem element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The rem element is a binary arithmetic operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.3.8.2 Example
<apply>
  <rem/>
  <ci> a </ci>
  <ci> b </ci>
</apply>

If this were evaluated at a = 15 and b = 8 it would yield 7.

4.4.3.8.3 Default Rendering

a \mod b

4.4.3.9 Multiplication (times)

4.4.3.9.1 Discussion

The times element is the multiplication operator.

times takes the definitionURL and encoding attributes, which can be used to override the default semantics.

4.4.3.9.2 Example
<apply>
  <times/>
  <ci> a </ci>
  <ci> b </ci>
</apply>

If this were evaluated at a = 5.5 and b = 3 it would yield 16.5.

4.4.3.9.3 Default Rendering

a b

4.4.3.10 Root (root)

4.4.3.10.1 Discussion

The root element is used to construct roots. The kind of root to be taken is specified by a degree element, which should be given as the second child of the apply element enclosing the root element. Thus, square roots correspond to the case where degree contains the value 2, cube roots correspond to 3, and so on. If no degree is present, a default value of 2 is used.

The root element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The root element is an operator taking qualifiers (see Section 4.2.3.2 Operators taking Qualifiers).

4.4.3.10.2 Example

The nth root of a is is given by

<apply>
  <root/>
  <degree><ci type='integer'> n </ci></degree>
  <ci> a </ci>
</apply>
4.4.3.10.3 Default Rendering

\sqrt[n]{a}

4.4.3.11 Greatest common divisor (gcd)

4.4.3.11.1 Discussion

The gcd element is used to denote the greatest common divisor of its arguments.

The gcd takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The gcd element is an n-ary operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.3.11.2 Example
<apply> <gcd/>
  <ci> a </ci>
  <ci> b </ci>
  <ci> c </ci>
</apply>

If this were evaluated at a = 15, b = 21, c = 48, it would yield 3.

4.4.3.11.3 Default Rendering

\gcd(a, b, c)

This default rendering is English-language locale specific: other locales may have different default renderings.

4.4.3.12 And (and)

4.4.3.12.1 Discussion

The and element is the boolean "and" operator.

The and element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The and element is an n-ary logical operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.3.12.2 Example
<apply>
  <and/>
  <ci> a </ci>
  <ci> b </ci>
</apply>

If this were evaluated and both a and b had truth values of "true", then the result would be "true".

4.4.3.12.3 Default Rendering

a \land b

4.4.3.13 Or (or)

4.4.3.13.1 Discussion

The or element is the boolean "or" operator.

The or element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The or element is an n-ary logical operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.3.13.2 Example
<apply>
  <or/>
  <ci> a </ci>
  <ci> b </ci>
</apply>
4.4.3.13.3 Default Rendering

a \lor b

4.4.3.14 Exclusive Or (xor)

4.4.3.14.1 Discussion

The xor element is the boolean "exclusive or" operator.

xor takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The xor element is an n-ary logical operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.3.14.2 Example
<apply>
  <xor/>
  <ci> a </ci>
  <ci> b </ci>
</apply>
4.4.3.14.3 Default Rendering

a \xor b

4.4.3.15 Not (not)

The not operator is the boolean "not" operator.

The not element takes the attribute definitionURL and encoding attributes, which can be used to override the default semantics.

The not element is a unary logical operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.3.15.1 Example
<apply>
  <not/>
  <ci> a </ci>
</apply>
4.4.3.15.2 Default Rendering

\neg a

4.4.3.16 Implies (implies)

4.4.3.16.1 Discussion

The implies element is the boolean relational operator "implies".

The implies element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The implies element is a binary logical operator (see Section 4.2.4 Relations).

4.4.3.16.2 Example
<apply>
  <implies/>
  <ci> A </ci>
  <ci> B </ci>
</apply>

Mathematical applications designed for the evaluation of such expressions would evaluate this to "true" when a = "false" and b = "true".

4.4.3.16.3 Default Rendering

A \Rightarrow B

4.4.3.17 Universal quantifier (forall)

4.4.3.17.1 Discussion

The forall element represents the universal quantifier of logic. It must be used in conjunction with one or more bound variables, an optional condition element, and an assertion, which should take the form of an apply element. In MathML 1.0, the reln element was also permitted here: this usage is now deprecated.

The forall element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The forall element is a quantifier (see Section 4.2.3.2 Operators taking Qualifiers).

4.4.3.17.2 Examples

The first example encodes a simple identity.

<apply>
  <forall/>
  <bvar><ci> x </ci></bvar>
  <apply><eq/>
    <apply>
      <minus/><ci> x </ci><ci> x </ci>
    </apply>
    <cn>0</cn>
  </apply>
</apply>

The next example is more involved, and makes use of an optional condition element.

<apply>
  <forall/>
  <bvar><ci> p </ci></bvar>
  <bvar><ci> q </ci></bvar>
  <condition>
    <apply><and/>
      <apply><in/><ci> p </ci><rationals/></apply>
      <apply><in/><ci> q </ci><rationals/></apply>
      <apply><lt/><ci> p </ci><ci> q </ci></apply>
    </apply>
  </condition>
  <apply><lt/>
      <ci> p </ci>
      <apply>
          <power/>
        <ci> q </ci>
        <cn> 2 </cn>
      </apply>
  </apply>
</apply>

The final example uses both the forall and exists quantifiers.

<apply>
  <forall/>
  <bvar><ci> n </ci></bvar>
  <condition>
    <apply><and/>
      <apply><gt/><ci> n </ci><cn> 0 </cn></apply>
      <apply><in/><ci> n </ci><integers/></apply>
    </apply>
  </condition>
  <apply>
    <exists/>
    <bvar><ci> x </ci></bvar>
    <bvar><ci> y </ci></bvar>
    <bvar><ci> z </ci></bvar>
    <condition>
      <apply><and/>
        <apply><in/><ci> x </ci><integers/></apply>
        <apply><in/><ci> y </ci><integers/></apply>
        <apply><in/><ci> z </ci><integers/></apply>
      </apply>
    </condition>
    <apply>
      <eq/>
      <apply>
        <plus/>
        <apply><power/><ci> x </ci><ci> n </ci></apply>
        <apply><power/><ci> y </ci><ci> n </ci></apply>
      </apply>
      <apply><power/><ci> z </ci><ci> n </ci></apply>
    </apply>
  </apply>
</apply>
4.4.3.17.3 Default Rendering
  • \forall x: x-x=0

  • \forall p \in \mathbb{Q}, q \in \mathbb{Q}, p < q: p < q^2

  • \forall n>0, n \in \mathbb{Z}: \exists x \in \mathbb{Z}, y \in \mathbb{Z}, z \in  \mathbb{Z}: x^n+y^n=z^n

Note:

The second and third examples in this section are correct MathML expressions of False mathematical statements.

4.4.3.18 Existential quantifier (exists)

4.4.3.18.1 Discussion

The exists element represents the existential quantifier of logic. It must be used in conjunction with one or more bound variables, an optional condition element, and an assertion, which may take the form of either an apply or reln element.

The exists element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The exists element is a quantifier (see Section 4.2.3.2 Operators taking Qualifiers).

4.4.3.18.2 Example

The following example encodes the sense of the expression "there exists an x such that f(x) = 0".

<apply>
  <exists/>
  <bvar><ci> x </ci></bvar>
  <apply><eq/>
    <apply>
      <fn><ci> f </ci></fn>
      <ci> x </ci>
    </apply>
    <cn>0</cn>
  </apply>
</apply>
4.4.3.18.3 Default Rendering

\exists x: f(x)=0

4.4.3.19 Absolute Value (abs)

4.4.3.19.1 Discussion

The abs element represents the absolute value of a real quantity or the modulus of a complex quantity.

The abs element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The abs element is a unary arithmetic operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.3.19.2 Example

The following example encodes the absolute value of x.

<apply>
  <abs/>
  <ci> x </ci>
</apply>
4.4.3.19.3 Default Rendering

|x|

4.4.3.20 Complex conjugate (conjugate)

4.4.3.20.1 Discussion

The conjugate element represents the complex conjugate of a complex quantity.

The conjugate element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The conjugate element is a unary arithmetic operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.3.20.2 Example

The following example encodes the conjugate of x + i y.

<apply>
  <conjugate/>
  <apply>
    <plus/>
    <ci> x </ci>
    <apply><times/>
      <cn> &ImaginaryI; </cn>
      <ci> y </ci>
    </apply>
  </apply>
</apply>
4.4.3.20.3 Default Rendering

\overline{x + \ii y}

4.4.3.21 Argument (arg)

4.4.3.21.1 Discussion

The arg operator (introduced in MathML 2.0) gives the "argument" of a complex number, which is the angle (in radians) it makes with the positive real axis. Real negative numbers have argument equal to + \pi.

The arg element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The arg element is a unary arithmetic operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.3.21.2 Example

The following example encodes the argument operation on x + i y.

<apply>
  <arg/>
  <apply><plus/>
    <ci> x </ci>
    <apply><times/>
      <cn> &ImaginaryI; </cn>
      <ci> y </ci>
    </apply>
  </apply>
</apply>
4.4.3.21.3 Default Rendering

\arg(x + \ii y)

4.4.3.22 Real part (real)

4.4.3.22.1 Discussion

The real operator (introduced in MathML 2.0) gives the real part of a complex number, that is the x component in x + i y

The real element takes the attributes encoding and definitionURL that can be used to override the default semantics.

The real element is a unary arithmetic operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.3.22.2 Example

The following example encodes the real operation on x + i y.

<apply>
  <real/>
  <apply><plus/>
    <ci> x </ci>
    <apply><times/>
      <cn> &ImaginaryI; </cn>
      <ci> y </ci>
    </apply>
  </apply>
</apply>

A MathML-aware evaluation system would return the x component, suitably encoded.

4.4.3.22.3 Default Rendering

\Re(x + \ii y)

4.4.3.23 Imaginary part (imaginary)

4.4.3.23.1 Discussion

The imaginary operator (introduced in MathML 2.0) gives the imaginary part of a complex number, that is, the y component in x + i y.

The imaginary element takes the attributes encoding and definitionURL that can be used to override the default semantics.

The imaginary element is a unary arithmetic operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.3.23.2 Example

The following example encodes the imaginary operation on x + i y.

<apply>
  <imaginary/>
  <apply><plus/>
    <ci> x </ci>
    <apply><times/>
      <cn> &ImaginaryI; </cn>
      <ci> y </ci>
    </apply>
  </apply>
</apply>

A MathML-aware evaluation system would return the y component, suitably encoded.

4.4.3.23.3 Default Rendering

\Im(x + \ii y)

4.4.3.24 Lowest common multiple (lcm)

4.4.3.24.1 Discussion

The lcm element (introduced in MathML 2.0) is used to denote the lowest common multiple of its arguments.

The lcm takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The lcm element is an n-ary operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.3.24.2 Example
<apply> <lcm/>
  <ci> a </ci>
  <ci> b </ci>
  <ci> c </ci>
</apply>

If this were evaluated at a = 2, b = 4, c = 6 it would yield 12.

4.4.3.24.3 Default Rendering

\mathrm{lcm}(a, b, c)

This default rendering is English-language locale specific: other locales may have different default renderings.

4.4.3.25 Floor (floor)

4.4.3.25.1 Discussion

The floor element (introduced in MathML 2.0) is used to denote the round-down (towards -infinity) operator.

The floor takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The floor element is a unary operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.3.25.2 Example
<apply> <floor/>
  <ci> a </ci>
</apply>

If this were evaluated at a = 15.015, it would yield 15.

<apply> <forall/>
  <bvar><ci> a </ci></bvar>
  <apply><and/>
    <apply><leq/>
	  <apply><floor/>
		<ci>a</ci>
	  </apply>
	  <ci>a</ci>
	</apply>    
    <apply><lt/>
      <ci>a</ci>
	  <apply><plus/>
	    <apply><floor/>
		  <ci>a</ci>
		</apply>
		<cn>1</cn>
	  </apply>
	</apply>
  </apply>
</apply>
4.4.3.25.3 Default Rendering

\lfloor{a}\rfloor

4.4.3.26 Ceiling (ceiling)

4.4.3.26.1 Discussion

The ceiling element (introduced in MathML 2.0) is used to denote the round-up (towards +infinity) operator.

The ceiling takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The ceiling element is a unary operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.3.26.2 Example
<apply> <ceiling/>
  <ci> a </ci>
</apply>

If this were evaluated at a = 15.015, it would yield 16.

<apply> <forall/>
  <bvar><ci> a </ci></bvar>
  <apply><and/>
    <apply><lt/>
	  <apply><minus/>
	    <apply><ceiling/>
		  <ci>a</ci>
		</apply>
		<cn>1</cn>
	  </apply>
      <ci>a</ci>
	</apply>
    <apply><leq/>
	  <ci>a</ci>
	  <apply><ceiling/>
		<ci>a</ci>
	  </apply>
	</apply>    
  </apply>
</apply>
4.4.3.26.3 Default Rendering

\lceil{a}\rceil

4.4.4 Relations

4.4.4.1 Equals (eq)

4.4.4.1.1 Discussion

The eq element is the relational operator "equals".

The eq element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The equals element is an n-ary relation (see Section 4.2.3.2 Operators taking Qualifiers).

4.4.4.1.2 Example
<apply>
  <eq/>
  <ci> a </ci>
  <ci> b </ci>
</apply>

If this were tested at a = 5.5 and b = 6 it would yield the truth value false.

4.4.4.1.3 Default Rendering

a = b

4.4.4.2 Not Equals (neq)

4.4.4.2.1 Discussion

The neq element is the "not equal to" relational operator.

neq takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The neq element is a binary relation (see Section 4.2.4 Relations).

4.4.4.2.2 Example
<apply>
  <neq/>
  <ci> a </ci>
  <ci> b </ci>
</apply>

If this were tested at a = 5.5 and b = 6 it would yield the truth value true.

4.4.4.2.3 Default Rendering

a \neq b

4.4.4.3 Greater than (gt)

4.4.4.3.1 Discussion

The gt element is the "greater than" relational operator.

The gt element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The gt element is an n-ary relation (see Section 4.2.4 Relations).

4.4.4.3.2 Example
<apply>
  <gt/>
  <ci> a </ci>
  <ci> b </ci>
</apply>

If this were tested at a = 5.5 and b = 6 it would yield the truth value false.

4.4.4.3.3 Default Rendering

a > b

4.4.4.4 Less Than (lt)

4.4.4.4.1 Discussion

The lt element is the "less than" relational operator.

The lt element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The lt element is an n-ary relation (see Section 4.2.4 Relations).

4.4.4.4.2 Example
<apply>
  <lt/>
  <ci> a </ci>
  <ci> b </ci>
</apply>

If this were tested at a = 5.5 and b = 6 it would yield the truth value "true".

4.4.4.4.3 Default Rendering

a < b

4.4.4.5 Greater Than or Equal (geq)

4.4.4.5.1 Discussion

The geq element is the relational operator "greater than or equal".

The geq element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The geq element is an n-ary relation (see Section 4.2.4 Relations).

4.4.4.5.2 Example
<apply>
  <geq/>
  <ci> a </ci>
  <ci> b </ci>
</apply>

If this were tested for a = 5.5 and b = 5.5 it would yield the truth value true.

4.4.4.5.3 Default Rendering

a \geq b

4.4.4.6 Less Than or Equal (leq)

4.4.4.6.1 Discussion

The leq element is the relational operator "less than or equal".

The leq element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The leq element is an n-ary relation (see Section 4.2.4 Relations).

4.4.4.6.2 Example
<apply>
  <leq/>
  <ci> a </ci>
  <ci> b </ci>
</apply>

If a = 5.4 and b = 5.5 this will yield the truth value true.

4.4.4.6.3 Default Rendering

a \leq b

4.4.4.7 Equivalent (equivalent)

4.4.4.7.1 Discussion

The equivalent element is the "equivalence" relational operator.

The equivalent element takes the attributes encoding and definitionURL that can be used to override the default semantics.

The equivalent element is an n-ary relation (see Section 4.2.3.2 Operators taking Qualifiers).

4.4.4.7.2 Example
<apply>
  <equivalent/>
  <ci> a </ci>
  <apply>
    <not/>
    <apply> <not/> <ci> a </ci> </apply>
  </apply>
</apply>

This yields the truth value true for all values of a.

4.4.4.7.3 Default Rendering

a \equiv \neg(\neg a)

4.4.4.8 Approximately (approx)

4.4.4.8.1 Discussion

The approx element is the relational operator "approximately equal". This is a generic relational operator and no specific arithmetic precision is implied

The approx element takes the attributes encoding and definitionURL that can be used to override the default semantics.

The approx element is a binary relation (see Section 4.2.3.2 Operators taking Qualifiers).

4.4.4.8.2 Example
<apply>
  <approx/>
  <cn type="rational"> 22 <sep/> 7 </cn>
  <cn type="constant"> &pi; </cn>
</apply>
4.4.4.8.3 Default Rendering

a \approx b

4.4.4.9 Factor Of (factorof)

4.4.4.9.1 Discussion

The factorof element is the relational operator element on two integers a and b specifying whether one is an integer factor of the other.

The factorof element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The factorof element is an binary relational operator (see Section 4.2.4 Relations).

4.4.4.9.2 Example
<apply>
  <factorof/>
    <ci> a </ci>
    <ci> b </ci>
</apply>
4.4.4.9.3 Default Rendering

a | b

4.4.5 Calculus and Vector Calculus

4.4.5.1 Integral (int)

4.4.5.1.1 Discussion

The int element is the operator element for an integral. The lower limit, upper limit and bound variable are given by (optional) child elements lowlimit, uplimit and bvar in the enclosing apply element. The integrand is also specified as a child element of the enclosing apply element.

The domain of integration may be specified by using either an interval element or a condition element. In such cases, if a bound variable of integration is intended, it must be specified explicitly. (The condition may involve more than one symbol.)

The int element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The int element is an operator taking qualifiers (see Section 4.2.3.2 Operators taking Qualifiers).

4.4.5.1.2 Examples

This example specifies a lowlimit, uplimit, and bvar.

<apply>
  <int/>
  <bvar>
    <ci> x </ci>
  </bvar>
  <lowlimit>
    <cn> 0 </cn>
  </lowlimit>
  <uplimit>
    <ci> a </ci>
  </uplimit>
  <apply>
    <ci> f </ci>
    <ci> x </ci>
  </apply>
</apply>

This example specifies the domain of integration with an interval element.

<apply>
  <int/>
  <bvar>
    <ci> x </ci>
  </bvar>
  <interval>
    <ci> a </ci>
    <ci> b </ci>
  </interval>
  <apply><cos/>
    <ci> x </ci>
  </apply>
</apply>

The final example specifies the domain of integration with a condition element.

<apply>
  <int/>
  <bvar>
    <ci> x </ci>
  </bvar>
  <condition>
    <apply><in/>
      <ci> x </ci>
      <ci type="set"> D </ci>
    </apply>
  </condition>
  <apply><ci type="fn"> f </ci>
    <ci> x </ci>
  </apply>
</apply>
4.4.5.1.3 Default Rendering

\int_0^a f(x) \,\diffd x

\int_a^b \cos x \,\diffd x

\int_{x \in D} f(x) \,\diffd x

4.4.5.2 Differentiation (diff)

4.4.5.2.1 Discussion

The diff element is the differentiation operator element for functions of a single variable. It may be applied directly to an actual function such as sine or cosine, thereby denoting a function which is the derivative of the original function, or it can be applied to an expression involving a single variable such as sin(x), or cos(x). or a polynomial in x. For the expression case the actual variable is designated by a bvar element that is a child of the containing apply element. The bvar element may also contain a degree element, which specifies the order of the derivative to be taken.

The diff element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The diff element is an operator taking qualifiers (see Section 4.2.3.2 Operators taking Qualifiers).

4.4.5.2.2 Examples

The derivative of a function f (often displayed as f') can be written as:

<apply>
  <diff/>
  <ci> f </ci>
</apply>

The derivative with respect to x of an expression in x such as f (x) can be written as:

<apply>
  <diff/>
  <bvar>
    <ci> x </ci>
  </bvar>
  <apply><ci type="fn"> f </ci>
    <ci> x </ci>
  </apply>
</apply>
4.4.5.2.3 Default Rendering

f\,'

\frac{\diffd f(x)}{\diffd x}

4.4.5.3 Partial Differentiation (partialdiff)

4.4.5.3.1 Discussion

The partialdiff element is the partial differentiation operator element for functions or algebraic expressions in several variables.

In the case of algebraic expressions, the bound variables are given by bvar elements, which are children of the containing apply element. The bvar elements may also contain degree element, which specify the order of the partial derivative to be taken in that variable.

For the expression case the actual variable is designated by a bvar element that is a child of the containing apply element. The bvar elements may also contain a degree element, which specifies the order of the derivative to be taken.

Where a total degree of differentiation must be specified, this is indicated by use of a degree element at the top level, i.e. without any associated bvar, as a child of the containing apply element.

For the case of partial differentiation of a function, the containing apply takes two child elements: firstly a list of indices indicating by position which coordinates are involved in constructing the partial derivatives, and secondly the actual function to be partially differentiated. The coordinates may be repeated.

The partialdiff element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The partialdiff element is an operator taking qualifiers (see Section 4.2.3.2 Operators taking Qualifiers).

4.4.5.3.2 Examples
<apply><partialdiff/>
 <bvar><ci> x </ci><degree><ci> m </ci></degree></bvar>
 <bvar><ci> y </ci><degree><ci> n </ci></degree></bvar>
 <degree><ci> k </ci></degree>
 <apply><ci type="fn"> f </ci>
  <ci> x </ci>
  <ci> y </ci>
 </apply>
</apply>
<apply><partialdiff/>
 <bvar><ci> x </ci></bvar>
 <bvar><ci> y </ci></bvar>
 <apply><ci type="fn"> f </ci>
  <ci> x </ci>
  <ci> y </ci>
 </apply>
</apply>
<apply><partialdiff/>
<list><cn>1</cn><cn>1</cn><cn>3</cn></list>
<ci type="fn">f</ci>
</apply>
4.4.5.3.3 Default Rendering

\left( \frac{\partial ^{k}}{\partial x^{m}\,\partial y^{n}}\right) f(x,y)

\frac{\partial ^{2}}{\partial x\,\partial y}f(x,y)

D_{1,1,3}(f)

4.4.5.4 Lower limit (lowlimit)

4.4.5.4.1 Discussion

The lowlimit element is the container element used to indicate the "lower limit" of an operator using qualifiers. For example, in an integral, it can be used to specify the lower limit of integration. Similarly, it can be used to specify the lower limit of an index for a sum or product.

The meaning of the lowlimit element depends on the context it is being used in. For further details about how qualifiers are used in conjunction with operators taking qualifiers, consult Section 4.2.3.2 Operators taking Qualifiers.

4.4.5.4.2 Example
<apply>
  <int/>
  <bvar>
    <ci> x </ci>
  </bvar>
  <lowlimit>
    <ci> a </ci>
  </lowlimit>
  <uplimit>
    <ci> b </ci>
  </uplimit>
  <apply><ci type="fn"> f </ci>
     <ci> x </ci>
  </apply>
</apply>
4.4.5.4.3 Default Rendering

The default rendering of the lowlimit element and its contents depends on the context. In the preceding example, it should be rendered as a subscript to the integral sign:

\int_a^b f(x) \, \diffd x

Consult the descriptions of individual operators that make use of the lowlimit construct for default renderings.

4.4.5.5 Upper limit (uplimit)

4.4.5.5.1 Discussion

The uplimit element is the container element used to indicate the "upper limit" of an operator using qualifiers. For example, in an integral, it can be used to specify the upper limit of integration. Similarly, it can be used to specify the upper limit of an index for a sum or product.

The meaning of the uplimit element depends on the context it is being used in. For further details about how qualifiers are used in conjunction with operators taking qualifiers, consult Section 4.2.3.2 Operators taking Qualifiers.

4.4.5.5.2 Example
<apply>
  <int/>
  <bvar>
     <ci> x </ci>
  </bvar>
  <lowlimit>
     <ci> a </ci>
  </lowlimit>
  <uplimit>
     <ci> b </ci>
  </uplimit>
  <apply><ci type="fn"> f </ci>
     <ci> x </ci>
  </apply>
</apply>
4.4.5.5.3 Default Rendering

The default rendering of the uplimit element and its contents depends on the context. In the preceding example, it should be rendered as a superscript to the integral sign:

\int_a^b f(x) \, \diffd x

Consult the descriptions of individual operators that make use of the uplimit construct for default renderings.

4.4.5.6 Bound variable (bvar)

4.4.5.6.1 Discussion

The bvar element is the container element for the "bound variable" of an operation. For example, in an integral it specifies the variable of integration. In a derivative, it indicates the variable with respect to which a function is being differentiated. When the bvar element is used to qualify a derivative, the bvar element may contain a child degree element that specifies the order of the derivative with respect to that variable. The bvar element is also used for the internal variable in sums and products and for the bound variable used with the universal and existential quantifiers forall and exists. When a bvar element has more than one child element, the elements may appear in any order.

Instances of the bound variables are normally recognized by comparing the XML information sets of the relevant ci elements after first carrying out XML space normalization. Such identification can be made explicit by placing an id on the ci element in the bvar element and referring to it using the definitionURL attribute on all other instances. An example of this approach is

<set>
  <bvar><ci id="var-x"> x </ci></bvar>
  <condition>
    <apply>
      <lt/>
      <ci definitionURL="#var-x"> x </ci>
      <cn> 1 </cn>
    </apply>
  </condition>
</set>

This id based approach is especially helpful when nested bound variables are involved.

It can be necessary to associate additional information with a bound variable or one or more instances of it. The information might be something like a detailed mathematical type or an alternative presentation or encoding. Such associations are accomplished in the standard way by replacing a ci element (even inside the bvar element) by a semantics element containing both it and the additional information. Recognition of and instance of the bound variable is still based on the actual ci elements and not the semantics elements or anything else they may contain. The id based approach outlined above may still be used.

The meaning of the bvar element depends on the context it is being used in. For further details about how qualifiers are used in conjunction with operators taking qualifiers, consult Section 4.2.3.2 Operators taking Qualifiers.

4.4.5.6.2 Examples
<apply>
  <diff/>
  <bvar>
    <ci> x </ci>
    <degree>
      <cn> 2 </cn>
    </degree>
  </bvar>
  <apply>
    <power/>
    <ci> x </ci>
    <cn> 4 </cn>
  </apply>
</apply>
<apply>
  <int/>
  <bvar><ci> x </ci></bvar>
  <condition>
    <apply><in/><ci> x </ci><ci> D </ci></apply>
  </condition>
  <apply><ci type="fn"> f </ci>
    <ci> x </ci>
  </apply>
</apply>
4.4.5.6.3 Default Rendering

The default rendering of the bvar element and its contents depends on the context. In the preceding examples, it should be rendered as the x in the dx of the integral, and as the x in the denominator of the derivative symbol, respectively:

\frac{\diffd x^4}{\diffd x^2}

\int_{x \in D} f(x) \, \diffd x

Note that in the case of the derivative, the default rendering of the degree child of the bvar element is as an exponent.

Consult the descriptions of individual operators that make use of the bvar construct for default renderings.

4.4.5.7 Degree (degree)

4.4.5.7.1 Discussion

The degree element is the container element for the "degree" or "order" of an operation. There are a number of basic mathematical constructs that come in families, such as derivatives and moments. Rather than introduce special elements for each of these families, MathML uses a single general construct, the degree element for this concept of "order".

The meaning of the degree element depends on the context it is being used in. For further details about how qualifiers are used in conjunction with operators taking qualifiers, consult Section 4.2.3.2 Operators taking Qualifiers.

4.4.5.7.2 Example
<apply>
  <partialdiff/>
  <bvar>
    <ci> x </ci>
    <degree>
      <ci> n </ci>
    </degree>
  </bvar>
  <bvar>
    <ci> y </ci>
    <degree>
      <ci> m </ci>
    </degree>
  </bvar>
  <apply><sin/>
    <apply> <times/>
      <ci> x </ci>
      <ci> y </ci>
    </apply>
  </apply>
</apply>
4.4.5.7.3 Default Rendering

The default rendering of the degree element and its contents depends on the context. In the preceding example, the degree elements would be rendered as the exponents in the differentiation symbols:

\frac{\partial^{n+m}}{\partial x^n \partial y^m} \sin(xy)

Consult the descriptions of individual operators that make use of the degree construct for default renderings.

4.4.5.8 Divergence (divergence)

4.4.5.8.1 Discussion

The divergence element is the vector calculus divergence operator, often called div.

The divergence element takes the attributes encoding and definitionURL that can be used to override the default semantics.

The divergence element is a unary calculus operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.5.8.2 Example
<apply>
  <divergence/>
  <ci> a </ci>
</apply>
4.4.5.8.3 Default Rendering

\mathop{\mathrm{div}} a

4.4.5.9 Gradient (grad)

4.4.5.9.1 Discussion

The grad element is the vector calculus gradient operator, often called grad.

The grad element takes the attributes encoding and definitionURL that can be used to override the default semantics.

The grad element is a unary calculus operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.5.9.2 Example
<apply>
  <grad/>
  <ci> f</ci>
</apply>

Where for example f is a scalar function of three real variables.

4.4.5.9.3 Default Rendering

\mathop{\mathrm{grad}} f

4.4.5.10 Curl (curl)

4.4.5.10.1 Discussion

The curl element is the vector calculus curl operator.

The curl element takes the attributes encoding and definitionURL that can be used to override the default semantics.

The curl element is a unary calculus operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.5.10.2 Example
<apply>
  <curl/>
  <ci> a </ci>
</apply>

Where for example a is a vector field.

4.4.5.10.3 Default Rendering

\mathop{\mathrm{curl}} a

4.4.5.11 Laplacian (laplacian)

4.4.5.11.1 Discussion

The laplacian element is the vector calculus laplacian operator.

The laplacian element takes the attributes encoding and definitionURL that can be used to override the default semantics.

The laplacian element is an unary calculus operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.5.11.2 Example
<apply>
  <eq/>
  <apply><laplacian/>
    <ci> f </ci>
  </apply>
  <apply>
    <divergence/>
    <apply><grad/>
      <ci> f </ci>
    </apply>
  </apply>
</apply>

Where for example f is a scalar function of three real variables.

4.4.5.11.3 Default Rendering

\nabla^2 f

4.4.6 Theory of Sets

4.4.6.1 Set (set)

4.4.6.1.1 Discussion

The set element is the container element that constructs a set of elements. The elements of a set can be defined either by explicitly listing the elements, or by using the bvar and condition elements.

The set element is a constructor element (see Section 4.2.2.2 Constructors).

4.4.6.1.2 Examples
<set>
  <ci> b </ci>
  <ci> a </ci>
  <ci> c </ci>
</set>

This constructs the set {b, a, c}

<set>
  <bvar><ci> x </ci></bvar>
  <condition>
    <apply><and/>
      <apply><lt/>
        <ci> x </ci>
        <cn> 5 </cn>
      </apply>
      <apply><in/>
        <ci> x </ci>
        <naturalnumbers/>
      </apply>
    </apply>
  </condition>
  <ci> x </ci>
</set>

This constructs the set of all natural numbers less than 5, ie. the set {0, 1, 2, 3, 4}

4.4.6.1.3 Default Rendering
  • \{ a, b, c \}

  • \{ x \mid x < 5 \land x \in \mathbb{N} \}

4.4.6.2 List (list)

4.4.6.2.1 Discussion

The list element is the container element that constructs a list of elements. Elements can be defined either by explicitly listing the elements, or by using the bvar and condition elements.

Lists differ from sets in that there is an explicit order to the elements. Two orders are supported: lexicographic and numeric. The kind of ordering that should be used is specified by the order attribute.

The list element is a constructor element (see Section 4.2.2.2 Constructors).

4.4.6.2.2 Examples
<list>
  <ci> a </ci>
  <ci> b </ci>
  <ci> c </ci>
</list>
<list order="numeric">
  <bvar><ci> x </ci></bvar>
  <condition>
    <apply><lt/>
      <ci> x </ci>
      <cn> 5 </cn>
    </apply>
  </condition>
  <ci> x </ci>
</list>
4.4.6.2.3 Default Rendering
  • [ a, b, c ]

  • [ x \mid x < 5 ]

4.4.6.3 Union (union)

4.4.6.3.1 Discussion

The union element is the operator for a set-theoretic union or join of two (or more) sets.

The union element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The union element is an n-ary set operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.6.3.2 Example
<apply>
  <union/>
  <ci> A </ci>
  <ci> B </ci>
</apply>
4.4.6.3.3 Default Rendering

A \cup B

4.4.6.4 Intersect (intersect)

4.4.6.4.1 Discussion

The intersect element is the operator for the set-theoretic intersection or meet of two (or more) sets.

The intersect element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The intersect element is an n-ary set operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.6.4.2 Example
<apply>
  <intersect/>
  <ci type="set"> A </ci>
  <ci type="set"> B </ci>
</apply>
4.4.6.4.3 Default Rendering

A \cap B

4.4.6.5 Set inclusion (in)

4.4.6.5.1 Discussion

The in element is the relational operator used for a set-theoretic inclusion ("is in" or "is a member of").

The in element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The in element is a binary set relation (see Section 4.2.4 Relations).

4.4.6.5.2 Example
<apply>
  <in/>
  <ci> a </ci>
  <ci type="set"> A </ci>
</apply>
4.4.6.5.3 Default Rendering

a \in A

4.4.6.6 Set exclusion (notin)

4.4.6.6.1 Discussion

The notin element is the relational operator element used for set-theoretic exclusion ("is not in" or "is not a member of").

The notin element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The notin element is a binary set relation (see Section 4.2.4 Relations).

4.4.6.6.2 Example
<apply>
  <notin/>
  <ci> a </ci>
  <ci> A </ci>
</apply>
4.4.6.6.3 Default Rendering

a \notin A

4.4.6.7 Subset (subset)

4.4.6.7.1 Discussion

The subset element is the relational operator element for a set-theoretic containment ("is a subset of").

The subset element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The subset element is an n-ary set relation (see Section 4.2.4 Relations).

4.4.6.7.2 Example
<apply>
  <subset/>
  <ci> A </ci>
  <ci> B </ci>
</apply>
4.4.6.7.3 Default Rendering

A \subseteq B

4.4.6.8 Proper Subset (prsubset)

4.4.6.8.1 Discussion

The prsubset element is the relational operator element for set-theoretic proper containment ("is a proper subset of").

The prsubset element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The prsubset element is an n-ary set relation (see Section 4.2.4 Relations).

4.4.6.8.2 Example
<apply>
  <prsubset/>
  <ci> A </ci>
  <ci> B </ci>
</apply>
4.4.6.8.3 Default Rendering

A \subset B

4.4.6.9 Not Subset (notsubset)

4.4.6.9.1 Discussion

The notsubset element is the relational operator element for the set-theoretic relation "is not a subset of".

The notsubset element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The notsubset element is a binary set relation (see Section 4.2.4 Relations).

4.4.6.9.2 Example
<apply>
  <notsubset/>
  <ci> A </ci>
  <ci> B </ci>
</apply>
4.4.6.9.3 Default Rendering

A \not\subset B

4.4.6.10 Not Proper Subset (notprsubset)

4.4.6.10.1 Discussion

The notprsubset element is the operator element for the set-theoretic relation "is not a proper subset of".

The notprsubset takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The notprsubset element is a binary set relation (see Section 4.2.4 Relations).

4.4.6.10.2 Example
<apply>
  <notprsubset/>
  <ci> A </ci>
  <ci> B </ci>
</apply>
4.4.6.10.3 Default Rendering

A \nsubseteq B

4.4.6.11 Set Difference (setdiff)

4.4.6.11.1 Discussion

The setdiff element is the operator element for a set-theoretic difference of two sets.

The setdiff element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The setdiff element is a binary set operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.6.11.2 Example
<apply>
  <setdiff/>
  <ci> A </ci>
  <ci> B </ci>
</apply>
4.4.6.11.3 Default Rendering

A \setminus B

4.4.6.12 Cardinality (card)

4.4.6.12.1 Discussion

The card element is the operator element for the size or cardinality of a set.

The card element takes the attributes definitionURL and encoding that can be used to override the default semantics.

The card element is a unary set operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.6.12.2 Example
<apply>
  <eq/>
  <apply><card/>
    <ci> A </ci>
  </apply>
  <ci> 5 </ci>
</apply>

where A is a set with 5 elements.

4.4.6.12.3 Default Rendering

| A | = 5

4.4.6.13 Cartesian product (cartesianproduct)

4.4.6.13.1 Discussion

The cartesianproduct element is the operator element for the Cartesian product of two or more sets. If A and B are two sets, then the Cartesian product of A and B is the set of all pairs (a,b) with a in A and b in B.

The cartesianproduct element takes the attributes definitionURL and encoding that can be used to override the default semantics.

The cartesianproduct element is a n-ary set operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.6.13.2 Example
  <apply><cartesianproduct/>
    <ci> A </ci>
    <ci> B </ci>
  </apply>
  <apply><cartesianproduct/>
    <reals/>
    <reals/>
    <reals/>
  </apply>
4.4.6.13.3 Default Rendering

A \times B

\mathbb{R} \times \mathbb{R} \times \mathbb{R}

\mathbb{R}^3

4.4.7 Sequences and Series

4.4.7.1 Sum (sum)

4.4.7.1.1 Discussion

The sum element denotes the summation operator. Upper and lower limits for the index of a sum can be specified using uplimit and lowlimit. More general domains for the indices can be specified using a condition involving the bound variables. The index for the summation is specified by a bvar element.

The sum element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The sum element is an operator taking qualifiers (see Section 4.2.3.2 Operators taking Qualifiers).

4.4.7.1.2 Examples
<apply>
  <sum/>
  <bvar>
    <ci> x </ci>
  </bvar>
  <lowlimit>
    <ci> a </ci>
  </lowlimit>
  <uplimit>
    <ci> b </ci>
  </uplimit>
  <apply><ci type="fn"> f </ci>
    <ci> x </ci>
  </apply>
</apply>

<apply>
  <sum/>
  <bvar>
    <ci> x </ci>
  </bvar>
  <condition>
    <apply> <in/>
      <ci> x </ci>
      <ci type="set"> B </ci>
    </apply>
  </condition>
  <apply><ci type="fn"> f </ci>
    <ci> x </ci>
  </apply>
</apply>
4.4.7.1.3 Default Rendering

\sum_{x=a}^b f(x)

\sum_{x \in B} f(x)

4.4.7.2 Product (product)

4.4.7.2.1 Discussion

The product element denotes the product operator. Upper and lower limits for the index of a product can be specified using uplimit and lowlimit. More general domains for the indices can be specified using a condition involving the bound variables. The index for the product is specified by a bvar element.

The product element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The product element is an operator taking qualifiers (see Section 4.2.3.2 Operators taking Qualifiers).

4.4.7.2.2 Examples
<apply>
  <product/>
  <bvar>
    <ci> x </ci>
  </bvar>
  <lowlimit>
    <ci> a </ci>
  </lowlimit>
  <uplimit>
    <ci> b </ci>
  </uplimit>
  <apply><ci type="fn"> f </ci>
    <ci> x </ci>
  </apply>
</apply>

<apply>
  <product/>
  <bvar>
    <ci> x </ci>
  </bvar>
  <condition>
    <apply> <in/>
      <ci> x </ci>
      <ci type="set"> B </ci>
    </apply>
  </condition>
  <apply><ci type="fn"> f </ci>
    <ci> x </ci>
  </apply>
</apply>
4.4.7.2.3 Default Rendering

\prod_{x=a}^b f(x)

\prod_{x \in B} f(x)

4.4.7.3 Limit (limit)

4.4.7.3.1 Discussion

The limit element represents the operation of taking a limit of a sequence. The limit point is expressed by specifying a lowlimit and a bvar, or by specifying a condition on one or more bound variables.

The limit element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The limit element is an operator taking qualifiers (see Section 4.2.3.2 Operators taking Qualifiers).

4.4.7.3.2 Examples
<apply>
  <limit/>
  <bvar>
    <ci> x </ci>
  </bvar>
  <lowlimit>
    <cn> 0 </cn>
  </lowlimit>
  <apply><sin/>
    <ci> x </ci>
  </apply>
</apply>
<apply>
  <limit/>
  <bvar>
    <ci> x </ci>
  </bvar>
  <condition>
    <apply>
      <tendsto type="above"/>
      <ci> x </ci>
      <ci> a </ci>
    </apply>
  </condition>
  <apply><sin/>
     <ci> x </ci>
  </apply>
</apply>
4.4.7.3.3 Default Rendering

\lim_{x \to 0} \sin x

\lim_{x \searrow a} \sin x

4.4.7.4 Tends To (tendsto)

4.4.7.4.1 Discussion

The tendsto element is used to express the relation that a quantity is tending to a specified value. While this is used primarily as part of the statement of a mathematical limit, it exists as a construct on its own to allow one to capture mathematical statements such as "As x tends to y," and to provide a building block to construct more general kinds of limits that are not explicitly covered by the recommendation.

The tendsto element takes the attributes type to set the direction from which the limiting value is approached.

The tendsto element is a binary relational operator (see Section 4.2.4 Relations).

4.4.7.4.2 Examples
<apply>
  <tendsto type="above"/>
  <apply>
    <power/>
    <ci> x </ci>
    <cn> 2 </cn>
  </apply>
  <apply>
    <power/>
    <ci> a </ci>
    <cn> 2 </cn>
  </apply>
</apply>

To express (x, y) \rightarrow(f(x, y), g(x, y)), one might use vectors, as in:

<apply>
  <tendsto/>
  <vector>
     <ci> x </ci>
     <ci> y </ci>
  </vector>
  <vector>
    <apply><ci type="fn"> f </ci>
      <ci> x </ci>
      <ci> y </ci>
    </apply>
    <apply><ci type="fn"> g </ci>
      <ci> x </ci>
      <ci> y </ci>
    </apply>
  </vector>
</apply>
4.4.7.4.3 Default Rendering

x^{2} \searrow a^{2}

(x, y) \rightarrow (f(x, y), g(x, y))

4.4.8 Elementary classical functions

4.4.8.1 common trigonometric functions

The names of the common trigonometric functions supported by MathML are listed below. Since their standard interpretations are widely known, they are discussed as a group.

sin cos tan
sec csc cot
sinh cosh tanh
sech csch coth
arcsin arccos arctan
arccosh arccot arccoth
arccsc arccsch arcsec
arcsech arcsinh arctanh
4.4.8.1.1 Discussion

These operator elements denote the standard trigonometrical functions.

These elements all take the definitionURL and encoding attributes, which can be used to override the default semantics.

They are all unary trigonometric operators. (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.8.1.2 Examples
<apply>
  <sin/>
  <ci> x </ci>
</apply>
<apply>
  <sin/>
  <apply>
    <plus/>
    <apply><cos/>
      <ci> x </ci>
    </apply>
    <apply>
      <power/>
      <ci> x </ci>
      <cn> 3 </cn>
    </apply>
  </apply>
</apply>
4.4.8.1.3 Default Rendering
  • \sin x

  • \sin(\cos x + x^3)

4.4.8.2 Exponential (exp)

4.4.8.2.1 Discussion

The exp element represents the exponential function associated with the inverse of the ln function. In particular, exp(1) is approximately 2.718281828.

The exp element takes the definitionURL and encoding attributes, which may be used to override the default semantics.

The exp element is a unary arithmetic operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.8.2.2 Example
<apply>
  <exp/>
  <ci> x </ci>
</apply>
4.4.8.2.3 Default Rendering

\eulere^x

4.4.8.3 Natural Logarithm (ln)

4.4.8.3.1 Discussion

The ln element represents the natural logarithm function.

The ln element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The ln element is a unary calculus operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.8.3.2 Example
<apply>
  <ln/>
  <ci> a </ci>
</apply>

If a = e, (where e is the base of the natural logarithms) this will yield the value 1.

4.4.8.3.3 Default Rendering

\ln a

4.4.8.4 Logarithm (log)

4.4.8.4.1 Discussion

The log element is the operator that returns a logarithm to a given base. The base may be specified using a logbase element, which should be the first element following log, i.e. the second child of the containing apply element. If the logbase element is not present, a default base of 10 is assumed.

The log element takes the definitionURL and encoding attributes, which can be used to override the default semantics.

The log element can be used as either an operator taking qualifiers or a unary calculus operator (see Section 4.2.3.2 Operators taking Qualifiers).

4.4.8.4.2 Example
<apply>
  <log/>
  <logbase>
    <cn> 3 </cn>
  </logbase>
  <ci> x </ci>
</apply>

This markup represents "the base 3 logarithm of x". For natural logarithms base e, the ln element should be used instead.

4.4.8.4.3 Default Rendering

\log_3 x

4.4.9 Statistics

4.4.9.1 Mean (mean)

4.4.9.1.1 Discussion

mean is the operator element representing a mean or average.

mean takes the definitionURL and encoding attributes, which can be used to override the default semantics.

4.4.9.1.2 Example

mean is an n-ary operator (see Section 4.2.3 Functions, Operators and Qualifiers).

<apply>
  <mean/>
  <ci> X </ci>
</apply>
4.4.9.1.3 Default Rendering

\bar{X} or \langle X \rangle

4.4.9.2 Standard Deviation (sdev)

4.4.9.2.1 Discussion

sdev is the operator element representing the statistical standard deviation operator.

sdev takes the definitionURL and encoding attributes, which can be used to override the default semantics.

4.4.9.2.2 Example

sdev is an n-ary operator (see Section 4.2.3 Functions, Operators and Qualifiers).

<apply>
  <sdev/>
  <ci> X </ci>
</apply>
4.4.9.2.3 Default Rendering

\sigma(X)

4.4.9.3 Variance (variance)

4.4.9.3.1 Discussion

variance is the operator element representing the statistical variance operator.

variance takes the definitionURL and encoding attributes, which can be used to override the default semantics.

4.4.9.3.2 Example

variance is an n-ary operator (see Section 4.2.3 Functions, Operators and Qualifiers).

<apply>
  <variance/>
  <ci> X </ci>
</apply>
4.4.9.3.3 Default Rendering

\sigma(X)^2

4.4.9.4 Median (median)

4.4.9.4.1 Discussion

median is the operator element representing the statistical median operator.

median takes the definitionURL and encoding attributes, which can be used to override the default semantics.

4.4.9.4.2 Example

median is an n-ary operator (see Section 4.2.3 Functions, Operators and Qualifiers).

<apply>
  <median/>
  <ci> X </ci>
</apply>
4.4.9.4.3 Default Rendering

\mathrm{median}(X)

4.4.9.5 Mode (mode)

4.4.9.5.1 Discussion

mode is the operator element representing the statistical mode operator.

mode takes the definitionURL and encoding attributes, which can be used to override the default semantics.

4.4.9.5.2 Example

mode is an n-ary operator (see Section 4.2.3 Functions, Operators and Qualifiers).

<apply>
  <mode/>
  <ci> X </ci>
</apply>
4.4.9.5.3 Default Rendering

\mathrm{mode}(X)

4.4.9.6 Moment (moment)

4.4.9.6.1 Discussion

The moment element represents the statistical moment operator. Use the qualifier degree for the n in " n-th moment". Use the qualifier momentabout for the p in "moment about p".

moment takes the definitionURL and encoding attributes, which can be used to override the default semantics.

4.4.9.6.2 Example

moment is an operator taking qualifiers (see Section 4.2.3.2 Operators taking Qualifiers). The third moment of the distribution X about the point p is written:

<apply>
  <moment/>
  <degree>
    <cn> 3 </cn>
  </degree>
  <momentabout>
    <ci> p </ci>
  </momentabout>
  <ci> X </ci>
</apply>
4.4.9.6.3 Default Rendering

\langle X^3 \rangle

4.4.9.7 Point of Moment (momentabout)

4.4.9.7.1 Discussion

The momentabout element is a qualifier element used with the moment element to represent statistical moments. Use the qualifier momentabout for the p in "moment about p".

momentabout takes the definitionURL and encoding attributes, which can be used to override the default semantics.

4.4.9.7.2 Example

The third moment of the distribution X about the point p is written:

<apply>
  <moment/>
  <degree>
    <cn> 3 </cn>
  </degree>
  <momentabout>
    <ci> p </ci>
  </momentabout>
  <ci> X </ci>
</apply>
4.4.9.7.3 Default Rendering

\langle X^3 \rangle

4.4.10 Linear Algebra

4.4.10.1 Vector (vector)

4.4.10.1.1 Discussion

vector is the container element for a vector. The child elements form the components of the vector.

For purposes of interaction with matrices and matrix multiplication, vectors are regarded as equivalent to a matrix consisting of a single column, and the transpose of a vector behaves the same as a matrix consisting of a single row. Note that vectors may be rendered either as a single column or row.

4.4.10.1.2 Example

vector is a constructor element (see Section 4.2.2.2 Constructors).

<vector>
  <cn> 1 </cn>
  <cn> 2 </cn>
  <cn> 3 </cn>
  <ci> x </ci>
</vector>
4.4.10.1.3 Default Rendering

\left(\begin{array}{c} 1 \\ 2 \\ 3 \\ x \end{array} \right)

(1, 2, 3, x)

4.4.10.2 Matrix (matrix)

4.4.10.2.1 Discussion

The matrix element is the container element for matrix rows, which are represented by matrixrow. The matrixrows contain the elements of a matrix.

4.4.10.2.2 Example

matrix is a constructor element (see Section 4.2.2.2 Constructors).

<matrix>
  <matrixrow>
    <cn> 0 </cn> <cn> 1 </cn> <cn> 0 </cn>
  </matrixrow>
  <matrixrow>
    <cn> 0 </cn> <cn> 0 </cn> <cn> 1 </cn>
  </matrixrow>
  <matrixrow>
    <cn> 1 </cn> <cn> 0 </cn> <cn> 0 </cn>
  </matrixrow>
</matrix>
4.4.10.2.3 Default Rendering

A = \left(\begin{array}{ccc} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 1 & 0 & 0 \end{array} \right)

4.4.10.3 Matrix row (matrixrow)

4.4.10.3.1 Discussion

The matrixrow element is the container element for the rows of a matrix.

4.4.10.3.2 Example

matrixrow is a constructor element (see Section 4.2.2.2 Constructors).

<matrixrow>
  <cn> 1 </cn>
  <cn> 2 </cn>
</matrixrow>
<matrixrow>
  <cn> 3 </cn>
  <ci> x </ci>
</matrixrow>
4.4.10.3.3 Default Rendering

Matrix rows are not directly rendered by themselves outside of the context of a matrix.

4.4.10.4 Determinant (determinant)

4.4.10.4.1 Discussion

The determinant element is the operator for constructing the determinant of a matrix.

determinant takes the definitionURL and encoding attributes, which can be used to override the default semantics.

4.4.10.4.2 Example

determinant is a unary operator (see Section 4.2.3 Functions, Operators and Qualifiers).

<apply>
  <determinant/>
  <ci type="matrix"> A </ci>
</apply>
4.4.10.4.3 Default Rendering

\det A

4.4.10.5 Transpose (transpose)

4.4.10.5.1 Discussion

The transpose element is the operator for constructing the transpose of a matrix.

transpose takes the definitionURL and encoding attributes, which can be used to override the default semantics.

4.4.10.5.2 Example

transpose is a unary operator (see Section 4.2.3 Functions, Operators and Qualifiers).

<apply>
  <transpose/>
  <ci type="matrix"> A </ci>
</apply>
4.4.10.5.3 Default Rendering

A^{\mathrm{T}}

4.4.10.6 Selector (selector)

4.4.10.6.1 Discussion

The selector element is the operator for indexing into vectors matrices and lists. It accepts one or more arguments. The first argument identifies the vector, matrix or list from which the selection is taking place, and the second and subsequent arguments, if any, indicate the kind of selection taking place.

When selector is used with a single argument, it should be interpreted as giving the sequence of all elements in the list, vector or matrix given. The ordering of elements in the sequence for a matrix is understood to be first by column, then by row. That is, for a matrix ( ai,j), where the indices denote row and column, the ordering would be a 1,1, a 1,2, ... a 2,1, a2,2 ... etc.

When three arguments are given, the last one is ignored for a list or vector, and in the case of a matrix, the second and third arguments specify the row and column of the selected element.

When two arguments are given, and the first is a vector or list, the second argument specifies an element in the list or vector. When a matrix and only one index i is specified as in

<apply>
  <selector/>
  <matrix>
    <matrixrow>
      <cn> 1 </cn> <cn> 2 </cn>
    </matrixrow>
    <matrixrow>
      <cn> 3 </cn> <cn> 4 </cn>
    </matrixrow>
  </matrix>
  <cn> 1 </cn>
</apply>

it refers to the i-th matrixrow. Thus, the preceding example selects the following row:

<matrixrow> <cn> 1 </cn> <cn> 2 </cn> </matrixrow>

selector takes the definitionURL and encoding attributes, which can be used to override the default semantics.

selector is classified as an n-ary linear algebra operator even though it can take only one, two, or three arguments.

4.4.10.6.2 Example
<apply>
  <selector/>
  <ci type="matrix"> A </ci>
  <cn> 3 </cn>
  <cn> 2 </cn>
</apply>
4.4.10.6.3 Default Rendering

The selector construct renders in a manner that indicates which sub-element of the parent object is selected. For vectors and matrices this is normally done by specifying the parent object together with subscripted indices. For example, the selection

<apply>
  <selector/>
  <ci type="vector">V</ci>
  <cn> 1 </cn>
</apply>

would have a default rendering of

V_1

Selecting the (1,2) element of a 2 by 2 matrix would have a default rendering as

{\left[\begin{array}{cc}1&2\\3&4\end{array}\right]}_{1,2}

4.4.10.7 Vector product (vectorproduct)

4.4.10.7.1 Discussion

The vectorproduct is the operator element for deriving the vector product of two vectors.

The vectorproduct element takes the attributes definitionURL and encoding that can be used to override the default semantics.

The vectorproduct element is a binary vector operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.10.7.2 Example
<apply>
  <eq/>
  <apply><vectorproduct/>
    <ci type="vector"> A </ci>
    <ci type="vector"> B </ci>
  </apply>
  <apply><times/>
    <ci> a </ci>
    <ci> b </ci>
    <apply><sin/>
      <ci> &theta; </ci>
    </apply>
    <ci type="vector"> N </ci>
  </apply>
</apply>

where A and B are vectors, N is a unit vector orthogonal to A and B, a, b are the magnitudes of A, B and \thetais the angle between A and B.

4.4.10.7.3 Default Rendering

A \times B = a b \sin\theta N

4.4.10.8 Scalar product (scalarproduct)

4.4.10.8.1 Discussion

The scalarproduct is the operator element for deriving the scalar product of two vectors.

The scalarproduct element takes the attributes definitionURL and encoding that can be used to override the default semantics.

The scalarproduct element is a binary vector operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.10.8.2 Example
<apply>
  <eq/>
  <apply><scalarproduct/>
    <ci type="vector"> A </ci>
    <ci type="vector">B </ci>
  </apply>
  <apply><times/>
    <ci> a </ci>
    <ci> b </ci>
    <apply><cos/>
      <ci> &theta; </ci>
    </apply>
  </apply>
</apply>

where A and B are vectors, a, b are the magnitudes of A, B and \thetais the angle between A and B.

4.4.10.8.3 Default Rendering

A.B

4.4.10.9 Outer product (outerproduct)

4.4.10.9.1 Discussion

The outerproduct is the operator element for deriving the outer product of two vectors.

The outerproduct element takes the attributes definitionURL and encoding that can be used to override the default semantics.

The outerproduct element is a binary vector operator (see Section 4.2.3 Functions, Operators and Qualifiers).

4.4.10.9.2 Example
<apply>
  <outerproduct/>
  <ci type="vector">A</ci>
  <ci type="vector">B</ci>
</apply>

where A and B are vectors.

4.4.10.9.3 Default Rendering

A.B

4.4.11 Semantic Mapping Elements

This section explains the use of the semantic mapping elements semantics, annotation and annotation-xml.

4.4.11.1 Annotation (annotation)

4.4.11.1.1 Discussion

The annotation element is the container element for a semantic annotation in a non-XML format.

The annotation element takes the attributes definitionURL and encoding that can be used to override the default semantics. Only the encoding attribute is required whenever the semantics remains unchanged.

4.4.11.1.2 Example

The annotation element is a semantic mapping element. It is always used with semantics.

<semantics>
  <apply>
    <plus/>
    <apply><sin/>
      <ci> x </ci>
    </apply>
    <cn> 5 </cn>
  </apply>
  <annotation encoding="TeX">
    \sin x + 5
  </annotation>
</semantics>
4.4.11.1.3 Default Rendering

None. The information contained in annotations may optionally be used by a renderer able to process the kind of annotation given.

4.4.11.2 Semantics (semantics)

4.4.11.2.1 Discussion

The semantics element is the container element that associates additional representations with a given MathML construct. The semantics element has as its first child the expression being annotated, and the subsequent children are the annotations. There is no restriction on the kind of annotation that can be attached using the semantics element. For example, one might give a TEX encoding, computer algebra input, or even detailed mathematical type information in an annotation. A definitionURL attribute is used on the annotation to indicate when the semantics of an annotation differs significantly from that of the original expression.

The representations that are XML based are enclosed in an annotation-xml element while those representations that are to be parsed as PCDATA are enclosed in an annotation element.

The semantics element takes the definitionURL and encoding attributes, which can be used to reference an external source for some or all of the semantic information.

An important purpose of the semantics construct is to associate specific semantics with a particular presentation, or additional presentation information with a content construct. The default rendering of a semantics element is the default rendering of its first child. When a MathML-presentation annotation is provided, a MathML renderer may optionally use this information to render the MathML construct. This would typically be the case when the first child is a MathML content construct and the annotation is provided to give a preferred rendering differing from the default for the content elements.

Use of semantics to attach additional information in-line to a MathML construct can be contrasted with use of the csymbol for referencing external semantics. See Section 4.4.1.3 Externally defined symbol (csymbol)

4.4.11.2.2 Examples

The semantics element is a semantic mapping element.

<semantics>
  <apply>
    <plus/>
    <apply>
      <sin/>
      <ci> x </ci>
    </apply>
    <cn> 5 </cn>
  </apply>
  <annotation encoding="Maple">
    sin(x) + 5
  </annotation>
  <annotation-xml encoding="MathML-Presentation">
    ...
    ...
  </annotation-xml>
  <annotation encoding="Mathematica">
    Sin[x] + 5
  </annotation>
  <annotation encoding="TeX">
    \sin x + 5
  </annotation>
  <annotation-xml encoding="OpenMath">
    <OMA xmlns="http://www.openmath.org/OpenMath">
	  <OMS cd="transc1" name="sin"/>
	  <OMI>5</OMI>
    </OMA>
  </annotation-xml>
</semantics>
4.4.11.2.3 Default Rendering

The default rendering of a semantics element is the default rendering of its first child.

4.4.11.3 XML-based annotation (annotation-xml)

4.4.11.3.1 Discussion

The annotation-xml container element is used to contain representations that are XML based. It is always used together with the semantics element.

The annotation-xml element takes the attributes definitionURL and encoding that can be used to override the default semantics. Only the encoding attribute is required whenever the semantics remains unchanged.

annotation-xml is a semantic mapping element.

4.4.11.3.2 Example
<semantics>
  <apply>
    <plus/>
    <apply><sin/>
      <ci> x </ci>
    </apply>
    <cn> 5 </cn>
  </apply>
  <annotation-xml encoding="OpenMath">
    <OMA xmlns="http://www.openmath.org/OpenMath">
      <OMS name="plus" cd="arith1"/>
      <OMA><OMS name="sin" cd="transc1"/>
        <OMV name="x"/>
      </OMA>
      <OMI>5</OMI>
    </OMA>
  </annotation-xml>
</semantics>

See also the discussion of semantics above.

4.4.11.3.3 Default Rendering

None. The information may optionally be used by a renderer able to process the kind of annotation given.

4.4.12 Constant and Symbol Elements

This section explains the use of the Constant and Symbol elements.

4.4.12.1 integers (integers)

4.4.12.1.1 Discussion

integers represents the set of all integers.

4.4.12.1.2 Example
<apply>
  <in/>
  <cn type="integer"> 42 </cn>
  <integers/>
</apply>
4.4.12.1.3 Default Rendering

42 \in \mathbb{Z}

4.4.12.2 reals (reals)

4.4.12.2.1 Discussion

reals represents the set of all real numbers.

4.4.12.2.2 Example
<apply>
  <in/>
  <cn type="real"> 44.997 </cn>
  <reals/>
</apply>
4.4.12.2.3 Default Rendering

44.997 \in \mathbb{R}

4.4.12.3 Rational Numbers (rationals)

4.4.12.3.1 Discussion

rationals represents the set of all rational numbers.

4.4.12.3.2 Example
<apply>
  <in/>
  <cn type="rational"> 22 <sep/>7</cn>
  <rationals/>
</apply>
4.4.12.3.3 Default Rendering

22/7 \in \mathbb{Q}

4.4.12.4 Natural Numbers (naturalnumbers)

4.4.12.4.1 Discussion

naturalnumbers represents the set of all natural numbers, ie. non-negative integers.

4.4.12.4.2 Example
<apply>
  <in/>
  <cn type="integer">1729</cn>
  <naturalnumbers/>
</apply>
4.4.12.4.3 Default Rendering

1729 \in \mathbb{N}

4.4.12.5 complexes (complexes)

4.4.12.5.1 Discussion

complexes represents the set of all complex numbers, i.e. numbers which may have a real and an imaginary part.

4.4.12.5.2 Example
<apply>
  <in/>
  <cn type="complex-cartesian">17<sep/>29</cn>
  <complexes/>
</apply>
4.4.12.5.3 Default Rendering

17+29\ii \in \mathbb{C}

4.4.12.6 primes (primes)

4.4.12.6.1 Discussion

primes represents the set of all natural prime numbers, i.e. integers greater than 1 which have no positive integer factor other than themselves and 1.

4.4.12.6.2 Example
<apply>
  <in/>
  <cn type="integer">17</cn>
  <primes/>
</apply>
4.4.12.6.3 Default Rendering

17 \in \mathbb{P}

4.4.12.7 Exponential e (exponentiale)

4.4.12.7.1 Discussion

exponentiale represents the mathematical constant which is the exponential base of the natural logarithms, commonly written e. It is approximately 2.718281828..

4.4.12.7.2 Example
<apply> <eq/>
  <apply>
    <ln/>
    <exponentiale/>
  </apply>
  <cn>1</cn>
</apply>
4.4.12.7.3 Default Rendering

\ln \eulere = 1

4.4.12.8 Imaginary i (imaginaryi)

4.4.12.8.1 Discussion

imaginaryi represents the mathematical constant which is the square root of -1, commonly written i.

4.4.12.8.2 Example
<apply> <eq/>
  <apply>
    <power/>
    <imaginaryi/>
    <cn>2</cn>
  </apply>
  <cn>-1</cn>
</apply>
4.4.12.8.3 Default Rendering

\ii^2 = -1

4.4.12.9 Not A Number (notanumber)

4.4.12.9.1 Discussion

notanumber represents the result of an ill-defined floating point operation, sometimes also called NaN.

4.4.12.9.2 Example
<apply> <eq/>
  <apply>
    <divide/>
    <cn>0</cn>
    <cn>0</cn>
  </apply>
  <notanumber/>
</apply>
4.4.12.9.3 Default Rendering

0/0 = \mbox{NaN}

4.4.12.10 True (true)

4.4.12.10.1 Discussion

true represents the logical constant for truth.

4.4.12.10.2 Example
<apply> <eq/>
  <apply>
    <or/>
    <true/>
    <ci type = "logical">P</ci>
  </apply>
  <true/>
</apply>
4.4.12.10.3 Default Rendering

\mbox{true} \lor\ P = \mbox{true}

4.4.12.11 False (false)

4.4.12.11.1 Discussion

false represents the logical constant for falsehood.

4.4.12.11.2 Example
<apply> <eq/>
  <apply>
    <and/>
    <false/>
    <ci type = "logical">P</ci>
  </apply>
  <false/>
</apply>
4.4.12.11.3 Default Rendering

\mbox{false} \land\ P = \mbox{false}

4.4.12.12 Empty Set (emptyset)

4.4.12.12.1 Discussion

emptyset represents the empty set.

4.4.12.12.2 Example
  <apply>
    <neq/>
    <integers/>
    <emptyset/>
  </apply>
  
4.4.12.12.3 Default Rendering

\mathbb{Z} \neq \emptyset

4.4.12.13 pi (pi)

4.4.12.13.1 Discussion

pi represents the mathematical constant which is the ratio of a circle's circumference to its diameter, approximately 3.141592653.

4.4.12.13.2 Example
  <apply>
    <approx/>
    <pi/>
    <cn type = "rational">22<sep/>7</cn>
  </apply>
  
4.4.12.13.3 Default Rendering

\pi \approx 22/7

4.4.12.14 Euler gamma (eulergamma)

4.4.12.14.1 Discussion

eulergamma represents Euler's constant, approximately 0.5772156649

4.4.12.14.2 Example
  <eulergamma/>
4.4.12.14.3 Default Rendering

\gamma

4.4.12.15 infinity (infinity)

4.4.12.15.1 Discussion

infinity represents the concept of infinity. Proper interpretation depends on context.

4.4.12.15.2 Example
  <infinity/>
4.4.12.15.3 Default Rendering

\infty

Overview: Mathematical Markup Language (MathML) Version 2.0 (2nd Edition)
Previous: 3 Presentation Markup
Next: 5 Combining Presentation and Content Markup