XML technologies / MathML / Content markup / Constructor elements / Piecewise declarations

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

Piecewise declarations are used in mathematics to describe a function that has a different definition in different intervals. In content markup, piecewise declarations are represented using the three constructor elements: piecewise, piece, and otherwise. The entire declaration is enclosed in a single piecewise element, and each piece of the declaration is enclosed in a separate piece element. Each piece element takes two child elements: the first one gives the value and the second argument gives the condition or interval in which that value is taken. That is, it has the form:

<piecewise>
  <piece> value condition </piece>
    ....
  <piece> value condition </piece>
  <otherwise> value </otherwise>
</piecewise>

Each occurrence of value and condition is itself indicated by other content elements. For example, the definition of the absolute function and its representation in content markup are shown below:

Piecewise declarations

<piecewise>
  <piece>
    <apply><minus/><ci>x</ci></apply>
    <apply><lt/><ci>x</ci><cn>0</cn></apply>
  </piece>
  <piece>
    <cn>0</cn>
    <apply><eq/><ci>x</ci><cn>0</cn></apply>
  </piece>
  <otherwise>
    <ci>x</ci>
  </otherwise>
</piecewise>

   

 

 

 

 

back to top