# Relations

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

Several content elements have been defined for representing various types of arithmetic and logical relations, such as *a = b* or *x < y*. You express a relation in content markup by using a relational content element as the first argument of an apply element. You do it this way because you can think of a relational expression as the result of applying a function to a set of arguments. The result of applying the function is one of the logical values, True or False.

The following content elements represent the common types of relational operators: eq, neq, gt, lt, geq, leq, equivalent, approx, factorof, implies, and tendsto.

Here is an example of a simple equality:

*2 + 2 = 4*

```
<apply>
<eq/>
<apply>
<plus/>
<cn>2</cn>
<cn>2</cn>
</apply>
<cn>4</cn>
</apply>
```

The number of child elements in the apply element is determined by the type of relational element that occurs as the first argument. Some relational elements such as neq act as binary operators since they always express a relation between two quantities. Other relational elements such as eq, leq, lt, gt, and geq act as *n*-ary operators; that is, they can be followed by an arbitrary number of elements to express compound relations, such as in the markup below:

*a < b < c < d*

```
<apply>
<lt/>
<ci>a</ci>
<ci>b</ci>
<ci>c</ci>
<ci>d</ci>
</apply>
```

**Copyright © CHARLES RIVER MEDIA, INC., Massachusetts (USA) 2003**

Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "The MathML Handbook" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.

CHARLES RIVER MEDIA, INC., 20 Downer Avenue, Suite 3, Hingham, Massachusetts 02043, United States of America