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

Re: If-conditions & how to evaluate mathml expressions

From: Charles Lyons <maths@mathsonly.com>
Date: Sun, 23 Apr 2006 14:35:07 -0700
Message-Id: <20060423143507.BB7265CB@resin07.mta.everyone.net>
To: <paul@activemath.org>
Cc: <jmo@buerotiger.de>, <www-math@w3.org>

It would almost seem like an in-memory DOM model is the way to go, but you would need to write your own Java classes to handle the actual manipulation of the model. There will be no 'simple' solution to the problem simply because your function could contain any content, not just simple expressions like x*y^2, and as a result your API would need to support more complex structures.

About 8 months ago I was working on such an API in Java for the manipulation of a DOM model (also a second equivalent but optimised CAS model) to do things like expression replacement, evaluation of numerical calculations (e.g. 4 + 5 written in MathML simplifies to just <cn>9</cn>), summations and products, differentiation and other such things; probably this would have helped you greatly. Effectively, it was targeted as being an open-source Java API which is essentially a CAS system accepting MathML input. 

Unfortunately, other more pressing work now takes up my time, and I haven't had any other encouragement that such a thing would actually be useful to anyone else. So it got shelved...

Thanks,
Charles.


--- paul@activemath.org wrote:

From: Paul Libbrecht <paul@activemath.org>
To: Jan Moeller <jmo@buerotiger.de>
Cc: www-math@w3.org
Subject: Re: If-conditions & how to evaluate mathml expressions
Date: Sun, 23 Apr 2006 21:13:32 +0200

This has been requested several times and I do not think there is a 
single answer to it.
On the one hand... you might find such interpreters around... very 
possible, even java and open-source.
On the other hand, such an interpreter is bound to be incomplete or be a 
full-fledged computer-algebra system which isn't that common is rather 
not... light-weight...

If you just wish numerical computation, things may be different and, 
actually, there's a body that just started towards standardizing 
numerical evaluation (the Numerical Math Consortium [1]) of some parts 
of OpenMath and MathML.
But I do not know of open-source implementations there (Scilab maybe ?).

I know there has been some discussions at Jakarta Commons Math [2] 
towards this and that the consensus there is that implementations of 
others should rather be used (e.g. Dautelle's Jade [3]).

Wishing you find more results!

paul

[1] Numerical Math Consortium http://www.nmconsortium.org/
[2] Jakarta Commons Math http://jakarta.apache.org/commons/math/
[3] Jade is now JScience http://jscience.org/


Jan Moeller wrote:
> 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.
> 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
>
>
>



_____________________________________________________________
http://www.easypost.com Anti-Virus & Anti-Spam Web Mail thats hotter than hot
Received on Sunday, 23 April 2006 21:35:17 GMT

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