OpenMath Package for MuPAD

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:

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=''>
   <OMS cd='arith1' name='plus'/>
   <OMV name='a'/>

// in OpenMath there are definitions how to represent different
// numbers as Complex...
>> generate::OpenMath(3+4*I)
<OMOBJ xmlns=''>
   <OMS cd='complex1' name='complex_cartesian'/>

// ...or Rationals.
>> generate::OpenMath(3/4)
<OMOBJ xmlns=''>
   <OMS cd='nums1' name='rational'/>

// 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=''><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><\

// 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" = ""))

// 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.

1 Response to “OpenMath Package for MuPAD”

  1. 1 Peter Apr 15th, 2008 at 10:08

    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.

Comments are currently closed.