XML-Technologien / MathML / Content markup / Constructor elements / The lambda element

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

The lambda element is used to represent the concept of a lambda function, used in calculus. The lambda calculus provides a formal syntax for specifying a statement of the form "let f be a function that takes x to x2". A typical notation for the above statement looks like The lambda element: equation 1.

In content markup, the concept of a lambda function is expressed using the lambda element. A function having n variables is specified using a lambda element with n + 1 child elements. Each of the first n child elements is a bvar element that represents one of the variables of the function. The (n + 1)th element is an expression that defines the function itself. Here is an example:

The lambda element: equation 1

<lambda>
  <bvar>
    <ci>x</ci>
  </bvar>
  <apply>
    <power/>
    <ci>x</ci>
    <cn>2</cn>
  </apply>
</lambda>

The following markup uses the declare and lambda elements to construct a function f for which The lambda element: equation 2:

<declare type="fn">
  <ci> f </ci>
  <lambda>
    <bvar><ci>x</ci></bvar>
    <bvar><ci>y</ci></bvar>
    <apply>
      <plus/>
      <apply>
        <power/>
        <ci>x</ci>
        <cn>2</cn>
      </apply>
      <apply>
        <power/>
        <ci>y</ci>
        <cn>2</cn>
      </apply>
      <apply>
        <times/>
        <ci>x</ci>
        <cn>y</cn>
      </apply>
    </apply>
  </lambda>
</declare>

   

 

 

 

 

nach oben