Home > Web Front-end > HTML Tutorial > MathML example in HTML5

MathML example in HTML5

PHPz
Release: 2023-09-16 09:29:09
forward
984 people have browsed it

MathML example in HTML5

In the following article, we will learn examples of MathML in HTML5. HTML tags and MathML tags have a lot in common. Similar to how HTML tags are used to specify titles and paragraphs, MathML uses tags to describe the various components of a mathematical equation.

The mathematical markup language is called MathML. It uses XML to describe mathematical symbols and capture their structure and content. It is mainly used to embed mathematical formulas into websites. MathML makes it possible to publish scientific and mathematical knowledge online.

MathML can be used

  • MathML can be used as an alternative to matrix form.

  • MathML can represent partial differential equations.

  • MathML can represent chemical reaction equations.

is translated as:
S.NoS.No Tags and Usage
1

The translation of this sentence is: it is used for variable

2

It is used for numeric values ​​

3

It is used for mathematical operators

4

It is used to group MathML elements into a single unit

Let’s look at some examples to better understand MathML

The Chinese translation of

Example 1

is:

Example 1

In the following example, we print a2= b2= c2

<!DOCTYPE html>
<html>
<body>
   <math>
      <mrow>
         <msup><mi>a</mi><mn>2</mn></msup>
         <mo>=</mo>
         <msup><mi>b</mi><mn>2</mn></msup>
      </mrow>
         <mo>=</mo>
         <msup><mi>c</mi><mn>2</mn></msup>
      </mrow>
   </math>
</body>
</html>
Copy after login

When the script executes, it will generate an output that displays the mathematical expression we created in the above script on a web page.

Example 2: Using MathML characters

In the example below, we follow the marking using characters and invisible time.

<!doctype html>
<html>
<body>
   <math>
      <mrow>
         <msup>
            <mi>x</mi>
            <mn>2</mn>
         </msup>
      <mo>+</mo>
      <mrow>
         <mn>4</mn>
         <mo>⁢</mo>
         <mi>x</mi>
      </mrow>
         <mo>+</mo>
         <mn>4</mn>
      </mrow>
         <mo>=</mo>
         <mn>0</mn>
      </mrow>
   </math>
</body>
</html>
Copy after login

When you run the above script, it will generate an output containing the mathematical expression "x2 4x 4 = 0" obtained by using MathML on the web page.

The Chinese translation of

Example 3

is:

Example 3

In the example below, we are creating a mathematical expression Σ n = 1.

<!DOCTYPE html>
<html>
<body>
   <math>
      <mrow>
         <munderover>
         <mo>Σ</mo>
         <mrow>
         <mi>n</mi>
         <mo>=</mo>
         <mn>1</mn>
      </mrow>
   </math>
</body>
</html>
Copy after login

When the user tries to execute the script, it displays the mathematical expression Σ n = 1 generated using MathML on the web page.

The Chinese translation of

Example 4

is:

Example 4

Below we will generate a mathematical expression a2 b2 = c2.

<!DOCTYPE html>
<html>
<body>
   <math>
      <mrow>
         <msup><mi>a</mi><mn>2</mn></msup>
         <mo>+</mo>

         <msup><mi>b</mi><mn>2</mn></msup>
         <mo> = </mo>

         <msup><mi>c</mi><mn>2</mn></msup>
      </mrow>
   </math>
</body>
</html>
Copy after login

When the script is executed, it will generate an output consisting of the mathematical expression "a2 b2 = c2" generated using MathML on the web page.

The above is the detailed content of MathML example in HTML5. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template