W3C home > Mailing lists > Public > www-math@w3.org > July 2000

Content markups, piecewise functions, conditions

From: Gérald QUINTANA <quintana@lyon.objectif.fr>
Date: Tue, 11 Jul 2000 17:45:18 +0200
Message-ID: <006101bfeb4f$04cf4720$16e46ac1@lyon.objectif.fr>
To: <www-math@w3.org>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 20 February 2010 06:12:49 GMT