- From: Stan Devitt <jsdevitt@radicalflow.com>
- Date: Tue, 11 Jul 2000 17:53:43 -0400
- To: Gérald QUINTANA <quintana@lyon.objectif.fr>, <www-math@w3.org>
- Message-ID: <004601bfeb82$7baeeac0$6561a8c0@devitt.local>
Note that the important thing to do is to capture
the information. The essence of a piecewise object is:
1. there is a bound variable
2. there is one or more conditions on that variable
bound to outcomes, typically computed using that
variable.
3. possibly a default outcome
MathML does NOT evaluate or simplify its expressions.
With this in mind, you probably want to choose between
piecewise( bvar , (condition, value )*, default )
and
piecewise( bvar , default , conditiongroup * )
where
conditiongroup := conditiongroup( condition , value )
Either one will do the job. Both are easy to encode using
csymbol, and bvar, at least in MathML 2.0. (There were some
funny restrictions in MathML 1.0 that did not allow bvars
in new expressions and required function wrappers in the
first argument to apply.) In 2.0 the first of these would look
something like:
<apply>
<bvar>x</bvar>
<csymbol definitionURL="mydefinitionforpiecewise">piecewise</csymbol>
<apply><lt/> ....</apply>
<apply><times/> ...</apply>
<apply></lt/> ... </apply>
value 2
default value
</apply>
Note that reln is deprecated in MathML 2.0
Also, generally speaking it is a bad idea to encode essential
information in comments as sometimes processing strips those
comments away.
There is no real need to use the lambda constructs as that information
would already be contained in the formal definition, and is really more concerned
with evaluation than representation.
Stan Devitt
----- Original Message -----
From: Gérald QUINTANA
To: www-math@w3.org
Sent: Tuesday, July 11, 2000 11:45 AM
Subject: 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 17:48:48 UTC