# Arithmetic, algebra, and logic

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

Several content elements represent common operators and functions used in arithmetic, algebra, and logic. For example, the plus, minus, divide, and times elements represent the basic arithmetic operations of addition, subtraction, division, and multiplication, respectively.

The power and root elements are used to represent taking a power or root. You can encode a fractional power using either of these elements, but the default rendering is typically different in each case. For example, you could encode the cube root of x using the power element as shown here (this element is followed by two child elements, the first of which represents the base and the second the power):

```
<apply>
<power/>
<ci>x</ci>
<cn type="rational">1<sep/>3</cn>
</apply>
```

Alternatively, you can use the root element to encode the same expression. By default, this would be rendered with a radical sign around the base expression. The first element following the root element is the qualifier element degree, which specifies the kind of root. It must contain the number 2 for square roots, 3 for cube roots, and so on. If no degree element is specified, a default value of 2 is assumed. Here is the relevant markup:

```
<apply>
<root/>
<degree><cn>3</cn></degree>
<ci>x</ci>
</apply>
```

Here are some other important content elements:

- The factorial element is used to represent the factorial of a number.
- The real and imaginary elements represent the real and imaginary parts of a complex number.
- The and, or, xor, and not elements represent the corresponding operators in Boolean logic.

<< back | next >> |

**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