In the last couple of months I’ve developed an OpenMath Package for MuPAD. OpenMath is a new, extensible standard for representing the semantics of mathematical objects. If you haven’t heard about it before you might want to consult the website — it’s somewhat related to MathML.
A rather early preview of the package can be found here:
- OpenMath.zip
- OpenMath.tbz
- OpenMathSCSCP.zip (with SCSCP support)
- OpenMathSCSCP.tbz (with SCSCP support)
It’s organized as a MuPAD package. So if it can be found on the PACKAGEPATH, you can use it like this:
// load the package
>> package("OpenMath")
// generate::OpenMath creates an adt::XML representing the mathematical
// expression
>> generate::OpenMath(1+a)
<OMOBJ xmlns='http://www.openmath.org/OpenMath'>
<OMA>
<OMS cd='arith1' name='plus'/>
<OMV name='a'/>
<OMI>1</OMI>
</OMA>
</OMOBJ>
// in OpenMath there are definitions how to represent different
// numbers as Complex...
>> generate::OpenMath(3+4*I)
<OMOBJ xmlns='http://www.openmath.org/OpenMath'>
<OMA>
<OMS cd='complex1' name='complex_cartesian'/>
<OMI>3</OMI>
<OMI>4</OMI>
</OMA>
</OMOBJ>
// ...or Rationals.
>> generate::OpenMath(3/4)
<OMOBJ xmlns='http://www.openmath.org/OpenMath'>
<OMA>
<OMS cd='nums1' name='rational'/>
<OMI>3</OMI>
<OMI>4</OMI>
</OMA>
</OMOBJ>
// xml2text is a function to get a compact and fast
// string-representation of an adt::XML
>> xml2text(generate::OpenMath(sin(a+1)^2))
"<OMOBJ xmlns='http://www.openmath.org/OpenMath'><OMA><OMS cd='arith1\
' name='power'/><OMA><OMS cd='transc1' name='sin'/><OMA><OMS cd='arit\
h1' name='plus'/><OMV name='a'/><OMI>1</OMI></OMA></OMA><OMI>2</OMI><\
/OMA></OMOBJ>"
// OM::Parser::pase parses either the given file or the passed String
// if the Option 'String' is given
>> OM::Parser::parse(%, String)
OM::XML::OMOBJ([OM::XML::OMA([OM::XML::OMS(table("name" = "power", "c\
d" = "arith1")), OM::XML::OMA([OM::XML::OMS(table("name" = "sin", "cd\
" = "transc1")), OM::XML::OMA([OM::XML::OMS(table("name" = "plus", "c\
d" = "arith1")), OM::XML::OMV(table("name" = "a")), OM::XML::OMI([OM:\
:XML::Data("1")])])]), OM::XML::OMI([OM::XML::Data("2")])])], table("\
xmlns" = "http://www.openmath.org/OpenMath"))
// the result needs to be evaluated to get the proper MuPAD expression
// (This is done to simplify debugging during development.)
>> eval(%)
sin(a + 1)^2
Currently, only a couple of domains (mainly expressions, numbers, polynomials and matrices) are supported.
This is not a stable version to any extend and it you use it in a production environment, you’re insane.
Any feedback is highly appreciated.
Licensing is not copletely clear, yet. I claim that this version is under some BSD-style license.
Hi, Paul! No, the development for SCIEnce is intentionally distinct from the MCS. Whilst the SCIEnce stuff is partly a proof-of-concept with things like clustering and inter-system-interoperability in mind, the MCS is a proper commercial product.