Operators

The MathML <mo> element is used to specify an operator on a web page. It can specify any type of operator for example: =, +, ?, ?, and even parentheses and commas.

Let’s take an expression to deploy an operator.

3 x – 2 y

Equivalent code:

  1. <math xmlns=’http://www.w3.org/1998/Math/MathML’ display=’block’ >  
  2.   <mn>3</mn>  
  3.   <mi>x</mi>  
  4.   <mo></mo>  
  5.   <mn>2</mn>  
  6.   <mi>y</mi>  
  7. </math>  

Note: Traditional typography differentiates hyphens from minus signs, which are longer. In the above HTML code, we used a hyphen, but since we put it in an element, the browser read it as a minus sign.

Mathml Operators 1

Operator Entities

Operator entities are used to represent special symbols like minus signs, less than, greater than etc. HTML offers several character entities dedicated to mathematics. A list of most common operators:

IndexSymbolEntityHexDescription
1)?Subtraction
2)*××Multiplication
3)/÷÷Division
4)Not equal
5)Approximately equal
6)<<<Less than
7)Less than or equal
8)>>>Greater than
9)Greater than or equal
10)±±±Plus or minus

The operator entities are generally used as the content of an element:

Example:

Let’s take an example to see the use of operators in MathML.

See this equation: 5 x – 4 y ? 0

Equivalent code:

  1. <math xmlns=’http://www.w3.org/1998/Math/MathML’ display=’block’>  
  2.   <mn>5</mn>  
  3.   <mi>x</mi>  
  4.   <mo></mo>  
  5.   <mn>4</mn>  
  6.   <mi>y</mi>  
  7.   <mo></mo>  
  8.   <mn>0</mn>  
  9. </math>  

Supporting Browsers:

Elementchrome browser Chromeie browser IEfirefox browser Firefox (Gecko)opera browser Operasafari browser Safari
<mo>Not SupportedNot SupportedSupportedNot SupportedOnly Basic Support

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *