ScMathML is a [http://www.scala-lang.org/ Scala] library for executing [http://www.w3.org/TR/MathML3/chapter4.html Content MathML].
Why would you want this? Content MathML is a move towards a standard, open format for representing mathematics with relatively well defined semantics. If you're doing calculations, using MathML to represent formulas will make everything
* explicit - no hidden handwavy stuff
* semantically well defined - you can find out exactly what each part does
* transportable - it's machine/problem independant
ScMathML takes formulas, and evaluates them in a Context, which provides access to domain objects, constants etc.
The main site is on [https://bitbucket.org/mo_seph/scmathml BitBucket]: https://bitbucket.org/mo_seph/scmathml
Some quick examples, taken from the unit tests:
running( <apply> <sum /> <bvar><ci>x</ci></bvar> <condition><apply><in/><ci>bond</ci><ci type="set">X</ci></apply></condition> <apply><plus/><cn>2</cn><ci>x</ci></apply> </apply>, "X"->List(1,2,3) ) should equal( 12 ) running( <apply> <sum /> <bvar><ci>x</ci></bvar> <lowlimit><cn>3</cn></lowlimit><uplimit><cn>5</cn></uplimit> <apply><plus/><cn>2</cn><ci>x</ci></apply> </apply> ) should equal( 18 )