XML technologies / MathML / Content markup / Operators and functions / Elementary functions

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

Several content elements represent classical elementary functions, such as the exponential and logarithmic functions as well as the trigonometric and hyperbolic functions. Here is an example involving the exponential and natural logarithmic functions:

Elementary functions: equation 1

<apply>
  <eq/>
  <apply>
    <ln/>
    <apply>
      <exp/>
      <ci>x</ci>
    </apply>
  </apply>
  <ci>x</ci>
</apply>

The log element is used to represent the natural logarithmic function. You can use the qualifier element logbase to specify the base of the logarithm. If no logbase element is present, a default value of 10 is assumed for the base, as shown here:

log2(x)

<apply>
  <log/>
  <logbase><cn>2</cn></logbase>
  <ci>x</ci>
</apply>

Here is an example of a simple trigonometric formula:

Elementary functions: equation 3

<apply>
  <eq/>
  <apply>
    <sin/>
    <apply>
      <times/>
      <cn>2</cn>
      <ci>x</ci>
    </apply>
  </apply>
  <apply>
    <times/>
    <cn>2</cn>
    <apply>
      <sin/>
      <ci>x</ci>
    </apply>
    <apply>
      <cos/>
      <ci>x</ci>
    </apply>
  </apply>
</apply>

   

 

 

 

 

back to top