W3C home > Mailing lists > Public > www-math@w3.org > April 2006

If-conditions & how to evaluate mathml expressions

From: Jan Moeller <jmo@buerotiger.de>
Date: Sun, 23 Apr 2006 12:36:22 +0200
Message-ID: <444B58A6.7080507@buerotiger.de>
To: www-math@w3.org

Hello!

A few days ago I asked how to express if-statements with MathML. Thank 
you all for your replies! What I do know is using content MathML with 
piecewise/piece elements. That's fine for me...

Another short questions:
I need to evaluate a MathML expression within Java. That is, I want to 
read an input stream with MathML/XML content and get back the function 
value the modelled MathML formular would evaluate to.

E.g. a formula like x*y^2 is expressed like this:

<math>
   <apply>
     <plus/>
     <ci>x</ci>
     <apply>
       <power/>
       <ci>y</ci>
       <cn>2</cn>
     </apply>
   </apply>
</math>

This stream expresses f(x,y)=x*y^2, but I do not code the f(...) in MathML.

I need a method to set the variables x and y (in general all ci-elements 
within the content MathML) with values and get the calculated value 
back. E.g. if x=2 and y=3, then I need a class that's able to take an 
MathML input stream & all variables and returns the function value (18).

Does anyone know whether there's an easy way to do this? I searched the 
web, but didn't find anything. This one seems to do the other way 
(create MathML output):

http://www.eteks.com/jeks/en/doc/com/eteks/parser/MathMLInterpreter.html

Thank you!

Jan
Received on Sunday, 23 April 2006 10:43:22 GMT

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