Content markups, piecewise functions, conditions

Hi,

I am thinking about how I could code a piecewise function using
content markups. I need content markups because I aim at making a small
MathML "parser-compiler". I didn't understood exactly how conditions were
working. So as to code the sign function (returns -1 when x<0, 0 when x=0
and +1 when x>0) what do you think of this ? How can I tell that those 3
definitions belongs to the same function ?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE math SYSTEM "file://localhost/S:/java/xerces/mathml/mathml.dtd" >
<math>
  <!--If x<0 then -1-->
  <lambda>
    <bvar>
      <ci>x</ci>
    </bvar>
    <apply>
      <bvar>
        <ci>x</ci>
      </bvar>
      <condition>
        <reln>
          <lt/>
          <ci>x</ci>
          <cn>0</cn>
        </reln>
      </condition>
      <apply>
        <minus/>
        <cn>1</cn>
      </apply>
    </apply>
  </lambda>
  <!--If x=0 then 0-->
  <lambda>
    <bvar>
      <ci>x</ci>
    </bvar>
    <apply>
      <bvar>
        <ci>x</ci>
      </bvar>
      <condition>
        <reln>
          <eq/>
          <ci>x</ci>
          <cn>0</cn>
        </reln>
      </condition>
      <cn>0</cn>
    </apply>
  </lambda>
  <!--If x>0 then +1-->
  <lambda>
    <bvar>
      <ci>x</ci>
    </bvar>
    <apply>
      <bvar>
        <ci>x</ci>
      </bvar>
      <condition>
        <reln>
          <eq/>
          <ci>x</ci>
          <cn>0</cn>
        </reln>
      </condition>
      <cn>1</cn>
    </apply>
  </lambda>
</math>

Thanks for your help,
Gerald.


________________________________
Gérald QUINTANA
  gerald.quintana@ecl2000.ec-lyon.fr
  http://www.multimania.com/gquintana

Received on Tuesday, 11 July 2000 11:44:08 UTC