If-conditions & how to evaluate mathml expressions

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 UTC